summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2019-04-02 03:51:38 +0000
committerGitLab Release Tools Bot <robert+release-tools@gitlab.com>2019-04-02 15:27:02 +0000
commit1cfc94d36c40ea4d8b5b334914ae8c28b2519f6b (patch)
tree2425194cd1f948182169a41edf2897499ff3aea6
parentbaef7edf8605eb67709f96e05d98ac33d5d03fe2 (diff)
downloadgitlab-ce-1cfc94d36c40ea4d8b5b334914ae8c28b2519f6b.tar.gz
Merge branch 'weimeng-master-patch-83366' into 'master'
Fix attempting to drop views in PostgreSQL See merge request gitlab-org/gitlab-ce!26836 (cherry picked from commit 264a6299583d32af41bd321b275d93a728bcaf72) cfc6d252 Fix attempting to drop views in PostgreSQL
-rw-r--r--lib/tasks/gitlab/db.rake5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/tasks/gitlab/db.rake b/lib/tasks/gitlab/db.rake
index b94b21775ee..4e7a8adbef6 100644
--- a/lib/tasks/gitlab/db.rake
+++ b/lib/tasks/gitlab/db.rake
@@ -29,7 +29,10 @@ namespace :gitlab do
# If MySQL, turn off foreign key checks
connection.execute('SET FOREIGN_KEY_CHECKS=0') if Gitlab::Database.mysql?
- tables = connection.data_sources
+ # connection.tables is deprecated in MySQLAdapter, but in PostgreSQLAdapter
+ # data_sources returns both views and tables, so use #tables instead
+ tables = Gitlab::Database.mysql? ? connection.data_sources : connection.tables
+
# Removes the entry from the array
tables.delete 'schema_migrations'
# Truncate schema_migrations to ensure migrations re-run