ts-grm-migrate 0.1.0-alpha.6 → 0.1.0-alpha.7

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 CHANGED
@@ -2,28 +2,51 @@
2
2
 
3
3
  English | [简体中文](docs/zh-CN/CHANGELOG.md)
4
4
 
5
- ## 0.1.0-alpha.6 (pending publication)
5
+ ## 0.1.0-alpha.7 (pending publication)
6
+
7
+ - Restore the SQLite introspection lost in 0.1.0-alpha.6: CHECK constraints, parent primary-key columns for foreign keys without explicit references, partial index predicates, explicit rejection of unsupported table/column/index structures, and NUMERIC affinity. Users of 0.1.0-alpha.6 with SQLite should upgrade.
8
+ - Failure logs state that a transaction was rolled back only when the executor confirms it, instead of matching error text. SQLite now reports an unconfirmed rollback when `ROLLBACK` itself fails.
9
+ - Document that programmatic `dev()` and `push()` apply destructive changes without asking unless a `confirm` hook is supplied.
10
+ - Enforce Biome's recommended lint rules and formatting in `check`; code comments are now written in Chinese.
11
+
12
+ ## 0.1.0-alpha.6 (2026-10-20)
6
13
 
7
14
  - Add explicit `tgm seed` with executable/argument configuration, literal argument forwarding after `--`, local binary lookup, inherited environment and terminal I/O, exit-code propagation and interruption handling.
8
15
  - Keep seeding independent of migration runtime, schema changes and history; add bilingual examples and subprocess/SQLite integration tests.
16
+ - **Known issue:** this release accidentally reverted the SQLite introspection hardening from 0.1.0-alpha.5. SQLite CHECK constraints are regenerated on every `dev`, foreign keys referencing an implicit primary key are misread, and unsupported structures are not rejected. Fixed in 0.1.0-alpha.7.
17
+
18
+ ## 0.1.0-alpha.5 (2026-10-11)
9
19
 
10
- ## 0.1.0-alpha.4 (pending publication)
20
+ - Add `push --dry-run`. `push` is blocked by pending, failed, missing or modified migration files, and returns 1 when differences remain after synchronization or the user cancels. Applied migrations must form a continuous prefix of the ordered files.
21
+ - Round-trip supported CHECK expressions through catalog formatting and compare other expressions conservatively.
22
+ - SQLite keeps NUMERIC affinity separate from REAL, reads CHECK constraints and partial index predicates, drops referencing tables before their parents, and rejects cyclic drops, generated/hidden columns, special indexes that would be rewritten, and unsupported constraint semantics.
23
+ - Use atomic renewable directory leases (`proper-lockfile`) for local locks; crashed leases expire after 10 seconds. PostgreSQL runs the lock and all migration work on one session; SQLite file databases also lock the canonical file path.
24
+ - Document running the CLI in workspaces with non-hoisted dependencies (`npx --workspaces=false tgm`).
25
+
26
+ ## 0.1.0-alpha.4 (2026-10-09)
11
27
 
12
28
  - Localize configuration, history, locking, DDL, transaction and drift explanations throughout the CLI; preserve technical identifiers and expose original external diagnostics with `--detail`.
13
29
  - Explain model naming errors in the selected language and restrict ESM troubleshooting hints to module-format failures.
14
30
 
15
- ## 0.1.0-alpha.1 (pending publication)
31
+ ## 0.1.0-alpha.3 (2026-10-09)
16
32
 
17
33
  - Add `dev --create-only` and read-only `check`, validate history before development generation, preserve unmanaged indexes, order PostgreSQL dependencies, and handle MySQL identity/default changes together.
18
34
  - Compare defaults by dialect and column type without numeric precision loss; abort on patch metadata errors; report all unproven CHECK differences.
19
- - Repair isolated companion compatibility tests and add bilingual migration review, custom SQL, transaction recovery, and scope documentation.
20
35
  - Support column-level `default` and `autoIncrement` declared through the optional [`ts-grm-patches`](https://www.npmjs.com/package/ts-grm-patches) package, including the matching DDL for PostgreSQL, MySQL, SQLite, SQL Server, and Oracle, and normalize catalog default forms (`::type` casts, parentheses, `N` prefixes, numeric quoting) so migrations are not regenerated.
36
+ - Repair isolated companion compatibility tests and add bilingual migration review, custom SQL, transaction recovery, and scope documentation.
37
+
38
+ ## 0.1.0-alpha.2
39
+
40
+ Removed from the npm registry; not available for installation.
41
+
42
+ ## 0.1.0-alpha.1 (2026-09-26)
43
+
21
44
  - Make CLI output concise and English by default, with `--detail` diagnostics, `--lang zh-CN` Chinese messages, and a configuration setting for the default language.
22
45
  - Reduce default test output while retaining failure reasons and post-migration drift warnings.
23
46
  - Remove the automatic GitHub Actions workflow; maintainers now run pre-release verification and publishing manually.
24
47
  - Make English the primary documentation language and provide corresponding Simplified Chinese documents.
25
48
 
26
- ## 0.1.0-alpha.0
49
+ ## 0.1.0-alpha.0 (2026-09-24)
27
50
 
28
51
  - Add basic PostgreSQL and SQLite migrations and MySQL, SQL Server, and Oracle dialects.
29
52
  - Add durable unfinished-migration state, transactional success recording, exclusive migration-file creation, and stable database locks.
package/CONTRIBUTING.md CHANGED
@@ -19,7 +19,7 @@ corepack yarn test:postgres-mysql
19
19
  corepack yarn test:servers
20
20
  ```
21
21
 
22
- `check` runs lint, type checking, the build, and local tests. Server tests are skipped when their database environment variables are absent, so this is not a complete database verification. The two container scripts use Podman by default; set `CONTAINER_RUNTIME=docker` to use Docker. They create temporary containers on random ports and clean up only their own resources. Allow space for the images and do not test against an application database.
22
+ `check` runs Biome lint and format checks, type checking, the build, and local tests. Server tests are skipped when their database environment variables are absent, so this is not a complete database verification. The two container scripts use Podman by default; set `CONTAINER_RUNTIME=docker` to use Docker. They create temporary containers on random ports and clean up only their own resources. Allow space for the images and do not test against an application database.
23
23
 
24
24
  `TS_GRM_TEST_VERSION=0.0.9 corepack yarn test:servers` installs that historical version in an isolated directory before running real database tests. Compatibility checks do not alter repository dependencies or the lockfile. See [compatibility](docs/compatibility.md) for the supported range and reproduction steps.
25
25
 
@@ -31,7 +31,8 @@ corepack yarn test:servers
31
31
  - Keep access to ts-grm internals in `src/vendor/ts-grm.ts`; verify candidate versions before changing the peer range.
32
32
  - Keep the published package ESM and ts-grm external to the bundle so the host model registry is shared.
33
33
  - Mark external implementation references with `@see` and retain applicable licenses and attribution for adopted code.
34
- - Biome follows upstream formatting preferences. `yarn check` runs correctness lint without wholesale formatting of historical code.
34
+ - Biome follows upstream formatting preferences with the recommended lint rules. `yarn check` runs `biome check` (lint and formatting), so run `yarn format` before committing. Run `yarn check` before every commit; the repository has no CI to catch failures afterwards.
35
+ - Code comments are written in Chinese. Keep technical terms, identifiers, code examples and `@see` links in their original form. User-facing documentation remains English-first with a Simplified Chinese translation.
35
36
 
36
37
  Original contributions use MIT. See [third-party notices](THIRD_PARTY_NOTICES.md) for adapted code.
37
38
 
package/README.md CHANGED
@@ -301,7 +301,7 @@ export const SYS_USER = model("SysUser", "id", class {
301
301
  - **History validation:** `dev` and `deploy` reject changed or missing applied files. `dev` refuses to generate while pending files exist; apply them with `deploy` first.
302
302
  - **Independent indexes and comments are not managed by models:** custom migration indexes are preserved while their columns remain. Explicit programmatic schemas may manage indexes; removing a unique index is flagged as destructive.
303
303
  - **Migration files are readable SQL:** `<migrationsDir>/<timestamp>_<name>.sql` can be edited before application. **Do not edit an applied migration.** `deploy` rejects a changed checksum; make a new migration instead.
304
- - **Destructive changes require confirmation:** dropping tables or columns, changing column types, and explicit unique-index removal prompt during model synchronization; non-interactive synchronization requires `--force`. `deploy` applies reviewed SQL files without confirmation.
304
+ - **Destructive changes require confirmation:** dropping tables or columns, changing column types, and explicit unique-index removal prompt during model synchronization; non-interactive synchronization requires `--force`. `deploy` applies reviewed SQL files without confirmation. Programmatic `Migrator` calls only ask when a `confirm` hook is supplied: without it, `dev()` and `push()` apply destructive changes immediately. Pass `confirm`, or review SQL first with `push({ dryRun: true })` or `dev({ createOnly: true })`.
305
305
  - **Post-migration checks:** `dev` and `deploy` reread the schema and warn about remaining differences. `push` returns 1 if differences remain after synchronization; cancellation also returns 1. `check` returns 1 for differences, including CHECK constraints whose equivalence cannot be proven. For example:
306
306
 
307
307
  ```text
package/dist/bin.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { b as MigrationAbortedError, n as run, q as formatError, r as messages, t as parseArgs } from "./cli-BlCk2tT8.mjs";
2
+ import { C as MigrationAbortedError, L as messages, n as run, q as formatError, t as parseArgs } from "./cli-BfbPTbqG.mjs";
3
3
  //#region src/bin.ts
4
4
  async function main() {
5
5
  const argv = process.argv.slice(2);
package/dist/bin.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bin.mjs","names":[],"sources":["../src/bin.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { parseArgs, run } from \"./cli.js\";\nimport { messages, type CliLanguage } from \"./cli/messages.js\";\nimport { MigrationAbortedError } from \"./migrator.js\";\nimport { formatError } from \"./diagnostics/error.js\";\n\nasync function main(): Promise<void> {\n const argv = process.argv.slice(2);\n let language: CliLanguage = parseArgs(argv).flags.get(\"lang\") === \"zh-CN\" ? \"zh-CN\" : \"en\";\n try {\n process.exitCode = await run(argv, process.cwd(), { onLanguage: (selected) => { language = selected; } });\n } catch (e) {\n const m = messages(language);\n if (e instanceof MigrationAbortedError) {\n console.log(m.cancelled);\n process.exitCode = 0;\n return;\n }\n console.error(`${m.error}: ${formatError(e, language, parseArgs(argv).flags.has(\"detail\"))}`);\n process.exitCode = 1;\n }\n}\n\n// Keep the executable separate from library exports; no config/import cycle.\nvoid main();\n"],"mappings":";;;AAMA,eAAe,OAAsB;CACnC,MAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;CACjC,IAAI,WAAwB,UAAU,IAAI,CAAC,CAAC,MAAM,IAAI,MAAM,MAAM,UAAU,UAAU;CACtF,IAAI;EACF,QAAQ,WAAW,MAAM,IAAI,MAAM,QAAQ,IAAI,GAAG,EAAE,aAAa,aAAa;GAAE,WAAW;EAAU,EAAE,CAAC;CAC1G,SAAS,GAAG;EACV,MAAM,IAAI,SAAS,QAAQ;EAC3B,IAAI,aAAa,uBAAuB;GACtC,QAAQ,IAAI,EAAE,SAAS;GACvB,QAAQ,WAAW;GACnB;EACF;EACA,QAAQ,MAAM,GAAG,EAAE,MAAM,IAAI,YAAY,GAAG,UAAU,UAAU,IAAI,CAAC,CAAC,MAAM,IAAI,QAAQ,CAAC,GAAG;EAC5F,QAAQ,WAAW;CACrB;AACF;AAGK,KAAK"}
1
+ {"version":3,"file":"bin.mjs","names":[],"sources":["../src/bin.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { type CliLanguage, messages } from './cli/messages.js';\nimport { parseArgs, run } from './cli.js';\nimport { formatError } from './diagnostics/error.js';\nimport { MigrationAbortedError } from './migrator.js';\n\nasync function main(): Promise<void> {\n const argv = process.argv.slice(2);\n let language: CliLanguage = parseArgs(argv).flags.get('lang') === 'zh-CN' ? 'zh-CN' : 'en';\n try {\n process.exitCode = await run(argv, process.cwd(), {\n onLanguage: (selected) => {\n language = selected;\n },\n });\n } catch (e) {\n const m = messages(language);\n if (e instanceof MigrationAbortedError) {\n console.log(m.cancelled);\n process.exitCode = 0;\n return;\n }\n console.error(`${m.error}: ${formatError(e, language, parseArgs(argv).flags.has('detail'))}`);\n process.exitCode = 1;\n }\n}\n\n// 可执行入口与库导出分离,避免 config 与 import 形成循环。\nvoid main();\n"],"mappings":";;;AAMA,eAAe,OAAsB;CACnC,MAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;CACjC,IAAI,WAAwB,UAAU,IAAI,CAAC,CAAC,MAAM,IAAI,MAAM,MAAM,UAAU,UAAU;CACtF,IAAI;EACF,QAAQ,WAAW,MAAM,IAAI,MAAM,QAAQ,IAAI,GAAG,EAChD,aAAa,aAAa;GACxB,WAAW;EACb,EACF,CAAC;CACH,SAAS,GAAG;EACV,MAAM,IAAI,SAAS,QAAQ;EAC3B,IAAI,aAAa,uBAAuB;GACtC,QAAQ,IAAI,EAAE,SAAS;GACvB,QAAQ,WAAW;GACnB;EACF;EACA,QAAQ,MAAM,GAAG,EAAE,MAAM,IAAI,YAAY,GAAG,UAAU,UAAU,IAAI,CAAC,CAAC,MAAM,IAAI,QAAQ,CAAC,GAAG;EAC5F,QAAQ,WAAW;CACrB;AACF;AAGK,KAAK"}