Closed 0x2ec closed 1 year ago
@0x2ec appreciate and thanks for your contribution, I accept this fix. Will test this fix against Django framework test suite and push the same.
@praveen-db2 nice! thank you, do let me know if you want me to change anything. I noticed there's a DCO check that's failing in the CI, but looking at the repo history, I figured it's either a new requirement or not really enforced yet.
@0x2ec While doing commit you need to sign off as given here https://github.com/apps/dco Please update PR with updated commit which has your sign. Or create new PR with sign.
Please update PR with updated commit which has your sign.
Done
For bulk operations, like loaddata(), foreign-key constraints are disabled during the operation and re-enabled after completion, but the methods for toggling enforcement of FK constraint would attempt to disable/enable constraints across all the database schemas, but not specify the schema in question for the actual operation. This leads to a crash when there is more than one schema and each of them contain tables with FK constraints.
This should only really be an issue when a fixed list of tables is not provided, the assumption is that if the table names are given then they reside in the current schema.
The solution implemented here is to restrict the toggling of constraint enforcement to just the tables in the current schema.
Fixes: https://github.com/ibmdb/python-ibmdb-django/issues/91