@wirecat/cli-core 0.384.0 → 0.385.0
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/CHANGELOG.md +10 -0
- package/dist/store/migrations.d.ts +2 -1
- package/dist/store/migrations.js +12 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,16 @@ shape of this file.
|
|
|
7
7
|
|
|
8
8
|
## Unreleased
|
|
9
9
|
|
|
10
|
+
## 0.385.0 — 22.10.2026
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- **A store the pre-rename `cli-messaging` wrote is refused again, and left untouched.** Its `schema_migrations`
|
|
15
|
+
uses its own, higher numbers ("29, needs at least 28"); since store version 28 the version check took it for a
|
|
16
|
+
compatible file, opened it and failed on a missing column with `internal_error`, and a later version would have
|
|
17
|
+
migrated it. A file that has a version but no `meetings` table, which version 1 here always creates, now fails with
|
|
18
|
+
`configuration_error` (exit 3) before anything runs. `migrate` takes `ownTable: null` for synthetic test schemas.
|
|
19
|
+
|
|
10
20
|
## 0.384.0 — 22.10.2026
|
|
11
21
|
|
|
12
22
|
### Added
|
|
@@ -24,8 +24,9 @@ export declare const MIGRATIONS: Migration[];
|
|
|
24
24
|
* that fails names `store reset` when the app has one: without it the owner is stuck until a build that can migrate
|
|
25
25
|
* the file. An app without that command (drive) passes no `command`, and the advice names none.
|
|
26
26
|
*/
|
|
27
|
-
export declare const migrate: (database: CacheDatabase, { migrations, now, command, }?: {
|
|
27
|
+
export declare const migrate: (database: CacheDatabase, { migrations, now, command, ownTable, }?: {
|
|
28
28
|
migrations?: Migration[];
|
|
29
29
|
now?: () => number;
|
|
30
30
|
command?: string;
|
|
31
|
+
ownTable?: string | null;
|
|
31
32
|
}) => void;
|
package/dist/store/migrations.js
CHANGED
|
@@ -17,6 +17,13 @@ const HISTORY = `CREATE TABLE IF NOT EXISTS schema_migrations (
|
|
|
17
17
|
applied_at INTEGER NOT NULL
|
|
18
18
|
)`;
|
|
19
19
|
const latest = (migrations) => migrations.at(-1)?.version ?? 0;
|
|
20
|
+
/**
|
|
21
|
+
* The pre-rename `cli-messaging` store also has `schema_migrations`, with its own, higher numbers ("29, needs at
|
|
22
|
+
* least 28"). Once ours caught up, the version check alone took it for a compatible file, opened it and would have
|
|
23
|
+
* migrated it. Version 1 here always creates `meetings`; that store never had one.
|
|
24
|
+
*/
|
|
25
|
+
const OWN_TABLE = "meetings";
|
|
26
|
+
const hasTable = (database, name) => database.prepare("SELECT 1 AS found FROM sqlite_master WHERE type = 'table' AND name = ?").get(name) !== undefined;
|
|
20
27
|
const fileState = (database) => {
|
|
21
28
|
const row = database
|
|
22
29
|
.prepare("SELECT version, min_compatible FROM schema_migrations ORDER BY version DESC LIMIT 1")
|
|
@@ -29,12 +36,16 @@ const fileState = (database) => {
|
|
|
29
36
|
* that fails names `store reset` when the app has one: without it the owner is stuck until a build that can migrate
|
|
30
37
|
* the file. An app without that command (drive) passes no `command`, and the advice names none.
|
|
31
38
|
*/
|
|
32
|
-
export const migrate = (database, { migrations = MIGRATIONS, now = Date.now, command, } = {}) => {
|
|
39
|
+
export const migrate = (database, { migrations = MIGRATIONS, now = Date.now, command, ownTable = OWN_TABLE, } = {}) => {
|
|
33
40
|
const ours = latest(migrations);
|
|
34
41
|
database.exec("BEGIN IMMEDIATE");
|
|
35
42
|
try {
|
|
36
43
|
database.exec(HISTORY);
|
|
37
44
|
const file = fileState(database);
|
|
45
|
+
if (file.version > 0 && ownTable !== null && !hasTable(database, ownTable)) {
|
|
46
|
+
throw new CliError("configuration_error", `the message store was written by another, incompatible tool (schema ${file.version} by its own numbering, ` +
|
|
47
|
+
"with no meetings table) — this tool will not open or change it; move it aside to start a new store");
|
|
48
|
+
}
|
|
38
49
|
if (file.version > ours && file.minCompatible > ours) {
|
|
39
50
|
throw new CliError("configuration_error", `the message store was written by a newer version (schema ${file.version}, needs at least ` +
|
|
40
51
|
`${file.minCompatible}; this one speaks ${ours}) — upgrade this tool`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wirecat/cli-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.385.0",
|
|
4
4
|
"description": "The messenger-neutral half of a messaging CLI: domain model, message locators, rendering, name resolution, the SQLite seam, the command skeleton and shared read commands, the send guard, run records and the message store",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Viacheslav Ptsarev",
|