Merge branch 'cascade_drop' into 'master'

Rake drop tables with cascade

See merge request !4020
This commit is contained in:
Robert Speicher
2016-05-11 11:05:58 +02:00
committed by Yorick Peterse
parent d1ba098695
commit ca66610ed9
+4 -1
View File
@@ -29,7 +29,10 @@ namespace :gitlab do
tables.delete 'schema_migrations'
# Truncate schema_migrations to ensure migrations re-run
connection.execute('TRUNCATE schema_migrations')
tables.each { |t| connection.execute("DROP TABLE #{t}") }
# Drop tables with cascade to avoid dependent table errors
# PG: http://www.postgresql.org/docs/current/static/ddl-depend.html
# MySQL: http://dev.mysql.com/doc/refman/5.7/en/drop-table.html
tables.each { |t| connection.execute("DROP TABLE #{t} CASCADE") }
end
end
end