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...
1 parent a25da8f commit ecd2f15646e03cb953172fce7f4befba053bba16 Marius B. Kotsbak committed Apr 4, 2016
Showing with 2 additions and 2 deletions.
  1. +2 −2 slick/src/main/scala/slick/driver/MySQLDriver.scala
@@ -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.