Commit 10d4d584 authored by Drew Blessing's avatar Drew Blessing
Browse files

Add if exists to drop command

parent 50d18a1e
......@@ -29,10 +29,12 @@ namespace :gitlab do
tables.delete 'schema_migrations'
# Truncate schema_migrations to ensure migrations re-run
connection.execute('TRUNCATE schema_migrations')
# Drop tables with cascade to avoid dependent table errors
# PG:
# MySQL:
tables.each { |t| connection.execute("DROP TABLE #{t} CASCADE") }
# Add `IF EXISTS` because cascade could have already deleted a table.
tables.each { |t| connection.execute("DROP TABLE IF EXISTS #{t} CASCADE") }
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