Merge branch 'mysql_validate_pre_truncate' into 'master'
Adds validation for schema_migration prior to truncate. See merge request gitlab-org/gitlab-ce!6459
This commit is contained in:
commit
d0187de202
1 changed files with 3 additions and 2 deletions
|
@ -29,10 +29,11 @@ namespace :gitlab do
|
|||
# If MySQL, turn off foreign key checks
|
||||
connection.execute('SET FOREIGN_KEY_CHECKS=0') if Gitlab::Database.mysql?
|
||||
|
||||
tables = connection.tables
|
||||
tables = connection.data_sources
|
||||
# Removes the entry from the array
|
||||
tables.delete 'schema_migrations'
|
||||
# Truncate schema_migrations to ensure migrations re-run
|
||||
connection.execute('TRUNCATE schema_migrations')
|
||||
connection.execute('TRUNCATE schema_migrations') if connection.data_source_exists? 'schema_migrations'
|
||||
|
||||
# Drop tables with cascade to avoid dependent table errors
|
||||
# PG: http://www.postgresql.org/docs/current/static/ddl-depend.html
|
||||
|
|
Loading…
Reference in a new issue