Rake drop tables with cascade
This commit is contained in:
parent
f0c4f72735
commit
50d18a1e1d
1 changed files with 4 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue