summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz.bizon@ntsn.pl>2015-12-14 13:00:25 +0000
committerGrzegorz Bizon <grzegorz.bizon@ntsn.pl>2015-12-14 13:00:25 +0000
commit76a17d4f5440184fb9809fef3d57c98f2642ea09 (patch)
treef229a3e47522c5befac9ea4f81b953d6fa64791e /db
parent2ec93abed7a1a3aa49b3267342824e0743de0f54 (diff)
parent73ba411af9f4552e72230d2b9852399e66a23260 (diff)
downloadgitlab-ce-76a17d4f5440184fb9809fef3d57c98f2642ea09.tar.gz
Merge branch 'master' into ci/persist-registration-token
* master: Move CI admin builds and runners specs to correct directory Fix 500 when viewing specific runners on runners page Fix Ci::Project migration not migrating columns that cannot be NULL Fix MySQL migration of CI emails Minor fix in flow 'Merge when build succeeds'
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20151209145909_migrate_ci_emails.rb6
-rw-r--r--db/migrate/20151210125930_migrate_ci_to_project.rb6
2 files changed, 8 insertions, 4 deletions
diff --git a/db/migrate/20151209145909_migrate_ci_emails.rb b/db/migrate/20151209145909_migrate_ci_emails.rb
index 202fac8e3fc..7f330a2cf0a 100644
--- a/db/migrate/20151209145909_migrate_ci_emails.rb
+++ b/db/migrate/20151209145909_migrate_ci_emails.rb
@@ -25,7 +25,11 @@ class MigrateCiEmails < ActiveRecord::Migration
# This function escapes double-quotes and slash
def escape_text(name)
- "REPLACE(REPLACE(#{name}, '\\', '\\\\'), '\"', '\\\"')"
+ if Gitlab::Database.postgresql?
+ "REPLACE(REPLACE(#{name}, '\\', '\\\\'), '\"', '\\\"')"
+ else
+ "REPLACE(REPLACE(#{name}, '\\\\', '\\\\\\\\'), '\\\"', '\\\\\\\"')"
+ end
end
# This function returns 0 or 1 for column
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