Fix attempting to drop views in PostgreSQL

This commit is contained in:
Wei-Meng Lee 2019-04-02 00:19:22 +00:00
parent 34f9dac31f
commit cfc6d2528c
1 changed files with 4 additions and 1 deletions

View File

@ -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