Commit 1cfc94d3 authored by Stan Hu's avatar Stan Hu Committed by GitLab Release Tools Bot

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 264a6299)

cfc6d252 Fix attempting to drop views in PostgreSQL
parent baef7edf
......@@ -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
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