-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to drop foreign key #157
Comments
Are you asking for the ability to rename columns acting as foreign keys? The DB is going to complain. |
@bendrucker For some reason Knex does not sends the definition of the field (e.g Type, if it is null or not and etc.) when renaming columns, this is necessary to MySQL. About Foreign Keys, adding the types correctly simply does not work, MySQL emits a error about "Foreign Key constraint is incorrectly formed". In time: See this question at stackoverflow about this subject Thanks for the answer, anyway. =) |
There's an existing issue open that covers this #46 Definitely on the radar |
Droping foreign keys is possible in version Suppose you added a foreign key column via
you are able to drop it again via
Just make sure you dropped the foreign key before or with the actual column. |
Can the maintainer please add this to the documentation? |
Hi @stringbeans. There is currently an open issue tracking these missing schema docs #483. Please provide a PR containing the missing method documentation and I'll gladly merge them into our gh-pages branch. Thanks! |
@rhys-vdw thanks! and apologies for not searching for the other issue! |
@stringbeans |
Hello.
Thanks for the great library!
I am testing Knex in a NodeJS application and found a thing that makes sense for migrations: The hability to drop foreign keys in Schema, without dropping columns.
This make senses to allow a field to be renamed correctly when having a foreign key to another table, for example.
And, if possible, too, allow the renameColumn function to detect correctly when a field is a foreign key, drop it and re-create it after the renaming.
But...these is just suggestions, the community is free to think about.
Thanks and sorry for the poor english.
The text was updated successfully, but these errors were encountered: