interface ApplyChangesetOptions
Properties #
Skip changes that, when targeted table name is supplied to this function, return a truthy value. By default, all changes are attempted.
#onConflict: ((conflictType: number) => number) | undefined
optional
A function that determines how to handle conflicts. The function receives one argument, which can be one of the following values:
SQLITE_CHANGESET_DATA
: ADELETE
orUPDATE
change does not contain the expected "before" values.SQLITE_CHANGESET_NOTFOUND
: A row matching the primary key of theDELETE
orUPDATE
change does not exist.SQLITE_CHANGESET_CONFLICT
: AnINSERT
change results in a duplicate primary key.SQLITE_CHANGESET_FOREIGN_KEY
: Applying a change would result in a foreign key violation.SQLITE_CHANGESET_CONSTRAINT
: Applying a change results in aUNIQUE
,CHECK
, orNOT NULL
constraint violation.
The function should return one of the following values:
SQLITE_CHANGESET_OMIT
: Omit conflicting changes.SQLITE_CHANGESET_REPLACE
: Replace existing values with conflicting changes (only valid withSQLITE_CHANGESET_DATA
orSQLITE_CHANGESET_CONFLICT
conflicts).SQLITE_CHANGESET_ABORT
: Abort on conflict and roll back the database.
When an error is thrown in the conflict handler or when any other value is returned from the handler, applying the changeset is aborted and the database is rolled back.
Default: A function that returns SQLITE_CHANGESET_ABORT
.