-
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
[SQLite] dropForeign
is silently ignored
#4369
Comments
I'm also a little confused why the tests haven't caught this 🤔 There is an integration test for foreign keys that does seem to test for this: knex/test/integration/schema/foreign-keys.js Lines 80 to 91 in 2bce36e
but it still passes in SQLite.. I did see that foreign_keys is enabled in the pool options in the test-runner: Lines 24 to 32 in 2bce36e
The only thing I can think of is that this option somehow isn't actually used? That would explain SQLite silently ignoring foreign key constraints (@kibertoad) |
I think the issue with the integration test is that it doesn't actually check if the foreign key constraints have been deleted. |
I'd expected that insertion on 86 to throw an invalid key constraint error though, seeing it didn't delete the foreign key constraint 🤔 |
Yeah right, but the test would pass anyway without an |
Hmm I was under the impression that an unexpected error (in this case the throw from |
I just checked it and it seems like tests indeed pass even if there was an exception. Mocha even says But in this case the |
@kibertoad I hate to be that guy, but when is the next patch release scheduled? 😁 |
@rijkvanzanten Apologies for the delay, another swamp surge came in and consumed me entirely. Appreciate the ping, will do the release tonight. |
No worries! I totally understand the business and life getting in the way 😄 |
Released in 0.95.3. |
Environment
Knex version: 0.95.2
Database + version: SQLite (any)
OS: macOS
Bug
When using
.dropForeign()
in SQLite, it's silently ignored. When inspecting the queries made, it correctly creates a new temp table for thealterTable
call, but fails to strip out theFOREIGN KEY
line in the create table sql.n/a
https://runkit.com/rijkvanzanten/knex-sqlite-drop-foreign-example
(@nickrum, before I start chopping away in your amazing work from the other day, do you have any instructions on how to (re-)implement
dropForeign
using the new tokenized approach you set up?)The text was updated successfully, but these errors were encountered: