tempest-db-js 0.7.0 → 0.9.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 +9 -0
- package/dist/bin.cjs +1921 -12
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +31 -2
- package/dist/bin.js.map +1 -1
- package/dist/chunk-HXK6WIBP.js +5897 -0
- package/dist/chunk-HXK6WIBP.js.map +1 -0
- package/dist/{chunk-SI4CLSF7.js → chunk-ZBIHRVUS.js} +255 -11
- package/dist/chunk-ZBIHRVUS.js.map +1 -0
- package/dist/index.cjs +3156 -280
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3058 -549
- package/dist/index.d.ts +3058 -549
- package/dist/index.js +1 -1
- package/dist/migrations/index.cjs +1654 -11
- package/dist/migrations/index.cjs.map +1 -1
- package/dist/migrations/index.d.cts +30 -1
- package/dist/migrations/index.d.ts +30 -1
- package/dist/migrations/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-4AWUP7BM.js +0 -3076
- package/dist/chunk-4AWUP7BM.js.map +0 -1
- package/dist/chunk-SI4CLSF7.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ColumnType, DefaultValue, ForeignKeyRef, FkAction, ModelClass, Dialect, AsyncDriver, SyncDriver } from '../index.cjs';
|
|
1
|
+
import { ColumnType, DefaultValue, ForeignKeyRef, FkAction, CondNode, ModelClass, Dialect, AsyncDriver, SyncDriver } from '../index.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* tempest-db-js — Phase 6: the Schema IR (intermediate representation).
|
|
@@ -28,6 +28,20 @@ interface UniqueConstraintIR {
|
|
|
28
28
|
readonly name: string;
|
|
29
29
|
readonly columns: readonly string[];
|
|
30
30
|
}
|
|
31
|
+
/** A `CHECK` constraint in the IR. */
|
|
32
|
+
interface CheckIR {
|
|
33
|
+
readonly name: string;
|
|
34
|
+
/** The invariant, in the condition language — comparable without parsing SQL. */
|
|
35
|
+
readonly expression: CondNode;
|
|
36
|
+
}
|
|
37
|
+
/** An index in the IR. */
|
|
38
|
+
interface IndexIR {
|
|
39
|
+
readonly name: string;
|
|
40
|
+
readonly columns: readonly string[];
|
|
41
|
+
readonly unique: boolean;
|
|
42
|
+
/** The predicate of a partial index, or `null` for a full one. */
|
|
43
|
+
readonly where: CondNode | null;
|
|
44
|
+
}
|
|
31
45
|
/** A (composite) foreign-key table constraint in the IR. */
|
|
32
46
|
interface ForeignKeyIR {
|
|
33
47
|
readonly name: string;
|
|
@@ -47,6 +61,9 @@ type NamedConstraint = {
|
|
|
47
61
|
} | {
|
|
48
62
|
readonly type: "foreignKey";
|
|
49
63
|
readonly constraint: ForeignKeyIR;
|
|
64
|
+
} | {
|
|
65
|
+
readonly type: "check";
|
|
66
|
+
readonly constraint: CheckIR;
|
|
50
67
|
};
|
|
51
68
|
/** One table. */
|
|
52
69
|
interface TableIR {
|
|
@@ -58,6 +75,10 @@ interface TableIR {
|
|
|
58
75
|
readonly uniqueConstraints: readonly UniqueConstraintIR[];
|
|
59
76
|
/** Table-level foreign-key constraints (from `tableArgs`). */
|
|
60
77
|
readonly foreignKeys: readonly ForeignKeyIR[];
|
|
78
|
+
/** `CHECK` constraints (from `tableArgs`). */
|
|
79
|
+
readonly checks: readonly CheckIR[];
|
|
80
|
+
/** Indexes (from `tableArgs`). Not constraints: they live in their own DDL. */
|
|
81
|
+
readonly indexes: readonly IndexIR[];
|
|
61
82
|
}
|
|
62
83
|
/** A whole schema, keyed by table name. */
|
|
63
84
|
interface SchemaIR {
|
|
@@ -136,6 +157,14 @@ type Operation = {
|
|
|
136
157
|
readonly kind: "drop_constraint";
|
|
137
158
|
readonly table: string;
|
|
138
159
|
readonly constraint: NamedConstraint;
|
|
160
|
+
} | {
|
|
161
|
+
readonly kind: "create_index";
|
|
162
|
+
readonly table: string;
|
|
163
|
+
readonly index: IndexIR;
|
|
164
|
+
} | {
|
|
165
|
+
readonly kind: "drop_index";
|
|
166
|
+
readonly table: string;
|
|
167
|
+
readonly index: IndexIR;
|
|
139
168
|
} | {
|
|
140
169
|
readonly kind: "execute";
|
|
141
170
|
readonly up: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ColumnType, DefaultValue, ForeignKeyRef, FkAction, ModelClass, Dialect, AsyncDriver, SyncDriver } from '../index.js';
|
|
1
|
+
import { ColumnType, DefaultValue, ForeignKeyRef, FkAction, CondNode, ModelClass, Dialect, AsyncDriver, SyncDriver } from '../index.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* tempest-db-js — Phase 6: the Schema IR (intermediate representation).
|
|
@@ -28,6 +28,20 @@ interface UniqueConstraintIR {
|
|
|
28
28
|
readonly name: string;
|
|
29
29
|
readonly columns: readonly string[];
|
|
30
30
|
}
|
|
31
|
+
/** A `CHECK` constraint in the IR. */
|
|
32
|
+
interface CheckIR {
|
|
33
|
+
readonly name: string;
|
|
34
|
+
/** The invariant, in the condition language — comparable without parsing SQL. */
|
|
35
|
+
readonly expression: CondNode;
|
|
36
|
+
}
|
|
37
|
+
/** An index in the IR. */
|
|
38
|
+
interface IndexIR {
|
|
39
|
+
readonly name: string;
|
|
40
|
+
readonly columns: readonly string[];
|
|
41
|
+
readonly unique: boolean;
|
|
42
|
+
/** The predicate of a partial index, or `null` for a full one. */
|
|
43
|
+
readonly where: CondNode | null;
|
|
44
|
+
}
|
|
31
45
|
/** A (composite) foreign-key table constraint in the IR. */
|
|
32
46
|
interface ForeignKeyIR {
|
|
33
47
|
readonly name: string;
|
|
@@ -47,6 +61,9 @@ type NamedConstraint = {
|
|
|
47
61
|
} | {
|
|
48
62
|
readonly type: "foreignKey";
|
|
49
63
|
readonly constraint: ForeignKeyIR;
|
|
64
|
+
} | {
|
|
65
|
+
readonly type: "check";
|
|
66
|
+
readonly constraint: CheckIR;
|
|
50
67
|
};
|
|
51
68
|
/** One table. */
|
|
52
69
|
interface TableIR {
|
|
@@ -58,6 +75,10 @@ interface TableIR {
|
|
|
58
75
|
readonly uniqueConstraints: readonly UniqueConstraintIR[];
|
|
59
76
|
/** Table-level foreign-key constraints (from `tableArgs`). */
|
|
60
77
|
readonly foreignKeys: readonly ForeignKeyIR[];
|
|
78
|
+
/** `CHECK` constraints (from `tableArgs`). */
|
|
79
|
+
readonly checks: readonly CheckIR[];
|
|
80
|
+
/** Indexes (from `tableArgs`). Not constraints: they live in their own DDL. */
|
|
81
|
+
readonly indexes: readonly IndexIR[];
|
|
61
82
|
}
|
|
62
83
|
/** A whole schema, keyed by table name. */
|
|
63
84
|
interface SchemaIR {
|
|
@@ -136,6 +157,14 @@ type Operation = {
|
|
|
136
157
|
readonly kind: "drop_constraint";
|
|
137
158
|
readonly table: string;
|
|
138
159
|
readonly constraint: NamedConstraint;
|
|
160
|
+
} | {
|
|
161
|
+
readonly kind: "create_index";
|
|
162
|
+
readonly table: string;
|
|
163
|
+
readonly index: IndexIR;
|
|
164
|
+
} | {
|
|
165
|
+
readonly kind: "drop_index";
|
|
166
|
+
readonly table: string;
|
|
167
|
+
readonly index: IndexIR;
|
|
139
168
|
} | {
|
|
140
169
|
readonly kind: "execute";
|
|
141
170
|
readonly up: string;
|
package/dist/migrations/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AsyncMigrationRunner, CyclicMigrationGraph, IrreversibleMigration, MigrationRunner, Op, UnknownRevision, applyOperation, applyRenames, checkDrift, checkDriftAsync, checkDriftPostgres, compareSqliteSchemas, defineMigrationConfig, detectRenames, diffSchema, emptySchema, generateMigration, heads, introspectPostgres, introspectSqlite, introspectSqliteAsync, invert, invertAll, makeRevisionId, reflectSchema, reflectTable, renderColumnDef, renderColumnType, renderDefault, renderOperation, replaySchema, runMigrationCli, sqliteAffinity, topoOrder } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { AsyncMigrationRunner, CyclicMigrationGraph, IrreversibleMigration, MigrationRunner, Op, UnknownRevision, applyOperation, applyRenames, checkDrift, checkDriftAsync, checkDriftPostgres, compareSqliteSchemas, defineMigrationConfig, detectRenames, diffSchema, emptySchema, generateMigration, heads, introspectPostgres, introspectSqlite, introspectSqliteAsync, invert, invertAll, makeRevisionId, reflectSchema, reflectTable, renderColumnDef, renderColumnType, renderDefault, renderOperation, replaySchema, runMigrationCli, sqliteAffinity, topoOrder } from '../chunk-ZBIHRVUS.js';
|
|
2
|
+
import '../chunk-HXK6WIBP.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
4
4
|
//# sourceMappingURL=index.js.map
|