Skip to content
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

turn off defense in ffi to allow modifying table sqlite_master #1058

Merged

Conversation

veronikalaskova
Copy link
Contributor

During an upgrade script I alter the original SQL and add foreign keys to the table and encounter a 'table sqlite_master may not be modified' error.
There was already a known issue (#525) that talked about this and had the workaround mentioned.

This problem was re-discovered when writing unit tests (using sqflite_common_ffi) for the upgrade scripts. Same error popped up again as FFI does not currently have a workaround for this.

This PR turns off the SQLITE_DBCONFIG_DEFENSIVE if the SQL command is to set the db_config_defensive_off.

@alextekartik
Copy link
Contributor

Great ! Thanks for diving and finding a similar solution. I'll merge and will try to setup a unit test. I might tweak a little (such as not executing the pragma at all (although it does not hurt, it is just a waste of time.

@alextekartik alextekartik merged commit ffbffeb into tekartik:master Nov 16, 2023
@alextekartik
Copy link
Contributor

Published in sqflite_common_ffi 2.3.0+4

@alextekartik
Copy link
Contributor

Thanks !

karlicoss added a commit to karlicoss/bleanser that referenced this pull request Dec 2, 2023
karlicoss added a commit to karlicoss/bleanser that referenced this pull request Dec 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants