diff options
author | Rydkin Maxim <maks.rydkin@gmail.com> | 2017-03-21 00:48:05 +0300 |
---|---|---|
committer | Rydkin Maxim <maks.rydkin@gmail.com> | 2017-04-04 21:11:25 +0300 |
commit | 4f748f74bc561ed6cc37f2c57077e72c0cda8c9a (patch) | |
tree | e69c6924775da6485fecd4f35366483c6e968e09 | |
parent | b49e79662e8157d7feb371737f6350dce11118e3 (diff) | |
download | gitlab-ce-4f748f74bc561ed6cc37f2c57077e72c0cda8c9a.tar.gz |
replace on_delete in migration with database type related expression
-rw-r--r-- | db/migrate/20170312114329_add_auto_canceled_by_id_to_pipeline.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/db/migrate/20170312114329_add_auto_canceled_by_id_to_pipeline.rb b/db/migrate/20170312114329_add_auto_canceled_by_id_to_pipeline.rb index 5156860586a..46dab852fcf 100644 --- a/db/migrate/20170312114329_add_auto_canceled_by_id_to_pipeline.rb +++ b/db/migrate/20170312114329_add_auto_canceled_by_id_to_pipeline.rb @@ -24,8 +24,15 @@ class AddAutoCanceledByIdToPipeline < ActiveRecord::Migration disable_ddl_transaction! def up + on_delete = + if Database.mysql? + :nullify + else + 'SET NULL' + end + add_column :ci_pipelines, :auto_canceled_by_id, :integer - add_concurrent_foreign_key :ci_pipelines, :ci_pipelines, column: :auto_canceled_by_id, on_delete: :nullify + add_concurrent_foreign_key :ci_pipelines, :ci_pipelines, column: :auto_canceled_by_id, on_delete: on_delete end def down |