mirror of
https://github.com/aljazceru/cdk.git
synced 2025-12-25 16:44:46 +01:00
Instead, use `INSERT` and `ON CONFLICT`. The reason is that in case of conflicts, the `REPLACE` will trigger a DELETE and then perform an INSERT, as outlined in the documentation[1], and that may cause a cascade of deletion due to our FOREIGN KEYs. Here is the official documentation: ``` When a UNIQUE or PRIMARY KEY constraint violation occurs, the REPLACE algorithm deletes pre-existing rows that are causing the constraint violation prior to inserting or updating the current row and the command continues executing normally. If a NOT NULL constraint violation occurs, the REPLACE conflict resolution replaces the NULL value with the default value for that column, or if the column has no default value, then the ABORT algorithm is used. If a CHECK constraint or foreign key constraint violation occurs, the REPLACE conflict resolution algorithm works like ABORT. When the REPLACE conflict resolution strategy deletes rows in order to satisfy a constraint, delete triggers fire if and only if recursive triggers are enabled. The update hook is not invoked for rows that are deleted by the REPLACE conflict resolution strategy. Nor does REPLACE increment the change counter. The exceptional behaviors defined in this paragraph might change in a future release. ``` [1] https://www.sqlite.org/lang_conflict.html
Cashu Development Kit SQLite Storage Backend
ALPHA This library is in early development, the api will change and should be used with caution.
cdk-sqlite is the sqlite storage backend for cdk.
Crate Feature Flags
The following crate feature flags are available:
| Feature | Default | Description |
|---|---|---|
wallet |
Yes | Enable cashu wallet features |
mint |
Yes | Enable cashu mint wallet features |
Implemented NUTs:
See https://github.com/cashubtc/cdk/blob/main/README.md
Minimum Supported Rust Version (MSRV)
The cdk library should always compile with any combination of features on Rust 1.63.0.
To build and test with the MSRV you will need to pin the below dependency versions:
cargo update -p half --precise 2.2.1
cargo update -p home --precise 0.5.5
cargo update -p tokio --precise 1.38.1
cargo update -p serde_with --precise 3.1.0
cargo update -p reqwest --precise 0.12.4
License
This project is distributed under the MIT software license - see the LICENSE file for details.