@danceroutine/tango-migrations 1.11.0 → 1.11.2
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/dist/Builder-y8vj7XXN.d.ts +25 -0
- package/dist/{CollectingBuilder--4fqDQdE.js → CollectingBuilder-BIfAKs_x.js} +6 -4
- package/dist/CollectingBuilder-BIfAKs_x.js.map +1 -0
- package/dist/CompilerFactory-Czv-zEOS.d.ts +30 -0
- package/dist/CompilerStrategy-DqmcqAC-.d.ts +44 -0
- package/dist/{CompilerStrategy-_AiXiyjS.js → CompilerStrategy-vcZKg8qf.js} +14 -10
- package/dist/CompilerStrategy-vcZKg8qf.js.map +1 -0
- package/dist/Dialect-Cp4r7UfW.d.ts +12 -0
- package/dist/{InternalColumnType-G9zV9StN.js → InternalColumnType-Dzs9T6a6.js} +3 -4
- package/dist/{InternalColumnType-G9zV9StN.js.map → InternalColumnType-Dzs9T6a6.js.map} +1 -1
- package/dist/{InternalOperationKind-Bt6Weuon.js → InternalOperationKind-M4a4H9OZ.js} +3 -4
- package/dist/{InternalOperationKind-Bt6Weuon.js.map → InternalOperationKind-M4a4H9OZ.js.map} +1 -1
- package/dist/{IntrospectorStrategy-BEIG5GqA.js → IntrospectorStrategy-BijuyIaN.js} +14 -9
- package/dist/IntrospectorStrategy-BijuyIaN.js.map +1 -0
- package/dist/{Migration-DYQ0hUG7.js → Migration-DxHHPyzn.js} +9 -4
- package/dist/Migration-DxHHPyzn.js.map +1 -0
- package/dist/{MigrationGenerator-B1p0jHnx.js → MigrationGenerator-BmmerPXJ.js} +24 -35
- package/dist/MigrationGenerator-BmmerPXJ.js.map +1 -0
- package/dist/MigrationOperation-qpdhPEs9.d.ts +145 -0
- package/dist/{MigrationRunner-DomrOZIn.js → MigrationRunner-B5AJel12.js} +52 -24
- package/dist/MigrationRunner-B5AJel12.js.map +1 -0
- package/dist/{MigrationSqlSafetyAdapter-CGRbB2k2.js → MigrationSqlSafetyAdapter-yP6fPjeC.js} +13 -9
- package/dist/MigrationSqlSafetyAdapter-yP6fPjeC.js.map +1 -0
- package/dist/PostgresIntrospector-DQDTZUW_.d.ts +77 -0
- package/dist/{SqliteCompilerFactory-BvdJ0kBl.js → SqliteCompilerFactory-CXlPAclY.js} +38 -40
- package/dist/SqliteCompilerFactory-CXlPAclY.js.map +1 -0
- package/dist/{SqliteIntrospector-CWwPWhmA.js → SqliteIntrospector-CfItmGgA.js} +15 -15
- package/dist/SqliteIntrospector-CfItmGgA.js.map +1 -0
- package/dist/builder/index.d.ts +4 -10
- package/dist/builder/index.js +3 -6
- package/dist/{builder-xJ-Bq2pk.js → builder-BSepa_PF.js} +24 -24
- package/dist/builder-BSepa_PF.js.map +1 -0
- package/dist/chunk-D7D4PA-g.js +13 -0
- package/dist/{cli-7j3R1Y1r.js → cli-e8I1-dab.js} +34 -47
- package/dist/cli-e8I1-dab.js.map +1 -0
- package/dist/cli.d.ts +1 -2
- package/dist/cli.js +3 -16
- package/dist/cli.js.map +1 -1
- package/dist/commands/index.d.ts +2 -4
- package/dist/commands/index.js +7 -16
- package/dist/commands/index.js.map +1 -0
- package/dist/compilers/index.d.ts +3 -10
- package/dist/compilers/index.js +3 -7
- package/dist/{compilers-C-GiumJB.js → compilers-BW-WALoD.js} +9 -16
- package/dist/{compilers-C-GiumJB.js.map → compilers-BW-WALoD.js.map} +1 -1
- package/dist/diff/index.d.ts +2 -5
- package/dist/diff/index.js +2 -7
- package/dist/{diff-B9MhagJF.js → diff-7Xw8k4vp.js} +14 -14
- package/dist/diff-7Xw8k4vp.js.map +1 -0
- package/dist/domain/index.d.ts +5 -7
- package/dist/domain/index.js +7 -3
- package/dist/domain/index.js.map +1 -0
- package/dist/generator/index.d.ts +2 -4
- package/dist/generator/index.js +7 -4
- package/dist/generator/index.js.map +1 -0
- package/dist/index-B8VoE0M4.d.ts +56 -0
- package/dist/index-CsTGwtZ0.d.ts +110 -0
- package/dist/index-CzdR_Ig9.d.ts +47 -0
- package/dist/index-CzpjLzoS.d.ts +180 -0
- package/dist/index-D7qe9iKG.d.ts +13 -0
- package/dist/index-DdCF5yCg.d.ts +38 -0
- package/dist/index-a1Y--85Y.d.ts +41 -0
- package/dist/index-ni7Db8Lv.d.ts +86 -0
- package/dist/index-sywIP4pt.d.ts +61 -0
- package/dist/index.d.ts +17 -27
- package/dist/index.js +19 -23
- package/dist/introspect/index.d.ts +3 -6
- package/dist/introspect/index.js +10 -4
- package/dist/introspect/index.js.map +1 -0
- package/dist/runner/index.d.ts +2 -4
- package/dist/runner/index.js +7 -10
- package/dist/runner/index.js.map +1 -0
- package/dist/strategies/index.d.ts +3 -5
- package/dist/strategies/index.js +13 -9
- package/dist/strategies/index.js.map +1 -0
- package/package.json +9 -9
- package/dist/CollectingBuilder--4fqDQdE.js.map +0 -1
- package/dist/CompilerStrategy-_AiXiyjS.js.map +0 -1
- package/dist/IntrospectorStrategy-BEIG5GqA.js.map +0 -1
- package/dist/Migration-DYQ0hUG7.js.map +0 -1
- package/dist/MigrationGenerator-B1p0jHnx.js.map +0 -1
- package/dist/MigrationRunner-DomrOZIn.js.map +0 -1
- package/dist/MigrationSqlSafetyAdapter-CGRbB2k2.js.map +0 -1
- package/dist/SqliteCompilerFactory-BvdJ0kBl.js.map +0 -1
- package/dist/SqliteIntrospector-CWwPWhmA.js.map +0 -1
- package/dist/builder/contracts/Builder.d.ts +0 -11
- package/dist/builder/contracts/ColumnSpec.d.ts +0 -20
- package/dist/builder/contracts/ColumnType.d.ts +0 -2
- package/dist/builder/contracts/DeleteReferentialAction.d.ts +0 -2
- package/dist/builder/contracts/UpdateReferentialAction.d.ts +0 -2
- package/dist/builder/contracts/index.d.ts +0 -8
- package/dist/builder/ops/OpBuilder.d.ts +0 -129
- package/dist/builder/ops/index.d.ts +0 -4
- package/dist/builder/runtime/CollectingBuilder.d.ts +0 -39
- package/dist/builder/runtime/index.d.ts +0 -4
- package/dist/builder-xJ-Bq2pk.js.map +0 -1
- package/dist/chunk-BkvOhyD0.js +0 -12
- package/dist/cli-7j3R1Y1r.js.map +0 -1
- package/dist/commands/cli.d.ts +0 -5
- package/dist/commands-Cl2MU7tq.js +0 -10
- package/dist/commands-Cl2MU7tq.js.map +0 -1
- package/dist/compilers/contracts/CompilerFactory.d.ts +0 -8
- package/dist/compilers/contracts/SQL.d.ts +0 -4
- package/dist/compilers/contracts/SQLCompiler.d.ts +0 -11
- package/dist/compilers/contracts/index.d.ts +0 -6
- package/dist/compilers/dialects/PostgresCompiler.d.ts +0 -32
- package/dist/compilers/dialects/SqliteCompiler.d.ts +0 -27
- package/dist/compilers/dialects/index.d.ts +0 -5
- package/dist/compilers/factories/PostgresCompilerFactory.d.ts +0 -17
- package/dist/compilers/factories/SqliteCompilerFactory.d.ts +0 -17
- package/dist/compilers/factories/index.d.ts +0 -5
- package/dist/diff/diffSchema.d.ts +0 -39
- package/dist/diff-B9MhagJF.js.map +0 -1
- package/dist/domain/Dialect.d.ts +0 -2
- package/dist/domain/Migration.d.ts +0 -29
- package/dist/domain/MigrationMode.d.ts +0 -2
- package/dist/domain/MigrationOperation.d.ts +0 -77
- package/dist/domain/internal/InternalColumnType.d.ts +0 -11
- package/dist/domain/internal/InternalDialect.d.ts +0 -5
- package/dist/domain/internal/InternalMigrationMode.d.ts +0 -5
- package/dist/domain/internal/InternalOperationKind.d.ts +0 -14
- package/dist/domain/internal/InternalReferentialAction.d.ts +0 -7
- package/dist/domain-CwR-kUNS.js +0 -10
- package/dist/domain-CwR-kUNS.js.map +0 -1
- package/dist/generator/MigrationGenerator.d.ts +0 -48
- package/dist/generator-DK-_f-PF.js +0 -10
- package/dist/generator-DK-_f-PF.js.map +0 -1
- package/dist/internal/MigrationSqlSafetyAdapter.d.ts +0 -24
- package/dist/introspect/DatabaseIntrospector.d.ts +0 -17
- package/dist/introspect/PostgresIntrospector.d.ts +0 -56
- package/dist/introspect/SqliteIntrospector.d.ts +0 -53
- package/dist/introspect-DD3fm15e.js +0 -13
- package/dist/introspect-DD3fm15e.js.map +0 -1
- package/dist/runner/MigrationRunner.d.ts +0 -79
- package/dist/runner-C97xT8_W.js +0 -10
- package/dist/runner-C97xT8_W.js.map +0 -1
- package/dist/runtime/loadModule.d.ts +0 -18
- package/dist/schema/buildMigrationModelMetadataProjection.d.ts +0 -3
- package/dist/strategies/CompilerStrategy.d.ts +0 -42
- package/dist/strategies/IntrospectorStrategy.d.ts +0 -34
- package/dist/strategies-HwUWvmLC.js +0 -16
- package/dist/strategies-HwUWvmLC.js.map +0 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { d as MigrationOperation } from "./MigrationOperation-qpdhPEs9.js";
|
|
2
|
+
|
|
3
|
+
//#region src/domain/internal/InternalMigrationMode.d.ts
|
|
4
|
+
declare const InternalMigrationMode: {
|
|
5
|
+
readonly TRANSACTIONAL: "transactional";
|
|
6
|
+
readonly ONLINE: "online";
|
|
7
|
+
};
|
|
8
|
+
type InternalMigrationMode = (typeof InternalMigrationMode)[keyof typeof InternalMigrationMode];
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/domain/MigrationMode.d.ts
|
|
11
|
+
type MigrationMode = (typeof InternalMigrationMode)[keyof typeof InternalMigrationMode];
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/builder/contracts/Builder.d.ts
|
|
14
|
+
interface Builder {
|
|
15
|
+
run(...ops: MigrationOperation[]): void;
|
|
16
|
+
data(fn: (ctx: {
|
|
17
|
+
query(sql: string, params?: readonly unknown[]): Promise<void>;
|
|
18
|
+
}) => Promise<void>): void;
|
|
19
|
+
options(opts: {
|
|
20
|
+
mode?: MigrationMode;
|
|
21
|
+
}): void;
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { MigrationMode as n, Builder as t };
|
|
25
|
+
//# sourceMappingURL=Builder-y8vj7XXN.d.ts.map
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
1
|
//#region src/builder/runtime/CollectingBuilder.ts
|
|
2
|
+
/**
|
|
3
|
+
* In-memory builder that collects migration operations and data callbacks.
|
|
4
|
+
*/
|
|
3
5
|
var CollectingBuilder = class CollectingBuilder {
|
|
4
6
|
static BRAND = "tango.migrations.collecting_builder";
|
|
5
7
|
__tangoBrand = CollectingBuilder.BRAND;
|
|
@@ -37,7 +39,7 @@ var CollectingBuilder = class CollectingBuilder {
|
|
|
37
39
|
return this.mode;
|
|
38
40
|
}
|
|
39
41
|
};
|
|
40
|
-
|
|
41
42
|
//#endregion
|
|
42
|
-
export { CollectingBuilder };
|
|
43
|
-
|
|
43
|
+
export { CollectingBuilder as t };
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=CollectingBuilder-BIfAKs_x.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CollectingBuilder-BIfAKs_x.js","names":[],"sources":["../src/builder/runtime/CollectingBuilder.ts"],"sourcesContent":["import type { Builder } from '../contracts/Builder';\nimport type { MigrationOperation } from '../../domain/MigrationOperation';\nimport type { MigrationMode } from '../../domain/MigrationMode';\n\n/**\n * In-memory builder that collects migration operations and data callbacks.\n */\nexport class CollectingBuilder implements Builder {\n static readonly BRAND = 'tango.migrations.collecting_builder' as const;\n readonly __tangoBrand: typeof CollectingBuilder.BRAND = CollectingBuilder.BRAND;\n ops: MigrationOperation[] = [];\n dataFns: Array<(ctx: { query(sql: string, params?: readonly unknown[]): Promise<void> }) => Promise<void>> = [];\n private mode?: MigrationMode;\n\n /**\n * Narrow an unknown value to the in-memory builder used during migration collection.\n */\n static isCollectingBuilder(value: unknown): value is CollectingBuilder {\n return (\n typeof value === 'object' &&\n value !== null &&\n (value as { __tangoBrand?: unknown }).__tangoBrand === CollectingBuilder.BRAND\n );\n }\n\n /**\n * Append schema operations to the collection.\n */\n run(...ops: MigrationOperation[]): void {\n this.ops.push(...ops);\n }\n\n /**\n * Register a data migration callback.\n */\n data(fn: (ctx: { query(sql: string, params?: readonly unknown[]): Promise<void> }) => Promise<void>): void {\n this.dataFns.push(fn);\n }\n\n /**\n * Set execution options for the migration.\n */\n options(o: { mode?: MigrationMode }): void {\n this.mode = o.mode;\n }\n\n /**\n * Get the currently configured migration mode.\n */\n getMode(): MigrationMode | undefined {\n return this.mode;\n }\n}\n"],"mappings":";;;;AAOA,IAAa,oBAAb,MAAa,kBAAqC;CAC9C,OAAgB,QAAQ;CACxB,eAAwD,kBAAkB;CAC1E,MAA4B,CAAC;CAC7B,UAA6G,CAAC;CAC9G;;;;CAKA,OAAO,oBAAoB,OAA4C;EACnE,OACI,OAAO,UAAU,YACjB,UAAU,QACT,MAAqC,iBAAiB,kBAAkB;CAEjF;;;;CAKA,IAAI,GAAG,KAAiC;EACpC,KAAK,IAAI,KAAK,GAAG,GAAG;CACxB;;;;CAKA,KAAK,IAAsG;EACvG,KAAK,QAAQ,KAAK,EAAE;CACxB;;;;CAKA,QAAQ,GAAmC;EACvC,KAAK,OAAO,EAAE;CAClB;;;;CAKA,UAAqC;EACjC,OAAO,KAAK;CAChB;AACJ"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { d as MigrationOperation } from "./MigrationOperation-qpdhPEs9.js";
|
|
2
|
+
|
|
3
|
+
//#region src/compilers/contracts/SQL.d.ts
|
|
4
|
+
type SQL = {
|
|
5
|
+
sql: string;
|
|
6
|
+
params: readonly unknown[];
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/compilers/contracts/SQLCompiler.d.ts
|
|
10
|
+
/**
|
|
11
|
+
* Contract for dialect-specific migration SQL compilers.
|
|
12
|
+
*/
|
|
13
|
+
interface SQLCompiler {
|
|
14
|
+
/** Prepare operations into the dialect-specific execution order. */
|
|
15
|
+
prepareOperations?(operations: MigrationOperation[]): MigrationOperation[];
|
|
16
|
+
/** Compile an operation into SQL statements. */
|
|
17
|
+
compile(operation: MigrationOperation): SQL[];
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/compilers/contracts/CompilerFactory.d.ts
|
|
21
|
+
/**
|
|
22
|
+
* Factory contract for SQL compiler instances.
|
|
23
|
+
*/
|
|
24
|
+
interface CompilerFactory {
|
|
25
|
+
/** Create a compiler instance. */
|
|
26
|
+
create(): SQLCompiler;
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { SQLCompiler as n, SQL as r, CompilerFactory as t };
|
|
30
|
+
//# sourceMappingURL=CompilerFactory-Czv-zEOS.d.ts.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { a as CustomMigrationOperation, d as MigrationOperation } from "./MigrationOperation-qpdhPEs9.js";
|
|
2
|
+
import { n as SQLCompiler, r as SQL, t as CompilerFactory } from "./CompilerFactory-Czv-zEOS.js";
|
|
3
|
+
import { t as Dialect } from "./Dialect-Cp4r7UfW.js";
|
|
4
|
+
|
|
5
|
+
//#region src/strategies/CompilerStrategy.d.ts
|
|
6
|
+
type CompilerFactoryRegistry = Record<Dialect, CompilerFactory>;
|
|
7
|
+
/**
|
|
8
|
+
* Dialect-aware SQL compiler orchestration with optional custom-op handlers.
|
|
9
|
+
*/
|
|
10
|
+
declare class CompilerStrategy {
|
|
11
|
+
private readonly factories;
|
|
12
|
+
static readonly BRAND: "tango.migrations.compiler_strategy";
|
|
13
|
+
readonly __tangoBrand: typeof CompilerStrategy.BRAND;
|
|
14
|
+
private readonly compilerCache;
|
|
15
|
+
private readonly customHandlers;
|
|
16
|
+
constructor(factories: CompilerFactoryRegistry);
|
|
17
|
+
/**
|
|
18
|
+
* Narrow an unknown value to the dialect-aware migration compiler strategy.
|
|
19
|
+
*/
|
|
20
|
+
static isCompilerStrategy(value: unknown): value is CompilerStrategy;
|
|
21
|
+
/**
|
|
22
|
+
* Prepare a batch of migration operations for a target dialect.
|
|
23
|
+
*/
|
|
24
|
+
prepareOperations(dialect: Dialect, operations: MigrationOperation[]): MigrationOperation[];
|
|
25
|
+
/**
|
|
26
|
+
* Compile a migration operation to SQL for a target dialect.
|
|
27
|
+
*/
|
|
28
|
+
compile(dialect: Dialect, operation: MigrationOperation): SQL[];
|
|
29
|
+
/**
|
|
30
|
+
* Register a handler for custom migration operations.
|
|
31
|
+
*/
|
|
32
|
+
registerCustomHandler<TName extends string, TArgs extends object>(name: TName, handler: (dialect: Dialect, op: CustomMigrationOperation<TName, TArgs>) => SQL[]): this;
|
|
33
|
+
/**
|
|
34
|
+
* Resolve and cache a compiler instance for a dialect.
|
|
35
|
+
*/
|
|
36
|
+
getCompiler(dialect: Dialect): SQLCompiler;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Create the default compiler strategy with built-in dialect factories.
|
|
40
|
+
*/
|
|
41
|
+
declare function createDefaultCompilerStrategy(): CompilerStrategy;
|
|
42
|
+
//#endregion
|
|
43
|
+
export { createDefaultCompilerStrategy as n, CompilerStrategy as t };
|
|
44
|
+
//# sourceMappingURL=CompilerStrategy-DqmcqAC-.d.ts.map
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import { PostgresCompilerFactory, SqliteCompilerFactory } from "./SqliteCompilerFactory-
|
|
2
|
-
|
|
1
|
+
import { r as PostgresCompilerFactory, t as SqliteCompilerFactory } from "./SqliteCompilerFactory-CXlPAclY.js";
|
|
3
2
|
//#region src/domain/internal/InternalDialect.ts
|
|
4
3
|
const InternalDialect = {
|
|
5
4
|
POSTGRES: "postgres",
|
|
6
5
|
SQLITE: "sqlite"
|
|
7
6
|
};
|
|
8
|
-
|
|
9
7
|
//#endregion
|
|
10
8
|
//#region src/strategies/CompilerStrategy.ts
|
|
9
|
+
/**
|
|
10
|
+
* Dialect-aware SQL compiler orchestration with optional custom-op handlers.
|
|
11
|
+
*/
|
|
11
12
|
var CompilerStrategy = class CompilerStrategy {
|
|
13
|
+
factories;
|
|
12
14
|
static BRAND = "tango.migrations.compiler_strategy";
|
|
13
15
|
__tangoBrand = CompilerStrategy.BRAND;
|
|
14
|
-
compilerCache = new Map();
|
|
15
|
-
customHandlers = new Map();
|
|
16
|
+
compilerCache = /* @__PURE__ */ new Map();
|
|
17
|
+
customHandlers = /* @__PURE__ */ new Map();
|
|
16
18
|
constructor(factories) {
|
|
17
19
|
this.factories = factories;
|
|
18
20
|
}
|
|
@@ -38,8 +40,7 @@ var CompilerStrategy = class CompilerStrategy {
|
|
|
38
40
|
if (!handler) throw new Error(`Unsupported custom migration op: ${operation.name}`);
|
|
39
41
|
return handler(dialect, operation);
|
|
40
42
|
}
|
|
41
|
-
|
|
42
|
-
return compiler.compile(operation);
|
|
43
|
+
return this.getCompiler(dialect).compile(operation);
|
|
43
44
|
}
|
|
44
45
|
/**
|
|
45
46
|
* Register a handler for custom migration operations.
|
|
@@ -61,13 +62,16 @@ var CompilerStrategy = class CompilerStrategy {
|
|
|
61
62
|
return compiler;
|
|
62
63
|
}
|
|
63
64
|
};
|
|
65
|
+
/**
|
|
66
|
+
* Create the default compiler strategy with built-in dialect factories.
|
|
67
|
+
*/
|
|
64
68
|
function createDefaultCompilerStrategy() {
|
|
65
69
|
return new CompilerStrategy({
|
|
66
70
|
[InternalDialect.POSTGRES]: new PostgresCompilerFactory(),
|
|
67
71
|
[InternalDialect.SQLITE]: new SqliteCompilerFactory()
|
|
68
72
|
});
|
|
69
73
|
}
|
|
70
|
-
|
|
71
74
|
//#endregion
|
|
72
|
-
export {
|
|
73
|
-
|
|
75
|
+
export { createDefaultCompilerStrategy as n, InternalDialect as r, CompilerStrategy as t };
|
|
76
|
+
|
|
77
|
+
//# sourceMappingURL=CompilerStrategy-vcZKg8qf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompilerStrategy-vcZKg8qf.js","names":[],"sources":["../src/domain/internal/InternalDialect.ts","../src/strategies/CompilerStrategy.ts"],"sourcesContent":["export const InternalDialect = {\n POSTGRES: 'postgres',\n SQLITE: 'sqlite',\n} as const;\n\nexport type InternalDialect = (typeof InternalDialect)[keyof typeof InternalDialect];\n","import { PostgresCompilerFactory } from '../compilers/factories/PostgresCompilerFactory';\nimport { SqliteCompilerFactory } from '../compilers/factories/SqliteCompilerFactory';\nimport type { CompilerFactory } from '../compilers/contracts/CompilerFactory';\nimport type { Dialect } from '../domain/Dialect';\nimport type { CustomMigrationOperation, MigrationOperation } from '../domain/MigrationOperation';\nimport type { SQL } from '../compilers/contracts/SQL';\nimport type { SQLCompiler } from '../compilers/contracts/SQLCompiler';\nimport { InternalDialect } from '../domain/internal/InternalDialect';\n\ntype CompilerFactoryRegistry = Record<Dialect, CompilerFactory>;\n\n/**\n * Dialect-aware SQL compiler orchestration with optional custom-op handlers.\n */\nexport class CompilerStrategy {\n static readonly BRAND = 'tango.migrations.compiler_strategy' as const;\n readonly __tangoBrand: typeof CompilerStrategy.BRAND = CompilerStrategy.BRAND;\n private readonly compilerCache = new Map<Dialect, SQLCompiler>();\n private readonly customHandlers = new Map<string, (dialect: Dialect, op: CustomMigrationOperation) => SQL[]>();\n\n constructor(private readonly factories: CompilerFactoryRegistry) {}\n\n /**\n * Narrow an unknown value to the dialect-aware migration compiler strategy.\n */\n static isCompilerStrategy(value: unknown): value is CompilerStrategy {\n return (\n typeof value === 'object' &&\n value !== null &&\n (value as { __tangoBrand?: unknown }).__tangoBrand === CompilerStrategy.BRAND\n );\n }\n\n /**\n * Prepare a batch of migration operations for a target dialect.\n */\n prepareOperations(dialect: Dialect, operations: MigrationOperation[]): MigrationOperation[] {\n const compiler = this.getCompiler(dialect);\n return compiler.prepareOperations ? compiler.prepareOperations(operations) : operations;\n }\n\n /**\n * Compile a migration operation to SQL for a target dialect.\n */\n compile(dialect: Dialect, operation: MigrationOperation): SQL[] {\n if (operation.kind === 'custom') {\n const handler = this.customHandlers.get(operation.name);\n if (!handler) {\n throw new Error(`Unsupported custom migration op: ${operation.name}`);\n }\n return handler(dialect, operation);\n }\n const compiler = this.getCompiler(dialect);\n return compiler.compile(operation);\n }\n\n /**\n * Register a handler for custom migration operations.\n */\n registerCustomHandler<TName extends string, TArgs extends object>(\n name: TName,\n handler: (dialect: Dialect, op: CustomMigrationOperation<TName, TArgs>) => SQL[]\n ): this {\n this.customHandlers.set(name, handler as (dialect: Dialect, op: CustomMigrationOperation) => SQL[]);\n return this;\n }\n\n /**\n * Resolve and cache a compiler instance for a dialect.\n */\n getCompiler(dialect: Dialect): SQLCompiler {\n const cached = this.compilerCache.get(dialect);\n if (cached) {\n return cached;\n }\n\n const factory = this.factories[dialect];\n if (!factory) {\n throw new Error(`No SQL compiler factory registered for dialect: ${String(dialect)}`);\n }\n const compiler = factory.create();\n this.compilerCache.set(dialect, compiler);\n return compiler;\n }\n}\n\n/**\n * Create the default compiler strategy with built-in dialect factories.\n */\nexport function createDefaultCompilerStrategy(): CompilerStrategy {\n return new CompilerStrategy({\n [InternalDialect.POSTGRES]: new PostgresCompilerFactory(),\n [InternalDialect.SQLITE]: new SqliteCompilerFactory(),\n });\n}\n"],"mappings":";;AAAA,MAAa,kBAAkB;CAC3B,UAAU;CACV,QAAQ;AACZ;;;;;;ACWA,IAAa,mBAAb,MAAa,iBAAiB;CAMG;CAL7B,OAAgB,QAAQ;CACxB,eAAuD,iBAAiB;CACxE,gCAAiC,IAAI,IAA0B;CAC/D,iCAAkC,IAAI,IAAuE;CAE7G,YAAY,WAAqD;EAApC,KAAA,YAAA;CAAqC;;;;CAKlE,OAAO,mBAAmB,OAA2C;EACjE,OACI,OAAO,UAAU,YACjB,UAAU,QACT,MAAqC,iBAAiB,iBAAiB;CAEhF;;;;CAKA,kBAAkB,SAAkB,YAAwD;EACxF,MAAM,WAAW,KAAK,YAAY,OAAO;EACzC,OAAO,SAAS,oBAAoB,SAAS,kBAAkB,UAAU,IAAI;CACjF;;;;CAKA,QAAQ,SAAkB,WAAsC;EAC5D,IAAI,UAAU,SAAS,UAAU;GAC7B,MAAM,UAAU,KAAK,eAAe,IAAI,UAAU,IAAI;GACtD,IAAI,CAAC,SACD,MAAM,IAAI,MAAM,oCAAoC,UAAU,MAAM;GAExE,OAAO,QAAQ,SAAS,SAAS;EACrC;EAEA,OADiB,KAAK,YAAY,OACpB,EAAE,QAAQ,SAAS;CACrC;;;;CAKA,sBACI,MACA,SACI;EACJ,KAAK,eAAe,IAAI,MAAM,OAAoE;EAClG,OAAO;CACX;;;;CAKA,YAAY,SAA+B;EACvC,MAAM,SAAS,KAAK,cAAc,IAAI,OAAO;EAC7C,IAAI,QACA,OAAO;EAGX,MAAM,UAAU,KAAK,UAAU;EAC/B,IAAI,CAAC,SACD,MAAM,IAAI,MAAM,mDAAmD,OAAO,OAAO,GAAG;EAExF,MAAM,WAAW,QAAQ,OAAO;EAChC,KAAK,cAAc,IAAI,SAAS,QAAQ;EACxC,OAAO;CACX;AACJ;;;;AAKA,SAAgB,gCAAkD;CAC9D,OAAO,IAAI,iBAAiB;GACvB,gBAAgB,WAAW,IAAI,wBAAwB;GACvD,gBAAgB,SAAS,IAAI,sBAAsB;CACxD,CAAC;AACL"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/domain/internal/InternalDialect.d.ts
|
|
2
|
+
declare const InternalDialect: {
|
|
3
|
+
readonly POSTGRES: "postgres";
|
|
4
|
+
readonly SQLITE: "sqlite";
|
|
5
|
+
};
|
|
6
|
+
type InternalDialect = (typeof InternalDialect)[keyof typeof InternalDialect];
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/domain/Dialect.d.ts
|
|
9
|
+
type Dialect = (typeof InternalDialect)[keyof typeof InternalDialect];
|
|
10
|
+
//#endregion
|
|
11
|
+
export { Dialect as t };
|
|
12
|
+
//# sourceMappingURL=Dialect-Cp4r7UfW.d.ts.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
//#region src/domain/internal/InternalColumnType.ts
|
|
3
2
|
const InternalColumnType = {
|
|
4
3
|
SERIAL: "serial",
|
|
@@ -10,7 +9,7 @@ const InternalColumnType = {
|
|
|
10
9
|
JSONB: "jsonb",
|
|
11
10
|
UUID: "uuid"
|
|
12
11
|
};
|
|
13
|
-
|
|
14
12
|
//#endregion
|
|
15
|
-
export { InternalColumnType };
|
|
16
|
-
|
|
13
|
+
export { InternalColumnType as t };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=InternalColumnType-Dzs9T6a6.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalColumnType-
|
|
1
|
+
{"version":3,"file":"InternalColumnType-Dzs9T6a6.js","names":[],"sources":["../src/domain/internal/InternalColumnType.ts"],"sourcesContent":["export const InternalColumnType = {\n SERIAL: 'serial',\n INT: 'int',\n BIGINT: 'bigint',\n TEXT: 'text',\n BOOL: 'bool',\n TIMESTAMPTZ: 'timestamptz',\n JSONB: 'jsonb',\n UUID: 'uuid',\n} as const;\n\nexport type InternalColumnType = (typeof InternalColumnType)[keyof typeof InternalColumnType];\n"],"mappings":";AAAA,MAAa,qBAAqB;CAC9B,QAAQ;CACR,KAAK;CACL,QAAQ;CACR,MAAM;CACN,MAAM;CACN,aAAa;CACb,OAAO;CACP,MAAM;AACV"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
//#region src/domain/internal/InternalOperationKind.ts
|
|
3
2
|
const InternalOperationKind = {
|
|
4
3
|
TABLE_CREATE: "table.create",
|
|
@@ -13,7 +12,7 @@ const InternalOperationKind = {
|
|
|
13
12
|
FK_VALIDATE: "fk.validate",
|
|
14
13
|
FK_DROP: "fk.drop"
|
|
15
14
|
};
|
|
16
|
-
|
|
17
15
|
//#endregion
|
|
18
|
-
export { InternalOperationKind };
|
|
19
|
-
|
|
16
|
+
export { InternalOperationKind as t };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=InternalOperationKind-M4a4H9OZ.js.map
|
package/dist/{InternalOperationKind-Bt6Weuon.js.map → InternalOperationKind-M4a4H9OZ.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalOperationKind-
|
|
1
|
+
{"version":3,"file":"InternalOperationKind-M4a4H9OZ.js","names":[],"sources":["../src/domain/internal/InternalOperationKind.ts"],"sourcesContent":["export const InternalOperationKind = {\n TABLE_CREATE: 'table.create',\n TABLE_DROP: 'table.drop',\n COLUMN_ADD: 'column.add',\n COLUMN_DROP: 'column.drop',\n COLUMN_ALTER: 'column.alter',\n COLUMN_RENAME: 'column.rename',\n INDEX_CREATE: 'index.create',\n INDEX_DROP: 'index.drop',\n FK_CREATE: 'fk.create',\n FK_VALIDATE: 'fk.validate',\n FK_DROP: 'fk.drop',\n} as const;\n\nexport type InternalOperationKind = (typeof InternalOperationKind)[keyof typeof InternalOperationKind];\n"],"mappings":";AAAA,MAAa,wBAAwB;CACjC,cAAc;CACd,YAAY;CACZ,YAAY;CACZ,aAAa;CACb,cAAc;CACd,eAAe;CACf,cAAc;CACd,YAAY;CACZ,WAAW;CACX,aAAa;CACb,SAAS;AACb"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { InternalDialect } from "./CompilerStrategy-
|
|
2
|
-
import { PostgresIntrospector, SqliteIntrospector } from "./SqliteIntrospector-
|
|
3
|
-
|
|
1
|
+
import { r as InternalDialect } from "./CompilerStrategy-vcZKg8qf.js";
|
|
2
|
+
import { n as PostgresIntrospector, t as SqliteIntrospector } from "./SqliteIntrospector-CfItmGgA.js";
|
|
4
3
|
//#region src/strategies/IntrospectorStrategy.ts
|
|
4
|
+
/**
|
|
5
|
+
* Dialect-aware schema introspection orchestration.
|
|
6
|
+
*/
|
|
5
7
|
var IntrospectorStrategy = class IntrospectorStrategy {
|
|
8
|
+
factories;
|
|
6
9
|
static BRAND = "tango.migrations.introspector_strategy";
|
|
7
10
|
__tangoBrand = IntrospectorStrategy.BRAND;
|
|
8
|
-
introspectorCache = new Map();
|
|
11
|
+
introspectorCache = /* @__PURE__ */ new Map();
|
|
9
12
|
constructor(factories) {
|
|
10
13
|
this.factories = factories;
|
|
11
14
|
}
|
|
@@ -19,8 +22,7 @@ var IntrospectorStrategy = class IntrospectorStrategy {
|
|
|
19
22
|
* Introspect database schema using a dialect-specific introspector.
|
|
20
23
|
*/
|
|
21
24
|
introspect(dialect, client) {
|
|
22
|
-
|
|
23
|
-
return introspector.introspect(client);
|
|
25
|
+
return this.getIntrospector(dialect).introspect(client);
|
|
24
26
|
}
|
|
25
27
|
/**
|
|
26
28
|
* Resolve and cache an introspector instance for a dialect.
|
|
@@ -35,13 +37,16 @@ var IntrospectorStrategy = class IntrospectorStrategy {
|
|
|
35
37
|
return introspector;
|
|
36
38
|
}
|
|
37
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* Create the default introspector strategy with built-in dialect support.
|
|
42
|
+
*/
|
|
38
43
|
function createDefaultIntrospectorStrategy() {
|
|
39
44
|
return new IntrospectorStrategy({
|
|
40
45
|
[InternalDialect.POSTGRES]: { create: () => new PostgresIntrospector() },
|
|
41
46
|
[InternalDialect.SQLITE]: { create: () => new SqliteIntrospector() }
|
|
42
47
|
});
|
|
43
48
|
}
|
|
44
|
-
|
|
45
49
|
//#endregion
|
|
46
|
-
export {
|
|
47
|
-
|
|
50
|
+
export { createDefaultIntrospectorStrategy as n, IntrospectorStrategy as t };
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=IntrospectorStrategy-BijuyIaN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IntrospectorStrategy-BijuyIaN.js","names":[],"sources":["../src/strategies/IntrospectorStrategy.ts"],"sourcesContent":["import type { DBClient, DatabaseIntrospector } from '../introspect/DatabaseIntrospector';\nimport type { Dialect } from '../domain/Dialect';\nimport { InternalDialect } from '../domain/internal/InternalDialect';\nimport type { DbSchema } from '../introspect/PostgresIntrospector';\nimport { PostgresIntrospector } from '../introspect/PostgresIntrospector';\nimport { SqliteIntrospector } from '../introspect/SqliteIntrospector';\n\ntype IntrospectorFactory = {\n create(): DatabaseIntrospector;\n};\n\ntype IntrospectorFactoryRegistry = Record<Dialect, IntrospectorFactory>;\n\n/**\n * Dialect-aware schema introspection orchestration.\n */\nexport class IntrospectorStrategy {\n static readonly BRAND = 'tango.migrations.introspector_strategy' as const;\n readonly __tangoBrand: typeof IntrospectorStrategy.BRAND = IntrospectorStrategy.BRAND;\n private readonly introspectorCache = new Map<Dialect, DatabaseIntrospector>();\n\n constructor(private readonly factories: IntrospectorFactoryRegistry) {}\n\n /**\n * Narrow an unknown value to the dialect-aware schema introspection strategy.\n */\n static isIntrospectorStrategy(value: unknown): value is IntrospectorStrategy {\n return (\n typeof value === 'object' &&\n value !== null &&\n (value as { __tangoBrand?: unknown }).__tangoBrand === IntrospectorStrategy.BRAND\n );\n }\n\n /**\n * Introspect database schema using a dialect-specific introspector.\n */\n introspect(dialect: Dialect, client: DBClient): Promise<DbSchema> {\n const introspector = this.getIntrospector(dialect);\n return introspector.introspect(client);\n }\n\n /**\n * Resolve and cache an introspector instance for a dialect.\n */\n getIntrospector(dialect: Dialect): DatabaseIntrospector {\n const cached = this.introspectorCache.get(dialect);\n if (cached) {\n return cached;\n }\n\n const factory = this.factories[dialect];\n if (!factory) {\n throw new Error(`No database introspector factory registered for dialect: ${String(dialect)}`);\n }\n\n const introspector = factory.create();\n this.introspectorCache.set(dialect, introspector);\n return introspector;\n }\n}\n\n/**\n * Create the default introspector strategy with built-in dialect support.\n */\nexport function createDefaultIntrospectorStrategy(): IntrospectorStrategy {\n return new IntrospectorStrategy({\n [InternalDialect.POSTGRES]: { create: () => new PostgresIntrospector() },\n [InternalDialect.SQLITE]: { create: () => new SqliteIntrospector() },\n });\n}\n"],"mappings":";;;;;;AAgBA,IAAa,uBAAb,MAAa,qBAAqB;CAKD;CAJ7B,OAAgB,QAAQ;CACxB,eAA2D,qBAAqB;CAChF,oCAAqC,IAAI,IAAmC;CAE5E,YAAY,WAAyD;EAAxC,KAAA,YAAA;CAAyC;;;;CAKtE,OAAO,uBAAuB,OAA+C;EACzE,OACI,OAAO,UAAU,YACjB,UAAU,QACT,MAAqC,iBAAiB,qBAAqB;CAEpF;;;;CAKA,WAAW,SAAkB,QAAqC;EAE9D,OADqB,KAAK,gBAAgB,OACxB,EAAE,WAAW,MAAM;CACzC;;;;CAKA,gBAAgB,SAAwC;EACpD,MAAM,SAAS,KAAK,kBAAkB,IAAI,OAAO;EACjD,IAAI,QACA,OAAO;EAGX,MAAM,UAAU,KAAK,UAAU;EAC/B,IAAI,CAAC,SACD,MAAM,IAAI,MAAM,4DAA4D,OAAO,OAAO,GAAG;EAGjG,MAAM,eAAe,QAAQ,OAAO;EACpC,KAAK,kBAAkB,IAAI,SAAS,YAAY;EAChD,OAAO;CACX;AACJ;;;;AAKA,SAAgB,oCAA0D;CACtE,OAAO,IAAI,qBAAqB;GAC3B,gBAAgB,WAAW,EAAE,cAAc,IAAI,qBAAqB,EAAE;GACtE,gBAAgB,SAAS,EAAE,cAAc,IAAI,mBAAmB,EAAE;CACvE,CAAC;AACL"}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
|
|
2
1
|
//#region src/domain/Migration.ts
|
|
2
|
+
/**
|
|
3
|
+
* Base migration contract.
|
|
4
|
+
*
|
|
5
|
+
* Concrete migrations provide a stable `id` and define reversible schema/data
|
|
6
|
+
* operations through `up` and `down`.
|
|
7
|
+
*/
|
|
3
8
|
var Migration = class Migration {
|
|
4
9
|
static BRAND = "tango.migration";
|
|
5
10
|
static CONSTRUCTOR_BRAND = "tango.migration.constructor";
|
|
@@ -24,7 +29,7 @@ var Migration = class Migration {
|
|
|
24
29
|
return value.__tangoConstructorBrand === Migration.CONSTRUCTOR_BRAND;
|
|
25
30
|
}
|
|
26
31
|
};
|
|
27
|
-
|
|
28
32
|
//#endregion
|
|
29
|
-
export { Migration };
|
|
30
|
-
|
|
33
|
+
export { Migration as t };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=Migration-DxHHPyzn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Migration-DxHHPyzn.js","names":[],"sources":["../src/domain/Migration.ts"],"sourcesContent":["import type { Builder } from '../builder/contracts/Builder';\nimport type { MigrationMode } from './MigrationMode';\n\n/**\n * Base migration contract.\n *\n * Concrete migrations provide a stable `id` and define reversible schema/data\n * operations through `up` and `down`.\n */\nexport abstract class Migration {\n static readonly BRAND = 'tango.migration' as const;\n static readonly CONSTRUCTOR_BRAND = 'tango.migration.constructor' as const;\n static readonly __tangoConstructorBrand: typeof Migration.CONSTRUCTOR_BRAND = Migration.CONSTRUCTOR_BRAND;\n readonly __tangoBrand: typeof Migration.BRAND = Migration.BRAND;\n\n abstract id: string;\n /** Optional execution mode override (`online`/`offline`). */\n mode?: MigrationMode;\n /** Apply migration operations. */\n abstract up(m: Builder): void | Promise<void>;\n /** Revert migration operations. */\n abstract down(m: Builder): void | Promise<void>;\n\n /**\n * Narrow an unknown value to a migration instance.\n */\n static isMigration(value: unknown): value is Migration {\n return (\n typeof value === 'object' &&\n value !== null &&\n (value as { __tangoBrand?: unknown }).__tangoBrand === Migration.BRAND\n );\n }\n\n /**\n * Narrow an unknown value to a migration constructor.\n */\n static isMigrationConstructor(value: unknown): value is new () => Migration {\n if (typeof value !== 'function') {\n return false;\n }\n\n const prototype = (value as { prototype?: unknown }).prototype;\n if (typeof prototype !== 'object' || prototype === null) {\n return false;\n }\n\n if (\n typeof (prototype as { up?: unknown }).up !== 'function' ||\n typeof (prototype as { down?: unknown }).down !== 'function'\n ) {\n return false;\n }\n\n return (value as { __tangoConstructorBrand?: unknown }).__tangoConstructorBrand === Migration.CONSTRUCTOR_BRAND;\n }\n}\n"],"mappings":";;;;;;;AASA,IAAsB,YAAtB,MAAsB,UAAU;CAC5B,OAAgB,QAAQ;CACxB,OAAgB,oBAAoB;CACpC,OAAgB,0BAA8D,UAAU;CACxF,eAAgD,UAAU;;CAI1D;;;;CASA,OAAO,YAAY,OAAoC;EACnD,OACI,OAAO,UAAU,YACjB,UAAU,QACT,MAAqC,iBAAiB,UAAU;CAEzE;;;;CAKA,OAAO,uBAAuB,OAA8C;EACxE,IAAI,OAAO,UAAU,YACjB,OAAO;EAGX,MAAM,YAAa,MAAkC;EACrD,IAAI,OAAO,cAAc,YAAY,cAAc,MAC/C,OAAO;EAGX,IACI,OAAQ,UAA+B,OAAO,cAC9C,OAAQ,UAAiC,SAAS,YAElD,OAAO;EAGX,OAAQ,MAAgD,4BAA4B,UAAU;CAClG;AACJ"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { InternalOperationKind } from "./InternalOperationKind-
|
|
1
|
+
import { t as InternalOperationKind } from "./InternalOperationKind-M4a4H9OZ.js";
|
|
2
|
+
import { isTrustedSqlFragment } from "@danceroutine/tango-core";
|
|
2
3
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
3
4
|
import { join } from "node:path";
|
|
4
|
-
import { isTrustedSqlFragment } from "@danceroutine/tango-core";
|
|
5
|
-
|
|
6
5
|
//#region src/generator/MigrationGenerator.ts
|
|
6
|
+
/**
|
|
7
|
+
* Source generator for class-based migration files.
|
|
8
|
+
*/
|
|
7
9
|
var MigrationGenerator = class MigrationGenerator {
|
|
8
10
|
static BRAND = "tango.migrations.generator";
|
|
9
11
|
__tangoBrand = MigrationGenerator.BRAND;
|
|
@@ -20,10 +22,8 @@ var MigrationGenerator = class MigrationGenerator {
|
|
|
20
22
|
async generate(options) {
|
|
21
23
|
const { name, operations, directory } = options;
|
|
22
24
|
if (operations.length === 0) throw new Error("No operations to generate — models and database are in sync");
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const filename = `${id}.ts`;
|
|
26
|
-
const filepath = join(directory, filename);
|
|
25
|
+
const id = `${this.timestamp()}_${name}`;
|
|
26
|
+
const filepath = join(directory, `${id}.ts`);
|
|
27
27
|
const source = this.render(id, operations);
|
|
28
28
|
await mkdir(directory, { recursive: true });
|
|
29
29
|
await writeFile(filepath, source, "utf-8");
|
|
@@ -36,18 +36,16 @@ var MigrationGenerator = class MigrationGenerator {
|
|
|
36
36
|
const upOps = operations.map((operation) => this.renderOperation(operation));
|
|
37
37
|
const downOps = operations.map((operation) => this.renderReverseOperation(operation));
|
|
38
38
|
downOps.reverse();
|
|
39
|
-
|
|
40
|
-
const lines = [
|
|
39
|
+
return [
|
|
41
40
|
`import { Migration, op, trustedSql, type Builder } from '@danceroutine/tango-migrations';`,
|
|
42
41
|
``,
|
|
43
|
-
`export default class ${
|
|
42
|
+
`export default class ${this.renderClassName(id)} extends Migration {`,
|
|
44
43
|
` id = '${id}';`,
|
|
45
44
|
``,
|
|
46
45
|
` up(m: Builder) {`,
|
|
47
46
|
` m.run(`,
|
|
48
47
|
...upOps.map((code, index) => {
|
|
49
|
-
|
|
50
|
-
return ` ${code}${comma}`;
|
|
48
|
+
return ` ${code}${index < upOps.length - 1 ? "," : ""}`;
|
|
51
49
|
}),
|
|
52
50
|
` );`,
|
|
53
51
|
` }`,
|
|
@@ -55,19 +53,16 @@ var MigrationGenerator = class MigrationGenerator {
|
|
|
55
53
|
` down(m: Builder) {`,
|
|
56
54
|
` m.run(`,
|
|
57
55
|
...downOps.map((code, index) => {
|
|
58
|
-
|
|
59
|
-
return ` ${code}${comma}`;
|
|
56
|
+
return ` ${code}${index < downOps.length - 1 ? "," : ""}`;
|
|
60
57
|
}),
|
|
61
58
|
` );`,
|
|
62
59
|
` }`,
|
|
63
60
|
`}`,
|
|
64
61
|
``
|
|
65
|
-
];
|
|
66
|
-
return lines.join("\n");
|
|
62
|
+
].join("\n");
|
|
67
63
|
}
|
|
68
64
|
renderClassName(id) {
|
|
69
|
-
|
|
70
|
-
return `Migration_${normalized}`;
|
|
65
|
+
return `Migration_${id.replace(/[^a-zA-Z0-9]+/g, "_").replace(/^(\d)/, "_$1")}`;
|
|
71
66
|
}
|
|
72
67
|
renderOperation(operation) {
|
|
73
68
|
switch (operation.kind) {
|
|
@@ -128,11 +123,11 @@ var MigrationGenerator = class MigrationGenerator {
|
|
|
128
123
|
renderColumnAlter(operation) {
|
|
129
124
|
const parts = [];
|
|
130
125
|
if (operation.to.type) parts.push(`type: '${operation.to.type}'`);
|
|
131
|
-
if (operation.to.notNull !==
|
|
132
|
-
if (operation.to.default !==
|
|
126
|
+
if (operation.to.notNull !== void 0) parts.push(`notNull: ${operation.to.notNull}`);
|
|
127
|
+
if (operation.to.default !== void 0) {
|
|
133
128
|
if (operation.to.default === null) parts.push(`default: null`);
|
|
134
|
-
else if (this.isNowDefault(operation.to.default)) parts.push(`default: { now: true }`);
|
|
135
|
-
else if (isTrustedSqlFragment(operation.to.default)) parts.push(`default: trustedSql(${JSON.stringify(operation.to.default.sql)})`);
|
|
129
|
+
else if (this.isNowDefault(operation.to.default)) parts.push(`default: { now: true }`);
|
|
130
|
+
else if (isTrustedSqlFragment(operation.to.default)) parts.push(`default: trustedSql(${JSON.stringify(operation.to.default.sql)})`);
|
|
136
131
|
}
|
|
137
132
|
return `op.table('${operation.table}').alterColumn('${operation.column}', { ${parts.join(", ")} })`;
|
|
138
133
|
}
|
|
@@ -172,9 +167,9 @@ else if (isTrustedSqlFragment(operation.to.default)) parts.push(`default: truste
|
|
|
172
167
|
const parts = [];
|
|
173
168
|
if (col.type) parts.push(`.${col.type}()`);
|
|
174
169
|
if (col.notNull) parts.push(`.notNull()`);
|
|
175
|
-
if (col.default !==
|
|
170
|
+
if (col.default !== void 0 && col.default !== null) {
|
|
176
171
|
if (this.isNowDefault(col.default)) parts.push(`.defaultNow()`);
|
|
177
|
-
else if (isTrustedSqlFragment(col.default)) parts.push(`.default(trustedSql(${JSON.stringify(col.default.sql)}))`);
|
|
172
|
+
else if (isTrustedSqlFragment(col.default)) parts.push(`.default(trustedSql(${JSON.stringify(col.default.sql)}))`);
|
|
178
173
|
} else if (col.default === null) parts.push(`.default(null)`);
|
|
179
174
|
if (col.primaryKey) parts.push(`.primaryKey()`);
|
|
180
175
|
if (col.unique) parts.push(`.unique()`);
|
|
@@ -188,20 +183,14 @@ else if (isTrustedSqlFragment(col.default)) parts.push(`.default(trustedSql(${JS
|
|
|
188
183
|
return parts.join("");
|
|
189
184
|
}
|
|
190
185
|
timestamp() {
|
|
191
|
-
const now = new Date();
|
|
192
|
-
|
|
193
|
-
const month = String(now.getMonth() + 1).padStart(2, "0");
|
|
194
|
-
const day = String(now.getDate()).padStart(2, "0");
|
|
195
|
-
const hours = String(now.getHours()).padStart(2, "0");
|
|
196
|
-
const minutes = String(now.getMinutes()).padStart(2, "0");
|
|
197
|
-
const seconds = String(now.getSeconds()).padStart(2, "0");
|
|
198
|
-
return `${year}${month}${day}${hours}${minutes}${seconds}`;
|
|
186
|
+
const now = /* @__PURE__ */ new Date();
|
|
187
|
+
return `${now.getFullYear()}${String(now.getMonth() + 1).padStart(2, "0")}${String(now.getDate()).padStart(2, "0")}${String(now.getHours()).padStart(2, "0")}${String(now.getMinutes()).padStart(2, "0")}${String(now.getSeconds()).padStart(2, "0")}`;
|
|
199
188
|
}
|
|
200
189
|
isNowDefault(value) {
|
|
201
190
|
return typeof value === "object" && value !== null && "now" in value && value.now === true;
|
|
202
191
|
}
|
|
203
192
|
};
|
|
204
|
-
|
|
205
193
|
//#endregion
|
|
206
|
-
export { MigrationGenerator };
|
|
207
|
-
|
|
194
|
+
export { MigrationGenerator as t };
|
|
195
|
+
|
|
196
|
+
//# sourceMappingURL=MigrationGenerator-BmmerPXJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MigrationGenerator-BmmerPXJ.js","names":[],"sources":["../src/generator/MigrationGenerator.ts"],"sourcesContent":["import { isTrustedSqlFragment } from '@danceroutine/tango-core';\nimport type {\n MigrationOperation,\n TableCreate,\n TableDrop,\n ColumnAdd,\n ColumnDrop,\n ColumnAlter,\n ColumnRename,\n IndexCreate,\n IndexDrop,\n ForeignKeyCreate,\n ForeignKeyDrop,\n} from '../domain/MigrationOperation';\nimport type { ColumnSpec } from '../builder/contracts/ColumnSpec';\nimport { InternalOperationKind } from '../domain/internal/InternalOperationKind';\nimport { writeFile, mkdir } from 'node:fs/promises';\nimport { join } from 'node:path';\n\n/**\n * Input contract for generating a migration source file.\n */\nexport interface GenerateMigrationOptions {\n /** Human-readable suffix used in file name/id generation. */\n name: string;\n /** Ordered migration operations to render. */\n operations: MigrationOperation[];\n /** Output directory for generated migration files. */\n directory: string;\n}\n\n/**\n * Source generator for class-based migration files.\n */\nexport class MigrationGenerator {\n static readonly BRAND = 'tango.migrations.generator' as const;\n readonly __tangoBrand: typeof MigrationGenerator.BRAND = MigrationGenerator.BRAND;\n\n /**\n * Narrow an unknown value to `MigrationGenerator`.\n */\n static isMigrationGenerator(value: unknown): value is MigrationGenerator {\n return (\n typeof value === 'object' &&\n value !== null &&\n (value as { __tangoBrand?: unknown }).__tangoBrand === MigrationGenerator.BRAND\n );\n }\n\n /**\n * Generate a migration file and write it to disk.\n * Returns the file path of the created migration.\n */\n async generate(options: GenerateMigrationOptions): Promise<string> {\n const { name, operations, directory } = options;\n\n if (operations.length === 0) {\n throw new Error('No operations to generate — models and database are in sync');\n }\n\n const timestamp = this.timestamp();\n const id = `${timestamp}_${name}`;\n const filename = `${id}.ts`;\n const filepath = join(directory, filename);\n\n const source = this.render(id, operations);\n\n await mkdir(directory, { recursive: true });\n await writeFile(filepath, source, 'utf-8');\n\n return filepath;\n }\n\n /**\n * Render migration operations to a TypeScript source string without writing to disk.\n */\n render(id: string, operations: MigrationOperation[]): string {\n const upOps = operations.map((operation) => this.renderOperation(operation));\n const downOps = operations.map((operation) => this.renderReverseOperation(operation));\n downOps.reverse();\n const className = this.renderClassName(id);\n\n const lines = [\n `import { Migration, op, trustedSql, type Builder } from '@danceroutine/tango-migrations';`,\n ``,\n `export default class ${className} extends Migration {`,\n ` id = '${id}';`,\n ``,\n ` up(m: Builder) {`,\n ` m.run(`,\n ...upOps.map((code: string, index: number) => {\n const comma = index < upOps.length - 1 ? ',' : '';\n return ` ${code}${comma}`;\n }),\n ` );`,\n ` }`,\n ``,\n ` down(m: Builder) {`,\n ` m.run(`,\n ...downOps.map((code: string, index: number) => {\n const comma = index < downOps.length - 1 ? ',' : '';\n return ` ${code}${comma}`;\n }),\n ` );`,\n ` }`,\n `}`,\n ``,\n ];\n\n return lines.join('\\n');\n }\n\n private renderClassName(id: string): string {\n const normalized = id.replace(/[^a-zA-Z0-9]+/g, '_').replace(/^(\\d)/, '_$1');\n return `Migration_${normalized}`;\n }\n\n private renderOperation(operation: MigrationOperation): string {\n switch (operation.kind) {\n case InternalOperationKind.TABLE_CREATE:\n return this.renderTableCreate(operation);\n case InternalOperationKind.TABLE_DROP:\n return this.renderTableDrop(operation);\n case InternalOperationKind.COLUMN_ADD:\n return this.renderColumnAdd(operation);\n case InternalOperationKind.COLUMN_DROP:\n return this.renderColumnDrop(operation);\n case InternalOperationKind.COLUMN_ALTER:\n return this.renderColumnAlter(operation);\n case InternalOperationKind.COLUMN_RENAME:\n return this.renderColumnRename(operation);\n case InternalOperationKind.INDEX_CREATE:\n return this.renderIndexCreate(operation);\n case InternalOperationKind.INDEX_DROP:\n return this.renderIndexDrop(operation);\n case InternalOperationKind.FK_CREATE:\n return this.renderForeignKeyCreate(operation);\n case InternalOperationKind.FK_DROP:\n return this.renderForeignKeyDrop(operation);\n case InternalOperationKind.FK_VALIDATE:\n return `op.foreignKeyValidate({ table: '${operation.table}', name: '${operation.name}' })`;\n case 'custom':\n return `/* custom operation '${operation.name}' cannot be code-generated */`;\n default:\n return `/* unsupported operation */`;\n }\n }\n\n private renderReverseOperation(operation: MigrationOperation): string {\n switch (operation.kind) {\n case InternalOperationKind.TABLE_CREATE:\n return `op.table('${operation.table}').drop()`;\n case InternalOperationKind.TABLE_DROP:\n return `/* manual reverse required: recreate dropped table '${operation.table}' */`;\n case InternalOperationKind.COLUMN_ADD:\n return `op.table('${operation.table}').dropColumn('${operation.column.name}')`;\n case InternalOperationKind.COLUMN_DROP:\n return `/* manual reverse required: restore dropped column '${operation.column}' */`;\n case InternalOperationKind.COLUMN_ALTER:\n return `/* manual reverse required: revert ALTER COLUMN '${operation.column}' on '${operation.table}' */`;\n case InternalOperationKind.COLUMN_RENAME:\n return `op.table('${operation.table}').renameColumn('${operation.to}', '${operation.from}')`;\n case InternalOperationKind.INDEX_CREATE:\n return `op.index.drop({ name: '${operation.name}', table: '${operation.table}' })`;\n case InternalOperationKind.INDEX_DROP:\n return `/* manual reverse required: recreate dropped index '${operation.name}' */`;\n case InternalOperationKind.FK_CREATE:\n return `op.foreignKeyDrop({ table: '${operation.table}', name: '${operation.name ?? `${operation.table}_${operation.columns.join('_')}_fkey`}' })`;\n case InternalOperationKind.FK_DROP:\n return `/* manual reverse required: recreate dropped FK '${operation.name}' */`;\n case InternalOperationKind.FK_VALIDATE:\n return `/* no reverse needed for FK_VALIDATE */`;\n case 'custom':\n return `/* manual reverse required: custom operation '${operation.name}' */`;\n default:\n return `/* unsupported reverse operation */`;\n }\n }\n\n private renderTableCreate(operation: TableCreate): string {\n const columnLines = operation.columns.map((col) => {\n const chain = this.renderColumnChain(col);\n return ` cols.add('${col.name}', (b) => b${chain});`;\n });\n\n return [`op.table('${operation.table}').create((cols) => {`, ...columnLines, ` })`].join('\\n');\n }\n\n private renderTableDrop(operation: TableDrop): string {\n if (operation.cascade) {\n return `op.table('${operation.table}').drop({ cascade: true })`;\n }\n return `op.table('${operation.table}').drop()`;\n }\n\n private renderColumnAdd(operation: ColumnAdd): string {\n const chain = this.renderColumnChain(operation.column);\n return `op.table('${operation.table}').addColumn('${operation.column.name}', (b) => b${chain})`;\n }\n\n private renderColumnDrop(operation: ColumnDrop): string {\n return `op.table('${operation.table}').dropColumn('${operation.column}')`;\n }\n\n private renderColumnAlter(operation: ColumnAlter): string {\n const parts: string[] = [];\n if (operation.to.type) {\n parts.push(`type: '${operation.to.type}'`);\n }\n if (operation.to.notNull !== undefined) {\n parts.push(`notNull: ${operation.to.notNull}`);\n }\n if (operation.to.default !== undefined) {\n if (operation.to.default === null) {\n parts.push(`default: null`);\n } else if (this.isNowDefault(operation.to.default)) {\n parts.push(`default: { now: true }`);\n } else if (isTrustedSqlFragment(operation.to.default)) {\n parts.push(`default: trustedSql(${JSON.stringify(operation.to.default.sql)})`);\n }\n }\n return `op.table('${operation.table}').alterColumn('${operation.column}', { ${parts.join(', ')} })`;\n }\n\n private renderColumnRename(operation: ColumnRename): string {\n return `op.table('${operation.table}').renameColumn('${operation.from}', '${operation.to}')`;\n }\n\n private renderIndexCreate(operation: IndexCreate): string {\n const parts: string[] = [\n `name: '${operation.name}'`,\n `table: '${operation.table}'`,\n `on: [${operation.on.map((c) => `'${c}'`).join(', ')}]`,\n ];\n if (operation.unique) {\n parts.push(`unique: true`);\n }\n if (operation.where) {\n parts.push(`where: trustedSql(${JSON.stringify(operation.where.sql)})`);\n }\n if (operation.concurrently) {\n parts.push(`concurrently: true`);\n }\n return `op.index.create({ ${parts.join(', ')} })`;\n }\n\n private renderIndexDrop(operation: IndexDrop): string {\n return `op.index.drop({ name: '${operation.name}', table: '${operation.table}' })`;\n }\n\n private renderForeignKeyCreate(operation: ForeignKeyCreate): string {\n const parts: string[] = [\n `table: '${operation.table}'`,\n `columns: [${operation.columns.map((c) => `'${c}'`).join(', ')}]`,\n `references: { table: '${operation.refTable}', columns: [${operation.refColumns.map((c) => `'${c}'`).join(', ')}] }`,\n ];\n if (operation.name) {\n parts.push(`name: '${operation.name}'`);\n }\n if (operation.onDelete) {\n parts.push(`onDelete: '${operation.onDelete}'`);\n }\n if (operation.onUpdate) {\n parts.push(`onUpdate: '${operation.onUpdate}'`);\n }\n if (operation.notValid) {\n parts.push(`notValid: true`);\n }\n return `op.foreignKey({ ${parts.join(', ')} })`;\n }\n\n private renderForeignKeyDrop(operation: ForeignKeyDrop): string {\n return `op.foreignKeyDrop({ table: '${operation.table}', name: '${operation.name}' })`;\n }\n\n private renderColumnChain(col: ColumnSpec): string {\n const parts: string[] = [];\n\n if (col.type) {\n parts.push(`.${col.type}()`);\n }\n if (col.notNull) {\n parts.push(`.notNull()`);\n }\n if (col.default !== undefined && col.default !== null) {\n if (this.isNowDefault(col.default)) {\n parts.push(`.defaultNow()`);\n } else if (isTrustedSqlFragment(col.default)) {\n parts.push(`.default(trustedSql(${JSON.stringify(col.default.sql)}))`);\n }\n } else if (col.default === null) {\n parts.push(`.default(null)`);\n }\n if (col.primaryKey) {\n parts.push(`.primaryKey()`);\n }\n if (col.unique) {\n parts.push(`.unique()`);\n }\n if (col.references) {\n const refParts: string[] = [];\n if (col.references.onDelete) {\n refParts.push(`onDelete: '${col.references.onDelete}'`);\n }\n if (col.references.onUpdate) {\n refParts.push(`onUpdate: '${col.references.onUpdate}'`);\n }\n const opts = refParts.length > 0 ? `, { ${refParts.join(', ')} }` : '';\n parts.push(`.references('${col.references.table}', '${col.references.column}'${opts})`);\n }\n\n return parts.join('');\n }\n\n private timestamp(): string {\n const now = new Date();\n const year = now.getFullYear();\n const month = String(now.getMonth() + 1).padStart(2, '0');\n const day = String(now.getDate()).padStart(2, '0');\n const hours = String(now.getHours()).padStart(2, '0');\n const minutes = String(now.getMinutes()).padStart(2, '0');\n const seconds = String(now.getSeconds()).padStart(2, '0');\n return `${year}${month}${day}${hours}${minutes}${seconds}`;\n }\n\n private isNowDefault(value: ColumnSpec['default']): value is { now: true } {\n return typeof value === 'object' && value !== null && 'now' in value && value.now === true;\n }\n}\n"],"mappings":";;;;;;;;AAkCA,IAAa,qBAAb,MAAa,mBAAmB;CAC5B,OAAgB,QAAQ;CACxB,eAAyD,mBAAmB;;;;CAK5E,OAAO,qBAAqB,OAA6C;EACrE,OACI,OAAO,UAAU,YACjB,UAAU,QACT,MAAqC,iBAAiB,mBAAmB;CAElF;;;;;CAMA,MAAM,SAAS,SAAoD;EAC/D,MAAM,EAAE,MAAM,YAAY,cAAc;EAExC,IAAI,WAAW,WAAW,GACtB,MAAM,IAAI,MAAM,6DAA6D;EAIjF,MAAM,KAAK,GADO,KAAK,UACD,EAAE,GAAG;EAE3B,MAAM,WAAW,KAAK,WAAW,GADb,GAAG,IACkB;EAEzC,MAAM,SAAS,KAAK,OAAO,IAAI,UAAU;EAEzC,MAAM,MAAM,WAAW,EAAE,WAAW,KAAK,CAAC;EAC1C,MAAM,UAAU,UAAU,QAAQ,OAAO;EAEzC,OAAO;CACX;;;;CAKA,OAAO,IAAY,YAA0C;EAC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