Fix data migration from trigger schedules

This commit is contained in:
Z.J. van de Weg 2017-05-17 22:40:56 +02:00
parent 6a2bcb4b2a
commit cf6ba755c6

View file

@ -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,