Skip to content
Permalink
Browse files
Add quoting of table names and fk in ALTER TABLE for MySQL
Closes #1471: Drop / dropStatements for MySQL are not escaping reserved words (like "order")
  • Loading branch information
mkotsbakws committed Apr 4, 2016
1 parent a25da8f commit ecd2f15646e03cb953172fce7f4befba053bba16
Showing 1 changed file with 2 additions and 2 deletions.
@@ -191,10 +191,10 @@ trait MySQLDriver extends JdbcDriver { driver =>

class TableDDLBuilder(table: Table[_]) extends super.TableDDLBuilder(table) {
override protected def dropForeignKey(fk: ForeignKey) = {
"ALTER TABLE " + table.tableName + " DROP FOREIGN KEY " + fk.name
"ALTER TABLE " + quoteIdentifier(table.tableName) + " DROP FOREIGN KEY " + quoteIdentifier(fk.name)
}
override protected def dropPrimaryKey(pk: PrimaryKey): String = {
"ALTER TABLE " + table.tableName + " DROP PRIMARY KEY"
"ALTER TABLE " + quoteIdentifier(table.tableName) + " DROP PRIMARY KEY"
}
}

0 comments on commit ecd2f15

Please sign in to comment.