Commit 4fbb284c authored by Stan Hu's avatar Stan Hu

Merge branch 'fix_issue_15259' into 'master'

Fix bug with SQL syntax error during backup restoration

## What does this MR do?
It properly escapes the table name in the `DROP TABLE IF EXISTS ...` statement used during restore of a backup.

## Are there points in the code the reviewer needs to double check?
Please check compatibility with PostgreSQL

## Why was this MR needed?
Fix an issue with backups can not be restored if MySQL is used as database for GitLab.

## What are the relevant issue numbers?
#15259 

## Screenshots (if relevant)
-

See merge request !4318
parents 69e72774 97aecdea
......@@ -34,7 +34,7 @@ namespace :gitlab do
# PG: http://www.postgresql.org/docs/current/static/ddl-depend.html
# MySQL: http://dev.mysql.com/doc/refman/5.7/en/drop-table.html
# Add `IF EXISTS` because cascade could have already deleted a table.
tables.each { |t| connection.execute("DROP TABLE IF EXISTS #{t} CASCADE") }
tables.each { |t| connection.execute("DROP TABLE IF EXISTS `#{t}` CASCADE") }
end
desc 'Configures the database by running migrate, or by loading the schema and seeding if needed'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment