Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib/tasks
diff options
context:
space:
mode:
authorDrew Blessing <drew@gitlab.com>2016-05-03 17:29:15 +0300
committerDrew Blessing <drew@gitlab.com>2016-05-03 17:29:15 +0300
commit50d18a1e1d945297de4162b2712fa6bbcee0e42e (patch)
tree93065f2f858bca17a201def2bd85ff8833fc3eaf /lib/tasks
parentf0c4f727359a5848d12e2097bad6a6a3190943ef (diff)
Rake drop tables with cascade
Diffstat (limited to 'lib/tasks')
-rw-r--r--lib/tasks/gitlab/db.rake5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/tasks/gitlab/db.rake b/lib/tasks/gitlab/db.rake
index 4921c6e0bcf..1c706dc11b3 100644
--- a/lib/tasks/gitlab/db.rake
+++ b/lib/tasks/gitlab/db.rake
@@ -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