diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2019-07-01 04:25:52 +0000 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2019-07-01 04:25:52 +0000 |
commit | bc71d0b46164e8bcd4af78e5ce15261c8d796c52 (patch) | |
tree | 916092c65bcc99db69084b1bcf10dd072a300e34 /db | |
parent | 5ad09f38cceb7ee648206fd28c155a360cb64d31 (diff) | |
parent | 04af6132b14e594aeddef2a6d0c171af667c9539 (diff) | |
download | gitlab-ce-bc71d0b46164e8bcd4af78e5ce15261c8d796c52.tar.gz |
Merge branch 'add-clusters-to-deployment' into 'master'
Add clusters association to deployment
See merge request gitlab-org/gitlab-ce!29960
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20190623212503_add_cluster_id_to_deployments.rb | 9 | ||||
-rw-r--r-- | db/migrate/20190627051902_add_cluster_id_index_fk_to_deployments.rb | 21 | ||||
-rw-r--r-- | db/schema.rb | 5 |
3 files changed, 34 insertions, 1 deletions
diff --git a/db/migrate/20190623212503_add_cluster_id_to_deployments.rb b/db/migrate/20190623212503_add_cluster_id_to_deployments.rb new file mode 100644 index 00000000000..cd0c4191568 --- /dev/null +++ b/db/migrate/20190623212503_add_cluster_id_to_deployments.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddClusterIdToDeployments < ActiveRecord::Migration[5.1] + DOWNTIME = false + + def change + add_column :deployments, :cluster_id, :integer + end +end diff --git a/db/migrate/20190627051902_add_cluster_id_index_fk_to_deployments.rb b/db/migrate/20190627051902_add_cluster_id_index_fk_to_deployments.rb new file mode 100644 index 00000000000..f41e5c80269 --- /dev/null +++ b/db/migrate/20190627051902_add_cluster_id_index_fk_to_deployments.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class AddClusterIdIndexFkToDeployments < ActiveRecord::Migration[5.1] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index :deployments, :cluster_id + + add_concurrent_foreign_key :deployments, :clusters, column: :cluster_id, on_delete: :nullify + end + + def down + remove_foreign_key :deployments, :clusters + + remove_concurrent_index :deployments, :cluster_id + end +end diff --git a/db/schema.rb b/db/schema.rb index 87a935ee08e..50fee850f9f 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: 20190625184066) do +ActiveRecord::Schema.define(version: 20190627051902) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -1066,6 +1066,8 @@ ActiveRecord::Schema.define(version: 20190625184066) do t.string "on_stop" t.integer "status", limit: 2, null: false t.datetime_with_timezone "finished_at" + t.integer "cluster_id" + t.index ["cluster_id"], name: "index_deployments_on_cluster_id", using: :btree t.index ["created_at"], name: "index_deployments_on_created_at", using: :btree t.index ["deployable_type", "deployable_id"], name: "index_deployments_on_deployable_type_and_deployable_id", using: :btree t.index ["environment_id", "id"], name: "index_deployments_on_environment_id_and_id", using: :btree @@ -3659,6 +3661,7 @@ ActiveRecord::Schema.define(version: 20190625184066) do add_foreign_key "dependency_proxy_blobs", "namespaces", column: "group_id", name: "fk_db58bbc5d7", on_delete: :cascade add_foreign_key "dependency_proxy_group_settings", "namespaces", column: "group_id", name: "fk_616ddd680a", on_delete: :cascade add_foreign_key "deploy_keys_projects", "projects", name: "fk_58a901ca7e", on_delete: :cascade + add_foreign_key "deployments", "clusters", name: "fk_289bba3222", on_delete: :nullify add_foreign_key "deployments", "projects", name: "fk_b9a3851b82", on_delete: :cascade add_foreign_key "design_management_designs", "issues", on_delete: :cascade add_foreign_key "design_management_designs", "projects", on_delete: :cascade |