#[non_exhaustive]pub enum ForeignKeys {
Rust,
SQLite,
}Expand description
Which method should be used to check foreign-key constraints.
The default is ForeignKeys::SQLite, but this is likely to change to ForeignKeys::Rust.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Rust
Foreign-key constraints are checked by rust-query only.
Most foreign-key checks are done at compile time and are thus completely free. However, some runtime checks are required for deletes.
SQLite
Foreign-key constraints are checked by SQLite in addition to the checks done by rust-query.
This is useful when using rust-query with crate::TransactionWeak::rusqlite_transaction or when other software can write to the database. Both can result in “dangling” foreign keys (which point at a non-existent row) if written incorrectly. Dangling foreign keys can result in wrong results, but these dangling foreign keys can also turn into “false” foreign keys if a new record is inserted that makes the foreign key valid. This is a lot worse than a dangling foreign key, because it is generally not possible to detect.
With the ForeignKeys::SQLite option, rust-query will prevent creating such false foreign keys and panic instead. The downside is that indexes are required on all foreign keys to make the checks efficient.