diff options
author | Z.J. van de Weg <git@zjvandeweg.nl> | 2017-05-17 23:40:56 +0300 |
---|---|---|
committer | Z.J. van de Weg <git@zjvandeweg.nl> | 2017-05-17 23:47:47 +0300 |
commit | cf6ba755c6caa15a41977be619b4e4091d8ca000 (patch) | |
tree | 6736d70ed644c0ecfede2c4c26338558026802f5 /db/post_migrate | |
parent | 6a2bcb4b2ae8bed4730f3589c2693b17c57b4a75 (diff) |
Fix data migration from trigger schedules
Diffstat (limited to 'db/post_migrate')
-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, |