symmetria-kit 1.0.2 → 1.1.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/README.md +13 -9
- package/dist/cli/query-inspect.js +1 -1
- package/dist/cli.js +5 -5
- package/dist/cli.js.map +1 -1
- package/dist/{ddl-BpRIXfCw.js → ddl-BMHqteKM.js} +5 -4
- package/dist/ddl-BMHqteKM.js.map +1 -0
- package/dist/{diff-ConfLt63.js → diff-Cm5kAu_c.js} +4 -3
- package/dist/diff-Cm5kAu_c.js.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -3
- package/dist/{schema-browser-data-BVymL_xf.js → schema-browser-data-BhgnxWmI.js} +3 -3
- package/dist/{schema-browser-data-BVymL_xf.js.map → schema-browser-data-BhgnxWmI.js.map} +1 -1
- package/dist/{src-C2mBlLSB.js → src-WVQ1Pauy.js} +178 -70
- package/dist/src-WVQ1Pauy.js.map +1 -0
- package/dist/testing.js +1 -1
- package/package.json +2 -2
- package/dist/ddl-BpRIXfCw.js.map +0 -1
- package/dist/diff-ConfLt63.js.map +0 -1
- package/dist/src-C2mBlLSB.js.map +0 -1
package/README.md
CHANGED
|
@@ -109,11 +109,13 @@ erDiagram
|
|
|
109
109
|
## Adopting an existing database
|
|
110
110
|
|
|
111
111
|
`symmetria pull` reads the connection's `current_schema()` and writes a schema
|
|
112
|
-
module in the Symmetria DSL: tables
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
indexes
|
|
112
|
+
module in the Symmetria DSL: tables and columns under any names (with
|
|
113
|
+
`casing: "preserve"` and `.named()` where needed), defaults, identities, enums,
|
|
114
|
+
foreign keys as relations (including `ON UPDATE CASCADE`, keys to unique columns
|
|
115
|
+
and columns not named `*_id`, through `.by()` and `.column()`), junction tables,
|
|
116
|
+
primary keys, unique columns, indexes (including expression, partial, `INCLUDE`
|
|
117
|
+
and non-btree indexes) and CHECK constraints. A database created by Prisma pulls
|
|
118
|
+
as is; `drift` then lists only what the warnings announced.
|
|
117
119
|
|
|
118
120
|
```sh
|
|
119
121
|
symmetria pull src/database/schema.ts --database-url "$DATABASE_URL"
|
|
@@ -124,10 +126,12 @@ review: constraints with non-conventional names (with the `RENAME CONSTRAINT`
|
|
|
124
126
|
that fixes them), serial columns, `GENERATED BY DEFAULT` identities, types
|
|
125
127
|
without a builder such as `money` (declared through `customType()`), enums
|
|
126
128
|
shared by several columns, multi-column unique constraints (declared as unique
|
|
127
|
-
indexes),
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
`--
|
|
129
|
+
indexes), unique indexes that stand in for constraints (with the
|
|
130
|
+
`ADD CONSTRAINT … USING INDEX` that converts them), composite or deferrable
|
|
131
|
+
foreign keys, indexes with operator classes, and the views, materialized views
|
|
132
|
+
and triggers the schema does not manage. The same list is in `--json` output
|
|
133
|
+
under `warnings`, each with a `code` and, when one exists, a `fix`. The file is
|
|
134
|
+
never overwritten without `--force`.
|
|
131
135
|
|
|
132
136
|
Then point `symmetria.config.ts` at the module, run `drift` until the remaining
|
|
133
137
|
findings are intended, generate the first migration with `generate initial` and
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as supportsColor, b as wrapLines, d as withScreen, p as fitLine, t as highlightSQL, y as theme } from "../schema-browser-data-
|
|
1
|
+
import { _ as supportsColor, b as wrapLines, d as withScreen, p as fitLine, t as highlightSQL, y as theme } from "../schema-browser-data-BhgnxWmI.js";
|
|
2
2
|
import stringWidth from "string-width";
|
|
3
3
|
import { emitKeypressEvents } from "node:readline";
|
|
4
4
|
import { inspect, stripVTControlCharacters } from "node:util";
|
package/dist/cli.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { f as canonicalJSON, g as migrationSnapshot } from "./ddl-
|
|
3
|
-
import { n as diffSchemas } from "./diff-
|
|
4
|
-
import { _ as formatLintFindings, a as verifyMigrations, c as detectDrift, d as lintMigrationSQL, f as generateMigration, g as recoverMigrationFiles, h as squashMigrations, l as formatDriftFindings, n as schemaGraph, o as migrator, p as loadMigrationState, r as pullSchema, t as renderMermaid, v as lintMigration } from "./src-
|
|
5
|
-
import { _ as supportsColor, a as matchesEntry, b as wrapLines, c as ask, d as withScreen, f as withSpinner, g as panel, h as heading, i as inspectTabs, l as choose, m as formatError, n as inspectEntries, o as matchesTableName, p as fitLine, r as inspectTableSQL, s as matchingTables, t as highlightSQL, u as view, v as terminalWidth, y as theme } from "./schema-browser-data-
|
|
2
|
+
import { f as canonicalJSON, g as migrationSnapshot } from "./ddl-BMHqteKM.js";
|
|
3
|
+
import { n as diffSchemas } from "./diff-Cm5kAu_c.js";
|
|
4
|
+
import { _ as formatLintFindings, a as verifyMigrations, c as detectDrift, d as lintMigrationSQL, f as generateMigration, g as recoverMigrationFiles, h as squashMigrations, l as formatDriftFindings, n as schemaGraph, o as migrator, p as loadMigrationState, r as pullSchema, t as renderMermaid, v as lintMigration } from "./src-WVQ1Pauy.js";
|
|
5
|
+
import { _ as supportsColor, a as matchesEntry, b as wrapLines, c as ask, d as withScreen, f as withSpinner, g as panel, h as heading, i as inspectTabs, l as choose, m as formatError, n as inspectEntries, o as matchesTableName, p as fitLine, r as inspectTableSQL, s as matchingTables, t as highlightSQL, u as view, v as terminalWidth, y as theme } from "./schema-browser-data-BhgnxWmI.js";
|
|
6
6
|
import * as nodeModule from "node:module";
|
|
7
7
|
import { access, lstat, mkdir, open, readFile, readdir, rm, writeFile } from "node:fs/promises";
|
|
8
8
|
import { basename, dirname, extname, relative, resolve } from "node:path";
|
|
@@ -159,7 +159,7 @@ const columnLabel = (column) => [
|
|
|
159
159
|
column.identity ? "identity" : "",
|
|
160
160
|
column.unique ? "unique" : "",
|
|
161
161
|
column.default === void 0 ? "" : `default ${column.default}`,
|
|
162
|
-
column.references ? `→ ${column.references.table}.${column.references.column} ON DELETE ${column.references.onDelete}` : ""
|
|
162
|
+
column.references ? `→ ${column.references.table}.${column.references.column} ON DELETE ${column.references.onDelete}${column.references.onUpdate ? ` ON UPDATE ${column.references.onUpdate}` : ""}` : ""
|
|
163
163
|
].filter(Boolean).join(" · ");
|
|
164
164
|
const formatDiff = (plan, color = false, renames = {}) => {
|
|
165
165
|
const { style } = theme(color);
|