-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3680 from hasezoey/addSqliteRowId
feat(diesel_cli) sqlite use "rowid" if no explicit primary key is present
- Loading branch information
Showing
5 changed files
with
96 additions
and
5 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
2 changes: 2 additions & 0 deletions
2
diesel_cli/tests/print_schema/print_schema_sqlite_without_explicit_primary_key/diesel.toml
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,2 @@ | ||
[print_schema] | ||
file = "src/schema.rs" |
29 changes: 29 additions & 0 deletions
29
.../tests/print_schema/print_schema_sqlite_without_explicit_primary_key/sqlite/expected.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,29 @@ | ||
--- | ||
source: diesel_cli/tests/print_schema.rs | ||
description: "Test: print_schema_sqlite_without_explicit_primary_key" | ||
--- | ||
// @generated automatically by Diesel CLI. | ||
|
||
diesel::table! { | ||
no_explicit (rowid) { | ||
rowid -> Integer, | ||
name -> Text, | ||
} | ||
} | ||
|
||
diesel::table! { | ||
with_explicit_rowid (oid) { | ||
oid -> Integer, | ||
name -> Text, | ||
rowid -> Text, | ||
} | ||
} | ||
|
||
diesel::table! { | ||
with_explicit_rowid_oid (_rowid_) { | ||
_rowid_ -> Integer, | ||
name -> Text, | ||
rowid -> Text, | ||
oid -> Text, | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...cli/tests/print_schema/print_schema_sqlite_without_explicit_primary_key/sqlite/schema.sql
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,14 @@ | ||
CREATE TABLE no_explicit ( | ||
name TEXT | ||
); | ||
|
||
CREATE TABLE with_explicit_rowid ( | ||
name TEXT, | ||
rowid TEXT | ||
); | ||
|
||
CREATE TABLE with_explicit_rowid_oid ( | ||
name TEXT, | ||
rowid TEXT, | ||
oid TEXT | ||
); |