diff options
author | Alexis Reigel <mail@koffeinfrei.org> | 2017-07-20 16:33:44 +0200 |
---|---|---|
committer | Alexis Reigel <mail@koffeinfrei.org> | 2017-07-27 15:46:03 +0200 |
commit | 57ccff8ea41aa2366f40b29187d3b8d1217264e0 (patch) | |
tree | 720c3a7457fffa96d9985bf004f303d57ff839fb /db | |
parent | 786b5a5991930bb838767a4ed6eed2a67e517e82 (diff) | |
download | gitlab-ce-57ccff8ea41aa2366f40b29187d3b8d1217264e0.tar.gz |
use db's on_delete instead of has_many :dependent
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20170222111732_create_gpg_keys.rb | 2 | ||||
-rw-r--r-- | db/migrate/20170613154149_create_gpg_signatures.rb | 4 | ||||
-rw-r--r-- | db/schema.rb | 6 |
3 files changed, 6 insertions, 6 deletions
diff --git a/db/migrate/20170222111732_create_gpg_keys.rb b/db/migrate/20170222111732_create_gpg_keys.rb index 7591238311f..072c0819b2f 100644 --- a/db/migrate/20170222111732_create_gpg_keys.rb +++ b/db/migrate/20170222111732_create_gpg_keys.rb @@ -5,7 +5,7 @@ class CreateGpgKeys < ActiveRecord::Migration create_table :gpg_keys do |t| t.timestamps_with_timezone null: false - t.references :user, index: true, foreign_key: true + t.references :user, index: true, foreign_key: { on_delete: :cascade } t.binary :primary_keyid, limit: Gitlab::Database.mysql? ? 20 : nil t.binary :fingerprint, limit: Gitlab::Database.mysql? ? 20 : nil diff --git a/db/migrate/20170613154149_create_gpg_signatures.rb b/db/migrate/20170613154149_create_gpg_signatures.rb index d1fe4b96a40..db86170776d 100644 --- a/db/migrate/20170613154149_create_gpg_signatures.rb +++ b/db/migrate/20170613154149_create_gpg_signatures.rb @@ -5,8 +5,8 @@ class CreateGpgSignatures < ActiveRecord::Migration create_table :gpg_signatures do |t| t.timestamps_with_timezone null: false - t.references :project, index: true, foreign_key: true - t.references :gpg_key, index: true, foreign_key: true + t.references :project, index: true, foreign_key: { on_delete: :cascade } + t.references :gpg_key, index: true, foreign_key: { on_delete: :nullify } t.boolean :valid_signature diff --git a/db/schema.rb b/db/schema.rb index 6fa8be79156..1a7eb2ded76 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1631,9 +1631,9 @@ ActiveRecord::Schema.define(version: 20170725145659) do add_foreign_key "environments", "projects", name: "fk_d1c8c1da6a", on_delete: :cascade add_foreign_key "events", "projects", name: "fk_0434b48643", on_delete: :cascade add_foreign_key "forked_project_links", "projects", column: "forked_to_project_id", name: "fk_434510edb0", on_delete: :cascade - add_foreign_key "gpg_keys", "users" - add_foreign_key "gpg_signatures", "gpg_keys" - add_foreign_key "gpg_signatures", "projects" + add_foreign_key "gpg_keys", "users", on_delete: :cascade + add_foreign_key "gpg_signatures", "gpg_keys", on_delete: :nullify + add_foreign_key "gpg_signatures", "projects", on_delete: :cascade add_foreign_key "issue_assignees", "issues", name: "fk_b7d881734a", on_delete: :cascade add_foreign_key "issue_assignees", "users", name: "fk_5e0c8d9154", on_delete: :cascade add_foreign_key "issue_metrics", "issues", on_delete: :cascade |