From 80772ccaef9c0a883e4686940d7b4e37c5c0609f Mon Sep 17 00:00:00 2001 From: Jose Torres Date: Wed, 21 Sep 2016 21:54:09 +0000 Subject: Adds validation for schema_migration prior to truncate. Adds note to table.delete --- lib/tasks/gitlab/db.rake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/tasks/gitlab/db.rake b/lib/tasks/gitlab/db.rake index 7c96bc864ce..b2780e0a9ac 100644 --- a/lib/tasks/gitlab/db.rake +++ b/lib/tasks/gitlab/db.rake @@ -30,9 +30,10 @@ namespace :gitlab do connection.execute('SET FOREIGN_KEY_CHECKS=0') if Gitlab::Database.mysql? tables = connection.tables + # Removes the entry from the array tables.delete 'schema_migrations' - # Truncate schema_migrations to ensure migrations re-run - connection.execute('TRUNCATE schema_migrations') + # Truncate schema_migrations to ensure migrations re-run + connection.execute('TRUNCATE schema_migrations') if connection.table_exists? 'schema_migrations' # Drop tables with cascade to avoid dependent table errors # PG: http://www.postgresql.org/docs/current/static/ddl-depend.html -- cgit v1.2.1