Support adding a NOT VALID to foreign key constraint in Postgres #13905
Labels
P4: nice to have
For issues that are not bugs.
type: feature
For issues and PRs. For new features. Never breaking changes.
Issue Creation Checklist
Feature Description
Postgres has the ability to add
NOT VALID
to a foreign key constraint. When added, it skips the long check on a table. In certain cases this can be a desirable and more reliable way of adding constraints on large production databases.It'd be great if there was an easy and nice way to support this using the ORM DSL, instead of having to write raw SQL to accomplish the task.
Is your feature request related to a problem? Please describe.
No
Describe the solution you'd like
It'd be great if there was an easy and nice way to support this using the ORM DSL, instead of having to write raw SQL to accomplish the task.
Example: Introducing a
notValid: true
key in the options object. Default beingfalse
, to preserve existing behavior.Why should this be in Sequelize
Since the query being generated is from sequelize query interface, it perhaps makes sense for this to be in sequelize package.
Describe alternatives/workarounds you've considered
Writing raw SQL statements.
Additional context
This feature is geared more towards giving developers simpler options to write more reliable SQL statements when working on large production databases (albeit with tradeoffs). In similar vein as #13901. Having this would mean that developers can use the DSL over raw SQL, making it a good dev UX.
Feature Request Checklist
Is this feature dialect-specific?
Would you be willing to implement this feature by submitting a Pull Request?
I am more than happy to work on this and create PR if/when the feature is approved. Thank you!
The text was updated successfully, but these errors were encountered: