diff options
author | Robert Speicher <robert@gitlab.com> | 2017-05-17 22:23:19 +0000 |
---|---|---|
committer | Regis <boudinot.regis@yahoo.com> | 2017-05-17 22:17:41 -0600 |
commit | 962eb5551fd7a789640f479bffef6ec39131d8cf (patch) | |
tree | b90be3fcb5449c2deee74dfcf4ee26adaf1301e3 /db | |
parent | 12a58aafefab16cd447d7739f238a517fd28a3a7 (diff) | |
download | gitlab-ce-962eb5551fd7a789640f479bffef6ec39131d8cf.tar.gz |
Merge branch 'zj-fix-migration' into 'master'
Fix data migration from trigger schedules
See merge request !11460
Diffstat (limited to 'db')
-rw-r--r-- | db/post_migrate/20170425121605_migrate_trigger_schedules_to_pipeline_schedules.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/db/post_migrate/20170425121605_migrate_trigger_schedules_to_pipeline_schedules.rb b/db/post_migrate/20170425121605_migrate_trigger_schedules_to_pipeline_schedules.rb index a44b399c4de..dae9750558f 100644 --- a/db/post_migrate/20170425121605_migrate_trigger_schedules_to_pipeline_schedules.rb +++ b/db/post_migrate/20170425121605_migrate_trigger_schedules_to_pipeline_schedules.rb @@ -4,6 +4,13 @@ class MigrateTriggerSchedulesToPipelineSchedules < ActiveRecord::Migration DOWNTIME = false def up + connection.execute <<~SQL + DELETE FROM ci_trigger_schedules WHERE NOT EXISTS + (SELECT true FROM projects + WHERE ci_trigger_schedules.project_id = projects.id + ) + SQL + connection.execute <<-SQL INSERT INTO ci_pipeline_schedules ( project_id, |