-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: return full foreign_key_check error
The `foreign_key_check` pragma returns a list of all the violated foreign key constraints[^1]: > The foreign_key_check pragma returns one row output for each foreign > key violation Each ForeignKeyCheckError store one of those rows. However, only the first row is stored. Store all row returned in a vector in the returned error variant, `Error::ForeignKeyCheck(…)`. [^1]: https://www.sqlite.org/pragma.html#pragma_foreign_key_check
- Loading branch information
Showing
10 changed files
with
103 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...lite_migration/src/tests/snapshots/rusqlite_migration__tests__synch__error_display-2.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
source: rusqlite_migration/src/tests/synch.rs | ||
expression: "Error::Hook(String::new())" | ||
--- | ||
rusqlite_migrate error: Hook("") |
5 changes: 5 additions & 0 deletions
5
...lite_migration/src/tests/snapshots/rusqlite_migration__tests__synch__error_display-3.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
source: rusqlite_migration/src/tests/synch.rs | ||
expression: "Error::ForeignKeyCheck(vec![ForeignKeyCheckError\n {\n table : String :: new(), rowid : 1, parent : String :: new(), fkid\n : 2,\n }, ForeignKeyCheckError\n {\n table : String :: new(), rowid : 2, parent : String :: new(), fkid\n : 3,\n },])" | ||
--- | ||
rusqlite_migrate error: ForeignKeyCheck([ForeignKeyCheckError { table: "", rowid: 1, parent: "", fkid: 2 }, ForeignKeyCheckError { table: "", rowid: 2, parent: "", fkid: 3 }]) |
5 changes: 5 additions & 0 deletions
5
...lite_migration/src/tests/snapshots/rusqlite_migration__tests__synch__error_display-4.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
source: rusqlite_migration/src/tests/synch.rs | ||
expression: "Error::MigrationDefinition(MigrationDefinitionError::NoMigrationsDefined)" | ||
--- | ||
rusqlite_migrate error: MigrationDefinition(NoMigrationsDefined) |
5 changes: 5 additions & 0 deletions
5
...lite_migration/src/tests/snapshots/rusqlite_migration__tests__synch__error_display-5.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
source: rusqlite_migration/src/tests/synch.rs | ||
expression: "Error::RusqliteError {\n query: String::new(),\n err: rusqlite::Error::InvalidQuery,\n}" | ||
--- | ||
rusqlite_migrate error: RusqliteError { query: "", err: InvalidQuery } |
5 changes: 5 additions & 0 deletions
5
rusqlite_migration/src/tests/snapshots/rusqlite_migration__tests__synch__error_display.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
source: rusqlite_migration/src/tests/synch.rs | ||
expression: "Error::SpecifiedSchemaVersion(SchemaVersionError::TargetVersionOutOfRange {\n specified: SchemaVersion::NoneSet,\n highest: SchemaVersion::NoneSet,\n })" | ||
--- | ||
rusqlite_migrate error: SpecifiedSchemaVersion(TargetVersionOutOfRange { specified: NoneSet, highest: NoneSet }) |
22 changes: 22 additions & 0 deletions
22
...igration/src/tests/snapshots/rusqlite_migration__tests__synch__invalid_fk_check_test.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
source: rusqlite_migration/src/tests/synch.rs | ||
expression: migrations.validate() | ||
--- | ||
Err( | ||
ForeignKeyCheck( | ||
[ | ||
ForeignKeyCheckError { | ||
table: "fk2", | ||
rowid: 1, | ||
parent: "fk1", | ||
fkid: 0, | ||
}, | ||
ForeignKeyCheckError { | ||
table: "fk2", | ||
rowid: 2, | ||
parent: "fk1", | ||
fkid: 0, | ||
}, | ||
], | ||
), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters