-
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
Option for "DEFEFFERED INITIALLY DEFERRED" in schemas? #1830
Comments
+1 have the same problem |
Here is the workaround I use currently: |
Thank you @derMart I'll dig into knex and see if I can create a PR after Christmas if there isn't one by then. |
+1, this is a real issue in sqlite where we can't alter constraints after creating them. |
In the mean time here's a greatly simplified version of what @derMart posted without lodash and all that nesting: Change |
Is there any chance to have a Knex native way to set "DEFERRABLE INITIALLY DEFERRED" on a table with foreign key constraints ? |
I need this feature too |
Closing old issue with low activity. The feature request doesn't meet current criteria of having API proposal etc. If someone still would like to design this, please open a new feature request. |
When I do something like:
table.integer('user_id').unsigned().index().references('id').inTable('users');
and then create a reference inside a transaction (a reference to a row created just before it in the same transaction). It fails unless I defer the foreign key with the 'initially deferred' option.
Do I need to alter my schemas manually like:
Or is there an easier way within Knex?
The text was updated successfully, but these errors were encountered: