Commit 927c40ca authored by Kamil Trzcinski's avatar Kamil Trzcinski
Browse files

Fix Ci::Project migration not migrating columns that cannot be NULL [ci skip]

parent 0c21dc075f7c
......@@ -27,11 +27,11 @@ def migrate_project_id_for_builds
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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment