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

zcash_client_sqlite: Fix handling of PRAGMA directives. #1433

Merged
merged 2 commits into from
Jun 19, 2024

Conversation

nuttycom
Copy link
Contributor

The foreign_keys pragma has no effect when used within a transaction, so it should only be set at the top level. The legacy_alter_table pragma should only be used in cases where its effect is explicitly intended.

Best reviewed hiding whitespace changes.

The `foreign_keys` pragma has no effect when used within a transaction,
so it should only be set at the top level. The `legacy_alter_table`
pragma should only be used in cases where its effect is explicitly
intended.
Copy link

codecov bot commented Jun 19, 2024

Codecov Report

Attention: Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.

Project coverage is 63.13%. Comparing base (4b2a942) to head (1110f5d).
Report is 2 commits behind head on main.

Files Patch % Lines
...ite/src/wallet/init/migrations/full_account_ids.rs 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1433      +/-   ##
==========================================
- Coverage   63.16%   63.13%   -0.03%     
==========================================
  Files         127      127              
  Lines       14868    14864       -4     
==========================================
- Hits         9391     9385       -6     
- Misses       5477     5479       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@str4d str4d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed a452cf9.

zcash_client_sqlite/src/wallet/init.rs Show resolved Hide resolved
zcash_client_sqlite/src/wallet/init.rs Outdated Show resolved Hide resolved
Co-authored-by: str4d <thestr4d@gmail.com>
Copy link
Contributor

@str4d str4d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 1110f5d

@str4d str4d merged commit 5e4c4a0 into zcash:main Jun 19, 2024
27 checks passed
"PRAGMA foreign_keys = OFF;
PRAGMA legacy_alter_table = TRUE;",
)
.execute_batch("PRAGMA foreign_keys = OFF;")
.map_err(|e| MigratorError::Adapter(WalletMigrationError::from(e)))?;
let adapter = RusqliteAdapter::new(&mut wdb.conn, Some("schemer_migrations".to_string()));
adapter.init().expect("Migrations table setup succeeds.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pre-existing issue, but the ? early returns on lines 289 and 292 can bypass resetting PRAGMA foreign_keys = ON, leaving the database in a less-safe state.

Copy link
Contributor

@daira daira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Post-hoc ACK with comment about a pre-existing issue.

@nuttycom nuttycom deleted the fix_migration_pragmas branch June 20, 2024 15:50
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.

3 participants