diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-12-14 14:31:23 +0300 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-12-14 14:31:35 +0300 |
commit | 927c40ca496dcb1e7daa567ce173de044b1d3377 (patch) | |
tree | 3bd89908778cbc2fe6752187e84311c5edb9c7b7 | |
parent | 208f99ff6c24a2dd5a69ed5666a1fd224d78c59b (diff) |
Fix Ci::Project migration not migrating columns that cannot be NULL [ci skip]
-rw-r--r-- | db/migrate/20151210125930_migrate_ci_to_project.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/db/migrate/20151210125930_migrate_ci_to_project.rb b/db/migrate/20151210125930_migrate_ci_to_project.rb index d17b2a425f8..7dfe05174ee 100644 --- a/db/migrate/20151210125930_migrate_ci_to_project.rb +++ b/db/migrate/20151210125930_migrate_ci_to_project.rb @@ -27,11 +27,11 @@ class MigrateCiToProject < ActiveRecord::Migration def migrate_project_column(column, new_column = nil) new_column ||= column subquery = "SELECT ci_projects.#{column} FROM ci_projects WHERE projects.id = ci_projects.gitlab_id" - execute("UPDATE projects SET #{new_column}=(#{subquery}) WHERE #{new_column} IS NULL AND (#{subquery}) IS NOT NULL") + execute("UPDATE projects SET #{new_column}=(#{subquery}) WHERE (#{subquery}) IS NOT NULL") end def migrate_ci_service - subquery = "SELECT active FROM services WHERE projects.id = services.project_id AND type='GitlabCiService'" - execute("UPDATE projects SET builds_enabled=(#{subquery}) WHERE builds_enabled IS NULL AND (#{subquery}) IS NOT NULL") + subquery = "SELECT active FROM services WHERE projects.id = services.project_id AND type='GitlabCiService' LIMIT 1" + execute("UPDATE projects SET builds_enabled=(#{subquery}) WHERE (#{subquery}) IS NOT NULL") end end |