Commit b7d6a79a authored by pbair's avatar pbair

Use DROP SCHEMA ... CASCADE in db:drop_tables

When dropping the EXTRA_SCHEMAS in the rake task gitlab:db:drop_tables,
specify a CASCADE as well, in case we have detached partitions which
won't be automatically removed by dropping the parent table.
parent 8fe210bd
......@@ -49,7 +49,7 @@ namespace :gitlab do
# Drop all extra schema objects GitLab owns
Gitlab::Database::EXTRA_SCHEMAS.each do |schema|
connection.execute("DROP SCHEMA IF EXISTS #{connection.quote_table_name(schema)}")
connection.execute("DROP SCHEMA IF EXISTS #{connection.quote_table_name(schema)} CASCADE")
end
end
......
......@@ -191,7 +191,7 @@ RSpec.describe 'gitlab:db namespace rake task', :silence_stdout do
it 'drops extra schemas' do
Gitlab::Database::EXTRA_SCHEMAS.each do |schema|
expect(connection).to receive(:execute).with("DROP SCHEMA IF EXISTS \"#{schema}\"")
expect(connection).to receive(:execute).with("DROP SCHEMA IF EXISTS \"#{schema}\" CASCADE")
end
subject
......
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