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

feat: Add migration for keyset_id as foreign key in SQLite database #634

Merged
merged 7 commits into from
Mar 8, 2025

Conversation

thesimplekid
Copy link
Collaborator

@thesimplekid thesimplekid commented Mar 6, 2025

Description


closes #628

Notes to the reviewers


Suggested CHANGELOG Updates

CHANGED

ADDED

REMOVED

FIXED


Checklist

@thesimplekid thesimplekid requested a review from crodas March 6, 2025 16:41
@thesimplekid
Copy link
Collaborator Author

cc @ok300

tracing::debug!("Attempting to add known proof. Skipping.... {:?}", err);
.await;

if let Err(err) = result {
Copy link
Contributor

Choose a reason for hiding this comment

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

The error matching is becoming quite complex. Instead it, why not change the query to INSERT ON CONFLICT IGNORE or INSERT OR IGNORE? I think that would automatically cover both relevant error types:

  • proof is already known (conflict on proof's PK y)
  • conflict on FK constraint

We wouldn't know why a proof wasn't inserted, but if that's important, we could 1-2 validation steps before the query (check if proof's PK y is known, check if foreign key is valid).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Address in c6f3318

I think we still want to error and rollback when there is a fk error

@thesimplekid thesimplekid added this to the v0.8.0 milestone Mar 7, 2025
@thesimplekid thesimplekid merged commit 467cc0a into cashubtc:main Mar 8, 2025
63 checks passed
@thesimplekid thesimplekid deleted the keyset_foreign_key branch March 10, 2025 09:07
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.

cdk-mintd database: use foreign key for keyset ID in proofs table
2 participants