diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-03-05 23:40:59 +0300 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-03-05 23:41:29 +0300 |
commit | e4a9b8a9e1f4052fde9ecacad73e2f96fdd8d21d (patch) | |
tree | e34236e4928ad2e9c4bd542867b31174a449e350 /db | |
parent | b626869f8fccfef65a652b0acca7c52a3647aeb3 (diff) |
Move foreign key to separate migration
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20170217151948_add_owner_id_to_triggers.rb | 1 | ||||
-rw-r--r-- | db/migrate/20170305203726_add_owner_id_foreign_key.rb | 11 | ||||
-rw-r--r-- | db/schema.rb | 4 |
3 files changed, 13 insertions, 3 deletions
diff --git a/db/migrate/20170217151948_add_owner_id_to_triggers.rb b/db/migrate/20170217151948_add_owner_id_to_triggers.rb index 845c89c703e..16d7cc5bed6 100644 --- a/db/migrate/20170217151948_add_owner_id_to_triggers.rb +++ b/db/migrate/20170217151948_add_owner_id_to_triggers.rb @@ -5,6 +5,5 @@ class AddOwnerIdToTriggers < ActiveRecord::Migration def change add_column :ci_triggers, :owner_id, :integer - add_foreign_key :ci_triggers, :users, column: :owner_id, on_delete: :cascade end end diff --git a/db/migrate/20170305203726_add_owner_id_foreign_key.rb b/db/migrate/20170305203726_add_owner_id_foreign_key.rb new file mode 100644 index 00000000000..3eece0e2eb5 --- /dev/null +++ b/db/migrate/20170305203726_add_owner_id_foreign_key.rb @@ -0,0 +1,11 @@ +class AddOwnerIdForeignKey < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def change + add_concurrent_foreign_key :ci_triggers, :users, column: :owner_id, on_delete: :cascade + end +end diff --git a/db/schema.rb b/db/schema.rb index 75daae86a4a..9deed46530e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170217151949) do +ActiveRecord::Schema.define(version: 20170305203726) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -1335,7 +1335,7 @@ ActiveRecord::Schema.define(version: 20170217151949) do add_index "web_hooks", ["project_id"], name: "index_web_hooks_on_project_id", using: :btree add_foreign_key "boards", "projects" - add_foreign_key "ci_triggers", "users", column: "owner_id", on_delete: :cascade + add_foreign_key "ci_triggers", "users", column: "owner_id", name: "fk_e8e10d1964", on_delete: :cascade add_foreign_key "issue_metrics", "issues", on_delete: :cascade add_foreign_key "label_priorities", "labels", on_delete: :cascade add_foreign_key "label_priorities", "projects", on_delete: :cascade |