pub enum OnConflict {
Abort,
Fail,
Ignore,
Replace,
Rollback,
}Expand description
Possible conflict resolution strategies when using Model::insert_or.
The default setting (used by Model::insert) is Abort.
Sourced from the SQLite docs.
Variants§
Abort
When an applicable constraint violation occurs, error and revert any changes made by the current SQL statement. Prior SQL statements in the same transaction are unaffected, and the transaction remains active.
This is the default behavior.
Fail
When an applicable constraint violation occurs, error but do not revert any changes made by the current SQL statement. Prior SQL statements in the same transaction are unaffected, and the transaction remains active.
Ignore
When an applicable constraint violation occurs, skip the row that contains the constraint violation and continue processing the current SQL statement. Other rows, prior statements and the current transaction are unaffected.
When encountering a foreign key constraint error, this behaves like Abort.
Replace
- When a uniqueness or primary key constraint violation occurs, delete the offending rows and continue.
- If a
NOT NULLconstraint violation occurs, the offending column will either be replaced with the default value (if one exists) orAbortbehavior will be used. - If a
CHECKor foreign key constraint violation occurs,Abortbehavior will be used.
Rollback
When an applicable constraint violation occurs, abort the current SQL statement and roll back the current transaction.
If no transaction is active, Abort behavior will be used.
Trait Implementations§
Source§impl Clone for OnConflict
impl Clone for OnConflict
Source§fn clone(&self) -> OnConflict
fn clone(&self) -> OnConflict
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more