diff options
Diffstat (limited to 'db/migrate/20150924125436_migrate_project_id_for_ci_commits.rb')
-rw-r--r-- | db/migrate/20150924125436_migrate_project_id_for_ci_commits.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/db/migrate/20150924125436_migrate_project_id_for_ci_commits.rb b/db/migrate/20150924125436_migrate_project_id_for_ci_commits.rb new file mode 100644 index 00000000000..2be57b6062e --- /dev/null +++ b/db/migrate/20150924125436_migrate_project_id_for_ci_commits.rb @@ -0,0 +1,6 @@ +class MigrateProjectIdForCiCommits < ActiveRecord::Migration + def up + subquery = 'SELECT gitlab_id FROM ci_projects WHERE ci_projects.id = ci_commits.project_id' + execute("UPDATE ci_commits SET gl_project_id=(#{subquery}) WHERE gl_project_id IS NULL") + end +end |