@zukhruf/sqlite-drift 0.3.34 → 0.3.36
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/README.md +12 -8
- package/dist/declaration.d.ts.map +1 -1
- package/dist/declaration.js +67 -15
- package/dist/declaration.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -73,6 +73,8 @@ With `rows: 'keep'`, `apply` keeps the rows of each stale table. It replaces a s
|
|
|
73
73
|
3. It copies the columns that both tables have, by name. SQLite takes names that are different only in ASCII case as one name.
|
|
74
74
|
4. It drops the old table, and makes again the indexes and triggers on the table that the declaration does not name.
|
|
75
75
|
5. It runs `PRAGMA foreign_key_check`. When a kept row breaks a foreign key, `apply` fails.
|
|
76
|
+
6. After it makes the missing objects, it compiles a `DELETE`, an `INSERT` and an `UPDATE` of each rebuilt table, and runs no row. SQLite does not examine the body of a trigger at `CREATE`. It examines the body when it compiles a statement that fires the trigger. When a trigger on the table names a dropped column, `apply` fails with the error of SQLite.
|
|
77
|
+
7. It compiles each view. Before the rebuilds, it records which views compile. When a view compiled before and does not compile now, `apply` fails. A view that did not compile before does not make `apply` fail.
|
|
76
78
|
|
|
77
79
|
[ADR 0003](./docs/adr/0003-keep-rows-rebuilds-a-table-and-keeps-its-references.md) tells why.
|
|
78
80
|
|
|
@@ -130,14 +132,16 @@ fits
|
|
|
130
132
|
|
|
131
133
|
## Errors
|
|
132
134
|
|
|
133
|
-
| Error | When
|
|
134
|
-
| ----------------------------------------------------------------------------------- |
|
|
135
|
-
| The error of SQLite | `new Declaration` fails when a statement does not run in an empty database.
|
|
136
|
-
| `database is locked` | `apply` with no transaction waits for the busy timeout of the connection, then fails.
|
|
137
|
-
| The error of a statement | `apply` fails, and the database stays as it was.
|
|
138
|
-
| `Keeping the rows of a table that other tables reference needs foreign keys off, …` | `rows: 'keep'`, in a transaction of the caller, with foreign keys on, and another table refers to a stale table. Nothing changes.
|
|
139
|
-
| The error of SQLite, for example `NOT NULL constraint failed: runs.name` | `rows: 'keep'`, and a stored row does not fit the declared table. The table and its rows stay as they were.
|
|
140
|
-
| `The kept rows break a foreign key: …` | `rows: 'keep'`, and `PRAGMA foreign_key_check` finds a kept row that refers to no row. The database stays as it was.
|
|
135
|
+
| Error | When |
|
|
136
|
+
| ----------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
137
|
+
| The error of SQLite | `new Declaration` fails when a statement does not run in an empty database. |
|
|
138
|
+
| `database is locked` | `apply` with no transaction waits for the busy timeout of the connection, then fails. |
|
|
139
|
+
| The error of a statement | `apply` fails, and the database stays as it was. |
|
|
140
|
+
| `Keeping the rows of a table that other tables reference needs foreign keys off, …` | `rows: 'keep'`, in a transaction of the caller, with foreign keys on, and another table refers to a stale table. Nothing changes. |
|
|
141
|
+
| The error of SQLite, for example `NOT NULL constraint failed: runs.name` | `rows: 'keep'`, and a stored row does not fit the declared table. The table and its rows stay as they were. |
|
|
142
|
+
| `The kept rows break a foreign key: …` | `rows: 'keep'`, and `PRAGMA foreign_key_check` finds a kept row that refers to no row. The database stays as it was. |
|
|
143
|
+
| The error of SQLite, for example `no such column: old.note` | `rows: 'keep'`, and a trigger on a rebuilt table names a column that the declaration does not have. The database stays as it was. |
|
|
144
|
+
| `The rebuild breaks the view …` | `rows: 'keep'`, and a view compiled before the rebuild and does not compile after it. The `cause` has the error of SQLite. The database stays as it was. |
|
|
141
145
|
|
|
142
146
|
## The same concepts in other systems
|
|
143
147
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declaration.d.ts","sourceRoot":"","sources":["../src/declaration.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAM3C,MAAM,MAAM,KAAK,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAIjD,MAAM,MAAM,IAAI,GAAG,SAAS,GAAG,MAAM,CAAC;AAgBtC,qBAAa,WAAW;;gBAIV,UAAU,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;KAAE;IAgB3E,KAAK,CAAC,QAAQ,EAAE,YAAY,GAAG,KAAK;IAkBpC,KAAK,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"declaration.d.ts","sourceRoot":"","sources":["../src/declaration.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAM3C,MAAM,MAAM,KAAK,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAIjD,MAAM,MAAM,IAAI,GAAG,SAAS,GAAG,MAAM,CAAC;AAgBtC,qBAAa,WAAW;;gBAIV,UAAU,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;KAAE;IAgB3E,KAAK,CAAC,QAAQ,EAAE,YAAY,GAAG,KAAK;IAkBpC,KAAK,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI;CAmIpC"}
|
package/dist/declaration.js
CHANGED
|
@@ -61,17 +61,21 @@ export class Declaration {
|
|
|
61
61
|
try {
|
|
62
62
|
transaction(database, () => {
|
|
63
63
|
const stale = this.#stale(database);
|
|
64
|
-
if (this.#rows === 'keep')
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
64
|
+
if (this.#rows === 'keep') {
|
|
65
|
+
const views = compiled(database);
|
|
66
|
+
const rebuilt = this.#keep(database, stale);
|
|
67
|
+
this.#create(database);
|
|
68
|
+
verify(database, rebuilt, views);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
if (stale.length > 0)
|
|
72
|
+
for (const object of this.#objects.toReversed()) {
|
|
73
|
+
const found = stored(database, object.name);
|
|
74
|
+
if (found !== undefined)
|
|
75
|
+
drop(database, found);
|
|
76
|
+
}
|
|
77
|
+
this.#create(database);
|
|
78
|
+
}
|
|
75
79
|
}, { mode: 'immediate' });
|
|
76
80
|
}
|
|
77
81
|
finally {
|
|
@@ -79,6 +83,11 @@ export class Declaration {
|
|
|
79
83
|
database.exec('PRAGMA foreign_keys = ON');
|
|
80
84
|
}
|
|
81
85
|
}
|
|
86
|
+
#create(database) {
|
|
87
|
+
for (const object of this.#objects)
|
|
88
|
+
if (stored(database, object.name) === undefined)
|
|
89
|
+
database.exec(object.sql);
|
|
90
|
+
}
|
|
82
91
|
#stale(database) {
|
|
83
92
|
return this.#objects.flatMap((object) => {
|
|
84
93
|
const found = stored(database, object.name);
|
|
@@ -87,16 +96,17 @@ export class Declaration {
|
|
|
87
96
|
: [];
|
|
88
97
|
});
|
|
89
98
|
}
|
|
90
|
-
// Drops each stale index, trigger and view,
|
|
91
|
-
//
|
|
92
|
-
// comes back in any
|
|
99
|
+
// Drops each stale index, trigger and view, rebuilds each stale table, and
|
|
100
|
+
// gives the names of the rebuilt tables. SQLite keeps PRAGMA
|
|
101
|
+
// legacy_alter_table after a rollback, so the old value comes back in any
|
|
102
|
+
// case.
|
|
93
103
|
#keep(database, stale) {
|
|
94
104
|
const tables = stale.filter(({ object, found }) => object.type === 'table' && found.type === 'table');
|
|
95
105
|
for (const entry of stale)
|
|
96
106
|
if (!tables.includes(entry))
|
|
97
107
|
drop(database, entry.found);
|
|
98
108
|
if (tables.length === 0)
|
|
99
|
-
return;
|
|
109
|
+
return [];
|
|
100
110
|
const legacy = Number(database.prepare('PRAGMA legacy_alter_table').get()?.legacy_alter_table);
|
|
101
111
|
database.exec('PRAGMA legacy_alter_table = ON');
|
|
102
112
|
try {
|
|
@@ -109,6 +119,7 @@ export class Declaration {
|
|
|
109
119
|
const broken = database.prepare('PRAGMA foreign_key_check').get();
|
|
110
120
|
if (broken !== undefined)
|
|
111
121
|
throw new Error(`The kept rows break a foreign key: row ${String(broken.rowid)} of ${String(broken.table)} refers to a row of ${String(broken.parent)} that does not exist.`);
|
|
122
|
+
return tables.map(({ object }) => object.name);
|
|
112
123
|
}
|
|
113
124
|
// Renames the stored table away, makes it from its declared text, and copies
|
|
114
125
|
// the columns that both have, by name. With legacy_alter_table on, the
|
|
@@ -160,6 +171,47 @@ function names(database, table) {
|
|
|
160
171
|
.all(table)
|
|
161
172
|
.map(({ name }) => String(name));
|
|
162
173
|
}
|
|
174
|
+
// The names of the views that SQLite can compile now.
|
|
175
|
+
function compiled(database) {
|
|
176
|
+
return new Set(database
|
|
177
|
+
.prepare(`SELECT "name" FROM sqlite_schema WHERE "type" = 'view'`)
|
|
178
|
+
.all()
|
|
179
|
+
.map(({ name }) => String(name))
|
|
180
|
+
.filter((name) => {
|
|
181
|
+
try {
|
|
182
|
+
database.prepare(`SELECT * FROM ${quote(name)} WHERE 0`);
|
|
183
|
+
return true;
|
|
184
|
+
}
|
|
185
|
+
catch {
|
|
186
|
+
// The view was broken before apply.
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
}));
|
|
190
|
+
}
|
|
191
|
+
// SQLite checks the columns of a trigger or a view only when it compiles a
|
|
192
|
+
// statement that uses it, not at CREATE. Each statement here compiles every
|
|
193
|
+
// trigger on a rebuilt table for its event, and runs no row: an UPDATE trigger
|
|
194
|
+
// OF a column compiles only when SET names that column. A view that compiled
|
|
195
|
+
// before the rebuilds and does not compile now fails apply; a view that was
|
|
196
|
+
// already broken does not.
|
|
197
|
+
function verify(database, tables, views) {
|
|
198
|
+
for (const table of tables) {
|
|
199
|
+
const columns = names(database, table).map(quote);
|
|
200
|
+
const name = quote(table);
|
|
201
|
+
database.prepare(`DELETE FROM ${name} WHERE 0`);
|
|
202
|
+
database.prepare(`INSERT INTO ${name} (${columns.join(', ')}) SELECT ${columns.join(', ')} FROM ${name} WHERE 0`);
|
|
203
|
+
database.prepare(`UPDATE ${name} SET ${columns.map((column) => `${column} = ${column}`).join(', ')} WHERE 0`);
|
|
204
|
+
}
|
|
205
|
+
for (const view of views)
|
|
206
|
+
try {
|
|
207
|
+
database.prepare(`SELECT * FROM ${quote(view)} WHERE 0`);
|
|
208
|
+
}
|
|
209
|
+
catch (error) {
|
|
210
|
+
throw new Error(`The rebuild breaks the view ${view}.`, {
|
|
211
|
+
cause: error,
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
}
|
|
163
215
|
// Whether a table, the same one too, has a foreign key to the table.
|
|
164
216
|
function referenced(database, table) {
|
|
165
217
|
return (database
|
package/dist/declaration.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declaration.js","sourceRoot":"","sources":["../src/declaration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAmB1D,8EAA8E;AAC9E,yEAAyE;AACzE,4EAA4E;AAC5E,8EAA8E;AAC9E,wCAAwC;AACxC,MAAM,OAAO,WAAW;IACb,QAAQ,CAA0B;IAClC,KAAK,CAAO;IAErB,YAAY,UAA6B,EAAE,OAAgC;QACzE,MAAM,KAAK,GAAG,IAAI,YAAY,CAAC,UAAU,CAAC,CAAC;QAC3C,KAAK,MAAM,SAAS,IAAI,UAAU;YAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC1D,IAAI,CAAC,QAAQ,GAAG,KAAK;aAClB,OAAO,CACN,wFAAwF,CACzF;aACA,GAAG,EAAE;aACL,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;YAC7B,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC;YAClB,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC;YAClB,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC;SACjB,CAAC,CAA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BAA+B,IAAI,GAAG,EAAE;gBACtD,KAAK,EAAE,KAAK;aACb,CAAC,CAAC;QACL,CAAC;AACL,CAAC;AAED,qEAAqE;AACrE,SAAS,UAAU,CAAC,QAAsB,EAAE,KAAa;IACvD,OAAO,CACL,QAAQ;SACL,OAAO,CACN,6IAA6I,CAC9I;SACA,GAAG,CAAC,KAAK,CAAC,KAAK,SAAS,CAC5B,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zukhruf/sqlite-drift",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.36",
|
|
4
4
|
"description": "Declarative schema management for SQLite. A declaration lists the CREATE statements of the tables, indexes, views and triggers that one caller owns. The package compares them with the text that SQLite stores, gives the drift (missing, fits or stale), and makes the database store each object as declared. No person keeps a version number.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -42,6 +42,6 @@
|
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@zukhruf/sqlite-transaction": "^0.3.
|
|
45
|
+
"@zukhruf/sqlite-transaction": "^0.3.36"
|
|
46
46
|
}
|
|
47
47
|
}
|