Skip to content

Node v12 breaks addForeignKey #635

Closed
@lukemuller

Description

@lukemuller

I'm submitting a...

  • Bug report
  • Feature request
  • Question

Current behavior

On node v12 when trying to add a foreign key the util.format() function no longer formats the SQL correctly and an error occurs.

ALTER TABLE `users` ADD CONSTRAINT `users_userID_fk` FOREIGN KEY ([ '`referredBy`' ]) REFERENCES `users` ([ '`userID`' ]) ON DELETE SET NULL ON UPDATE CASCADE
[ERROR] AssertionError [ERR_ASSERTION]: ifError got unwanted exception: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[ '`referredBy`' ]) REFERENCES `users` ([ '`userID`' ]) ON DELETE SET NULL ON UP' at line 1

Expected behavior

On node version's before v12 the util.format() function that is used in addForeignKey works successfully and format the SQL correctly.

Minimal reproduction of the problem with instructions

Install node v12 and try creating a table with a foreign key or adding a foreign key to an exisiting table.

Environment


db-migrate version: 0.11.6
plugins with versions: db-migrate-mysql 1.1.10
db-migrate driver with versions: mysql2 1.6.5

Additional information:
- Node version: 12
- Platform:  Linux

Others:

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions