You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After spending a bit of time trying to figure out why Fluent's deleteForeignKey(...) wouldn't delete foreign keys, I discovered that the actual SQL command isn't valid.
When using the database's modify command like so
try database.modify(Child.self){ builder in
builder.deleteForeignKey("user_id, referencing: "id", on:User.self)}
the SQL query generated returns
ALTERTABLE'children' DROP 'user_id', DROP '_fluent_fk_children.user_id-users.id'
This isn't valid for deleting key constraints. The correct query should read
ALTERTABLE'children' DROP 'user_id', DROP FOREIGN KEY'_fluent_fk_children.user_id-users.id'
The text was updated successfully, but these errors were encountered:
anthonycastelli
changed the title
Fluent's deleteForeignKey dent generate a valid SQL command
Fluent's deleteForeignKey doesn't generate a valid SQL command
Jul 23, 2017
After spending a bit of time trying to figure out why Fluent's
deleteForeignKey(...)
wouldn't delete foreign keys, I discovered that the actual SQL command isn't valid.When using the database's modify command like so
the SQL query generated returns
This isn't valid for deleting key constraints. The correct query should read
The text was updated successfully, but these errors were encountered: