@fabrika/db 0.9.0-dev.66 → 0.9.0-dev.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/src/codegen-sqlite.ts +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fabrika/db",
|
|
3
|
-
"version": "0.9.0-dev.
|
|
3
|
+
"version": "0.9.0-dev.67",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"./src/testing.ts",
|
|
@@ -96,9 +96,9 @@
|
|
|
96
96
|
"test": "bun test"
|
|
97
97
|
},
|
|
98
98
|
"dependencies": {
|
|
99
|
-
"@fabrika/auth-core": "0.9.0-dev.
|
|
100
|
-
"@fabrika/platform": "0.9.0-dev.
|
|
101
|
-
"@fabrika/platform-node": "0.9.0-dev.
|
|
99
|
+
"@fabrika/auth-core": "0.9.0-dev.67",
|
|
100
|
+
"@fabrika/platform": "0.9.0-dev.67",
|
|
101
|
+
"@fabrika/platform-node": "0.9.0-dev.67",
|
|
102
102
|
"kysely": "0.29.6",
|
|
103
103
|
"kysely-postgres-js": "5.0.1",
|
|
104
104
|
"zod": "^3.25.76"
|
package/src/codegen-sqlite.ts
CHANGED
|
@@ -132,6 +132,13 @@ function introspect(db: Database): { columns: SqliteColumn[]; foreignKeys: Forei
|
|
|
132
132
|
// Otherwise an INTEGER PRIMARY KEY of a rowid table is the rowid: never null, assigned when an insert omits it.
|
|
133
133
|
const rowid = table.wr === 0 && !keyIndexed && keyColumns.length === 1 && column.pk === 1 && column.type.trim().toUpperCase() === 'INTEGER'
|
|
134
134
|
const computed = column.hidden === 2 || column.hidden === 3
|
|
135
|
+
// A key is a list's tiebreak and a row's address: two NULL keys are two rows no cursor or address tells apart.
|
|
136
|
+
if (column.pk > 0 && !rowid && column.notnull === 0) {
|
|
137
|
+
const descending = keyColumns.length === 1 && column.type.trim().toUpperCase() === 'INTEGER' ? ', or drop DESC to make it the rowid' : ''
|
|
138
|
+
throw new CodegenError(
|
|
139
|
+
`${table.name}.${column.name} is in the primary key but holds NULL on SQLite (a rowid table's key other than its rowid); declare it NOT NULL or make the table STRICT${descending}`,
|
|
140
|
+
)
|
|
141
|
+
}
|
|
135
142
|
columns.push({
|
|
136
143
|
table_name: table.name,
|
|
137
144
|
column_name: column.name,
|