From 5896d8ca904ceee385f8db0cc5a8168892d51038 Mon Sep 17 00:00:00 2001 From: Mosen Date: Fri, 17 Jun 2016 23:30:48 +1000 Subject: [PATCH] Provide down migrations. --- migrations/201606170001_devices_down.sql | 2 ++ migrations/201606170001_devices_up.sql | 1 + migrations/201606170002_workflows_down.sql | 1 + migrations/201606170002_workflows_up.sql | 8 +------- migrations/201606170003_profiles_down.sql | 1 + migrations/201606170003_profiles_up.sql | 3 +-- migrations/201606170004_workflow_profile_down.sql | 1 + migrations/201606170004_workflow_profile_up.sql | 1 - migrations/201606170005_workflow_workflow_down.sql | 1 + migrations/201606170005_workflow_workflow_up.sql | 1 - 10 files changed, 9 insertions(+), 11 deletions(-) create mode 100644 migrations/201606170001_devices_down.sql create mode 100644 migrations/201606170002_workflows_down.sql create mode 100644 migrations/201606170003_profiles_down.sql create mode 100644 migrations/201606170004_workflow_profile_down.sql create mode 100644 migrations/201606170005_workflow_workflow_down.sql diff --git a/migrations/201606170001_devices_down.sql b/migrations/201606170001_devices_down.sql new file mode 100644 index 00000000..834523f9 --- /dev/null +++ b/migrations/201606170001_devices_down.sql @@ -0,0 +1,2 @@ +DROP INDEX serial_idx; +DROP TABLE devices; diff --git a/migrations/201606170001_devices_up.sql b/migrations/201606170001_devices_up.sql index 0801156c..d56e5576 100644 --- a/migrations/201606170001_devices_up.sql +++ b/migrations/201606170001_devices_up.sql @@ -1,4 +1,5 @@ CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; + CREATE TABLE IF NOT EXISTS devices ( device_uuid uuid PRIMARY KEY DEFAULT uuid_generate_v4(), udid text NOT NULL DEFAULT '', diff --git a/migrations/201606170002_workflows_down.sql b/migrations/201606170002_workflows_down.sql new file mode 100644 index 00000000..a68d94d3 --- /dev/null +++ b/migrations/201606170002_workflows_down.sql @@ -0,0 +1 @@ +DROP TABLE workflows; \ No newline at end of file diff --git a/migrations/201606170002_workflows_up.sql b/migrations/201606170002_workflows_up.sql index 99d79b39..431e7c60 100644 --- a/migrations/201606170002_workflows_up.sql +++ b/migrations/201606170002_workflows_up.sql @@ -1,11 +1,5 @@ CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; CREATE TABLE IF NOT EXISTS workflows ( - workflow_uuid uuid PRIMARY KEY - DEFAULT uuid_generate_v4(), + workflow_uuid uuid PRIMARY KEY DEFAULT uuid_generate_v4(), name text UNIQUE NOT NULL CHECK (name <> '') ); - - - - - diff --git a/migrations/201606170003_profiles_down.sql b/migrations/201606170003_profiles_down.sql new file mode 100644 index 00000000..f23f48ad --- /dev/null +++ b/migrations/201606170003_profiles_down.sql @@ -0,0 +1 @@ +DROP TABLE profiles; diff --git a/migrations/201606170003_profiles_up.sql b/migrations/201606170003_profiles_up.sql index 2a070810..d3c1bca3 100644 --- a/migrations/201606170003_profiles_up.sql +++ b/migrations/201606170003_profiles_up.sql @@ -1,6 +1,5 @@ CREATE TABLE IF NOT EXISTS profiles ( - profile_uuid uuid PRIMARY KEY - DEFAULT uuid_generate_v4(), + profile_uuid uuid PRIMARY KEY DEFAULT uuid_generate_v4(), payload_identifier text UNIQUE NOT NULL CHECK (payload_identifier <> ''), profile_data bytea ); diff --git a/migrations/201606170004_workflow_profile_down.sql b/migrations/201606170004_workflow_profile_down.sql new file mode 100644 index 00000000..f674f1a0 --- /dev/null +++ b/migrations/201606170004_workflow_profile_down.sql @@ -0,0 +1 @@ +DROP TABLE workflow_profile; diff --git a/migrations/201606170004_workflow_profile_up.sql b/migrations/201606170004_workflow_profile_up.sql index 17cd2783..27feeb74 100644 --- a/migrations/201606170004_workflow_profile_up.sql +++ b/migrations/201606170004_workflow_profile_up.sql @@ -3,4 +3,3 @@ CREATE TABLE IF NOT EXISTS workflow_profile ( profile_uuid uuid REFERENCES profiles, PRIMARY KEY (workflow_uuid, profile_uuid) ); - diff --git a/migrations/201606170005_workflow_workflow_down.sql b/migrations/201606170005_workflow_workflow_down.sql new file mode 100644 index 00000000..110edf1c --- /dev/null +++ b/migrations/201606170005_workflow_workflow_down.sql @@ -0,0 +1 @@ +DROP TABLE workflow_workflow; diff --git a/migrations/201606170005_workflow_workflow_up.sql b/migrations/201606170005_workflow_workflow_up.sql index 806a199e..9b0d81ca 100644 --- a/migrations/201606170005_workflow_workflow_up.sql +++ b/migrations/201606170005_workflow_workflow_up.sql @@ -3,4 +3,3 @@ CREATE TABLE IF NOT EXISTS workflow_workflow ( included_workflow_uuid uuid REFERENCES workflows(workflow_uuid), PRIMARY KEY (workflow_uuid, included_workflow_uuid) ); -