summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorWei-Meng Lee <1081658-weimeng@users.noreply.gitlab.com>2019-04-02 00:19:22 +0000
committerWei-Meng Lee <1081658-weimeng@users.noreply.gitlab.com>2019-04-02 00:19:22 +0000
commitcfc6d2528cc8d632f16b23334795be537511cfef (patch)
treec5328f816731caa0877f3c526086f390ba2fc851 /lib
parent34f9dac31fd6a4ffe2998f2f9bbc97a4db1442fa (diff)
downloadgitlab-ce-cfc6d2528cc8d632f16b23334795be537511cfef.tar.gz
Fix attempting to drop views in PostgreSQLweimeng-master-patch-83366
Diffstat (limited to 'lib')
-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