aboutsummaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20180216231420_create_govuk_guix_revisions.rb11
-rw-r--r--db/migrate/20180217104954_change_govuk_guix_revisions_column_name.rb5
-rw-r--r--db/migrate/20180217105604_change_govuk_guix_revisions_primary_key.rb7
-rw-r--r--db/migrate/20180217110041_add_govuk_guix_revision_to_mini_environment.rb5
-rw-r--r--db/migrate/20180217131053_add_start_command_to_mini_environment.rb5
5 files changed, 33 insertions, 0 deletions
diff --git a/db/migrate/20180216231420_create_govuk_guix_revisions.rb b/db/migrate/20180216231420_create_govuk_guix_revisions.rb
new file mode 100644
index 0000000..0572119
--- /dev/null
+++ b/db/migrate/20180216231420_create_govuk_guix_revisions.rb
@@ -0,0 +1,11 @@
+class CreateGovukGuixRevisions < ActiveRecord::Migration[5.1]
+ def change
+ create_table :govuk_guix_revisions do |t|
+ t.string :treeish
+ t.string :store_path
+
+ t.timestamps
+ end
+ add_index :govuk_guix_revisions, :treeish, unique: true
+ end
+end
diff --git a/db/migrate/20180217104954_change_govuk_guix_revisions_column_name.rb b/db/migrate/20180217104954_change_govuk_guix_revisions_column_name.rb
new file mode 100644
index 0000000..cf57216
--- /dev/null
+++ b/db/migrate/20180217104954_change_govuk_guix_revisions_column_name.rb
@@ -0,0 +1,5 @@
+class ChangeGovukGuixRevisionsColumnName < ActiveRecord::Migration[5.1]
+ def change
+ rename_column :govuk_guix_revisions, :treeish, :commit_hash
+ end
+end
diff --git a/db/migrate/20180217105604_change_govuk_guix_revisions_primary_key.rb b/db/migrate/20180217105604_change_govuk_guix_revisions_primary_key.rb
new file mode 100644
index 0000000..5b582ad
--- /dev/null
+++ b/db/migrate/20180217105604_change_govuk_guix_revisions_primary_key.rb
@@ -0,0 +1,7 @@
+class ChangeGovukGuixRevisionsPrimaryKey < ActiveRecord::Migration[5.1]
+ def change
+ execute 'ALTER TABLE govuk_guix_revisions DROP CONSTRAINT govuk_guix_revisions_pkey;'
+ execute 'ALTER TABLE govuk_guix_revisions ADD PRIMARY KEY (commit_hash);'
+ remove_column :govuk_guix_revisions, :id
+ end
+end
diff --git a/db/migrate/20180217110041_add_govuk_guix_revision_to_mini_environment.rb b/db/migrate/20180217110041_add_govuk_guix_revision_to_mini_environment.rb
new file mode 100644
index 0000000..56d5883
--- /dev/null
+++ b/db/migrate/20180217110041_add_govuk_guix_revision_to_mini_environment.rb
@@ -0,0 +1,5 @@
+class AddGovukGuixRevisionToMiniEnvironment < ActiveRecord::Migration[5.1]
+ def change
+ add_reference :mini_environments, :govuk_guix_revision, type: :string, foreign_key: { primary_key: :commit_hash }
+ end
+end
diff --git a/db/migrate/20180217131053_add_start_command_to_mini_environment.rb b/db/migrate/20180217131053_add_start_command_to_mini_environment.rb
new file mode 100644
index 0000000..05d8704
--- /dev/null
+++ b/db/migrate/20180217131053_add_start_command_to_mini_environment.rb
@@ -0,0 +1,5 @@
+class AddStartCommandToMiniEnvironment < ActiveRecord::Migration[5.1]
+ def change
+ add_column :mini_environments, :start_command, :string
+ end
+end