Skip to content

Commit

Permalink
Add quoting of table names and fk in ALTER TABLE for MySQL
Browse files Browse the repository at this point in the history
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 ecd2f15
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions slick/src/main/scala/slick/driver/MySQLDriver.scala
Expand Up @@ -191,10 +191,10 @@ trait MySQLDriver extends JdbcDriver { driver =>


class TableDDLBuilder(table: Table[_]) extends super.TableDDLBuilder(table) { class TableDDLBuilder(table: Table[_]) extends super.TableDDLBuilder(table) {
override protected def dropForeignKey(fk: ForeignKey) = { 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 = { override protected def dropPrimaryKey(pk: PrimaryKey): String = {
"ALTER TABLE " + table.tableName + " DROP PRIMARY KEY" "ALTER TABLE " + quoteIdentifier(table.tableName) + " DROP PRIMARY KEY"
} }
} }


Expand Down

0 comments on commit ecd2f15

Please sign in to comment.