aboutsummaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-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
-rw-r--r--db/schema.rb13
6 files changed, 45 insertions, 1 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
diff --git a/db/schema.rb b/db/schema.rb
index 39cc82c..bf9d773 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20180206203924) do
+ActiveRecord::Schema.define(version: 20180217131053) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -22,11 +22,21 @@ ActiveRecord::Schema.define(version: 20180206203924) do
t.datetime "updated_at", null: false
end
+ create_table "govuk_guix_revisions", primary_key: "commit_hash", id: :string, force: :cascade do |t|
+ t.string "store_path"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ t.index ["commit_hash"], name: "index_govuk_guix_revisions_on_commit_hash", unique: true
+ end
+
create_table "mini_environments", force: :cascade do |t|
t.string "name"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.jsonb "info"
+ t.string "govuk_guix_revision_id"
+ t.string "start_command"
+ t.index ["govuk_guix_revision_id"], name: "index_mini_environments_on_govuk_guix_revision_id"
end
create_table "minienvironments", force: :cascade do |t|
@@ -63,4 +73,5 @@ ActiveRecord::Schema.define(version: 20180206203924) do
t.boolean "disabled", default: false
end
+ add_foreign_key "mini_environments", "govuk_guix_revisions", primary_key: "commit_hash"
end