@danceroutine/tango-migrations 0.1.0 → 1.0.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/LICENSE +21 -0
- package/README.md +114 -0
- package/dist/{CollectingBuilder-C6qnwyrb.js → CollectingBuilder--4fqDQdE.js} +17 -2
- package/dist/CollectingBuilder--4fqDQdE.js.map +1 -0
- package/dist/{CompilerStrategy-Cv1woBmO.js → CompilerStrategy-yKw-Egxv.js} +19 -8
- package/dist/CompilerStrategy-yKw-Egxv.js.map +1 -0
- package/dist/InternalColumnType-G9zV9StN.js +16 -0
- package/dist/InternalColumnType-G9zV9StN.js.map +1 -0
- package/dist/InternalOperationKind-Bt6Weuon.js +19 -0
- package/dist/InternalOperationKind-Bt6Weuon.js.map +1 -0
- package/dist/{IntrospectorStrategy-BM1Eizfc.js → IntrospectorStrategy-blvwSU3_.js} +13 -4
- package/dist/IntrospectorStrategy-blvwSU3_.js.map +1 -0
- package/dist/Migration-DYQ0hUG7.js +30 -0
- package/dist/Migration-DYQ0hUG7.js.map +1 -0
- package/dist/{MigrationGenerator-Z39LTKmC.js → MigrationGenerator-B1p0jHnx.js} +20 -12
- package/dist/MigrationGenerator-B1p0jHnx.js.map +1 -0
- package/dist/{MigrationRunner-CCFuPUlr.js → MigrationRunner-D1ZfbbS-.js} +52 -9
- package/dist/MigrationRunner-D1ZfbbS-.js.map +1 -0
- package/dist/MigrationSqlSafetyAdapter-CGRbB2k2.js +62 -0
- package/dist/MigrationSqlSafetyAdapter-CGRbB2k2.js.map +1 -0
- package/dist/{SqliteCompilerFactory-DwMwO7xY.js → SqliteCompilerFactory-BAodJW9n.js} +73 -51
- package/dist/SqliteCompilerFactory-BAodJW9n.js.map +1 -0
- package/dist/{SqliteIntrospector-BRdNt6KG.js → SqliteIntrospector-CWwPWhmA.js} +49 -5
- package/dist/SqliteIntrospector-CWwPWhmA.js.map +1 -0
- package/dist/builder/contracts/ColumnSpec.d.ts +2 -1
- package/dist/builder/contracts/UpdateReferentialAction.d.ts +1 -1
- package/dist/builder/index.js +4 -4
- package/dist/builder/ops/OpBuilder.d.ts +48 -7
- package/dist/builder/runtime/CollectingBuilder.d.ts +19 -1
- package/dist/{builder-Dtk8oP_Y.js → builder-xJ-Bq2pk.js} +51 -21
- package/dist/builder-xJ-Bq2pk.js.map +1 -0
- package/dist/cli-DhCn8xiS.js +313 -0
- package/dist/cli-DhCn8xiS.js.map +1 -0
- package/dist/cli.js +17 -169
- package/dist/cli.js.map +1 -1
- package/dist/commands/cli.d.ts +5 -0
- package/dist/commands/index.d.ts +4 -0
- package/dist/commands/index.js +17 -0
- package/dist/commands-DIJepqNg.js +10 -0
- package/dist/commands-DIJepqNg.js.map +1 -0
- package/dist/compilers/contracts/CompilerFactory.d.ts +4 -0
- package/dist/compilers/contracts/SQLCompiler.d.ts +4 -0
- package/dist/compilers/dialects/PostgresCompiler.d.ts +10 -1
- package/dist/compilers/dialects/SqliteCompiler.d.ts +10 -0
- package/dist/compilers/factories/PostgresCompilerFactory.d.ts +9 -0
- package/dist/compilers/factories/SqliteCompilerFactory.d.ts +9 -0
- package/dist/compilers/index.js +5 -4
- package/dist/{compilers-D8DJuTnQ.js → compilers-dRN0Hzev.js} +2 -2
- package/dist/{compilers-D8DJuTnQ.js.map → compilers-dRN0Hzev.js.map} +1 -1
- package/dist/diff/diffSchema.d.ts +6 -1
- package/dist/diff/index.js +6 -6
- package/dist/{diff-Cs0TPEGR.js → diff-CZZbXAPN.js} +2 -2
- package/dist/{diff-Cs0TPEGR.js.map → diff-CZZbXAPN.js.map} +1 -1
- package/dist/{diffSchema-KgGHP-s3.js → diffSchema-D4oemTWS.js} +5 -4
- package/dist/diffSchema-D4oemTWS.js.map +1 -0
- package/dist/domain/Migration.d.ts +17 -0
- package/dist/domain/MigrationOperation.d.ts +14 -13
- package/dist/domain/index.js +2 -2
- package/dist/domain/internal/InternalColumnType.d.ts +11 -10
- package/dist/domain/internal/InternalDialect.d.ts +5 -4
- package/dist/domain/internal/InternalMigrationMode.d.ts +5 -4
- package/dist/domain/internal/InternalOperationKind.d.ts +14 -13
- package/dist/domain/internal/InternalReferentialAction.d.ts +7 -6
- package/dist/{domain-BXVlG0C0.js → domain-CwR-kUNS.js} +2 -2
- package/dist/{domain-BXVlG0C0.js.map → domain-CwR-kUNS.js.map} +1 -1
- package/dist/generator/MigrationGenerator.d.ts +13 -0
- package/dist/generator/index.js +3 -3
- package/dist/{generator-3yC60b1u.js → generator-DK-_f-PF.js} +2 -2
- package/dist/{generator-3yC60b1u.js.map → generator-DK-_f-PF.js.map} +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +24 -20
- package/dist/internal/MigrationSqlSafetyAdapter.d.ts +24 -0
- package/dist/introspect/DatabaseIntrospector.d.ts +8 -0
- package/dist/introspect/PostgresIntrospector.d.ts +14 -0
- package/dist/introspect/SqliteIntrospector.d.ts +13 -0
- package/dist/introspect/index.js +3 -2
- package/dist/{introspect-ks-QSodq.js → introspect-TPv_jeD6.js} +2 -2
- package/dist/{introspect-ks-QSodq.js.map → introspect-TPv_jeD6.js.map} +1 -1
- package/dist/runner/MigrationRunner.d.ts +7 -1
- package/dist/runner/index.js +9 -8
- package/dist/{runner-BOs-tItW.js → runner-C97xT8_W.js} +2 -2
- package/dist/{runner-BOs-tItW.js.map → runner-C97xT8_W.js.map} +1 -1
- package/dist/runtime/loadModule.d.ts +15 -0
- package/dist/strategies/CompilerStrategy.d.ts +19 -1
- package/dist/strategies/IntrospectorStrategy.d.ts +16 -1
- package/dist/strategies/index.js +8 -7
- package/dist/{strategies-BvHwf4as.js → strategies-D9ymSvbG.js} +3 -3
- package/dist/{strategies-BvHwf4as.js.map → strategies-D9ymSvbG.js.map} +1 -1
- package/package.json +98 -92
- package/dist/CollectingBuilder-C6qnwyrb.js.map +0 -1
- package/dist/CompilerStrategy-Cv1woBmO.js.map +0 -1
- package/dist/InternalColumnType-_YAz7RqI.js +0 -17
- package/dist/InternalColumnType-_YAz7RqI.js.map +0 -1
- package/dist/InternalOperationKind-BPVoOQwD.js +0 -20
- package/dist/InternalOperationKind-BPVoOQwD.js.map +0 -1
- package/dist/IntrospectorStrategy-BM1Eizfc.js.map +0 -1
- package/dist/Migration-D9J6ZbLP.js +0 -25
- package/dist/Migration-D9J6ZbLP.js.map +0 -1
- package/dist/MigrationGenerator-Z39LTKmC.js.map +0 -1
- package/dist/MigrationRunner-CCFuPUlr.js.map +0 -1
- package/dist/SqliteCompilerFactory-DwMwO7xY.js.map +0 -1
- package/dist/SqliteIntrospector-BRdNt6KG.js.map +0 -1
- package/dist/builder/ops/OpBuilder.js +0 -173
- package/dist/builder-Dtk8oP_Y.js.map +0 -1
- package/dist/diffSchema-KgGHP-s3.js.map +0 -1
- package/dist/domain/MigrationOperation.js +0 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SqlSafetyEngine, type SqlDialect, type TrustedSqlFragment } from '@danceroutine/tango-core';
|
|
2
|
+
/**
|
|
3
|
+
* Migrations-local adapter that maps migration operations into the shared SQL
|
|
4
|
+
* safety engine and returns quoted identifiers or trusted raw fragments.
|
|
5
|
+
*/
|
|
6
|
+
export declare class MigrationSqlSafetyAdapter {
|
|
7
|
+
private readonly dialect;
|
|
8
|
+
private readonly engine;
|
|
9
|
+
constructor(dialect: SqlDialect, engine?: SqlSafetyEngine);
|
|
10
|
+
table(value: string): string;
|
|
11
|
+
column(value: string, allowlist?: readonly string[]): string;
|
|
12
|
+
columns(values: readonly string[], allowlist?: readonly string[]): string[];
|
|
13
|
+
index(value: string): string;
|
|
14
|
+
constraint(value: string): string;
|
|
15
|
+
schema(value: string): string;
|
|
16
|
+
rawFragment(key: string, value: TrustedSqlFragment): string;
|
|
17
|
+
optionalRawFragment(key: string, value?: TrustedSqlFragment): string | undefined;
|
|
18
|
+
rawDefault(value: TrustedSqlFragment | {
|
|
19
|
+
now: true;
|
|
20
|
+
} | null | undefined, nowSql: string): string | null | undefined;
|
|
21
|
+
isTrustedFragment(value: unknown): value is TrustedSqlFragment;
|
|
22
|
+
private quote;
|
|
23
|
+
private isNowDefault;
|
|
24
|
+
}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import type { DbSchema } from './PostgresIntrospector';
|
|
2
|
+
/**
|
|
3
|
+
* Minimal DB client shape required by schema introspection.
|
|
4
|
+
*/
|
|
2
5
|
export interface DBClient {
|
|
6
|
+
/** Execute a SQL statement and return row results. */
|
|
3
7
|
query<T = unknown>(sql: string, params?: readonly unknown[]): Promise<{
|
|
4
8
|
rows: T[];
|
|
5
9
|
}>;
|
|
6
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Dialect-specific schema introspection contract.
|
|
13
|
+
*/
|
|
7
14
|
export interface DatabaseIntrospector {
|
|
15
|
+
/** Read the current database schema state. */
|
|
8
16
|
introspect(client: DBClient): Promise<DbSchema>;
|
|
9
17
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { DBClient, DatabaseIntrospector } from './DatabaseIntrospector';
|
|
2
|
+
/** Introspected column metadata. */
|
|
2
3
|
export interface DbColumn {
|
|
3
4
|
name: string;
|
|
4
5
|
type: string;
|
|
@@ -7,6 +8,7 @@ export interface DbColumn {
|
|
|
7
8
|
isPk: boolean;
|
|
8
9
|
isUnique: boolean;
|
|
9
10
|
}
|
|
11
|
+
/** Introspected index metadata. */
|
|
10
12
|
export interface DbIndex {
|
|
11
13
|
name: string;
|
|
12
14
|
table: string;
|
|
@@ -14,6 +16,7 @@ export interface DbIndex {
|
|
|
14
16
|
columns: string[];
|
|
15
17
|
where: string | null;
|
|
16
18
|
}
|
|
19
|
+
/** Introspected foreign key metadata. */
|
|
17
20
|
export interface DbForeignKey {
|
|
18
21
|
name: string;
|
|
19
22
|
table: string;
|
|
@@ -24,6 +27,7 @@ export interface DbForeignKey {
|
|
|
24
27
|
onUpdate: string | null;
|
|
25
28
|
validated: boolean;
|
|
26
29
|
}
|
|
30
|
+
/** Introspected table metadata. */
|
|
27
31
|
export interface DbTable {
|
|
28
32
|
name: string;
|
|
29
33
|
columns: Record<string, DbColumn>;
|
|
@@ -31,12 +35,22 @@ export interface DbTable {
|
|
|
31
35
|
indexes: Record<string, DbIndex>;
|
|
32
36
|
fks: Record<string, DbForeignKey>;
|
|
33
37
|
}
|
|
38
|
+
/** Introspected schema metadata. */
|
|
34
39
|
export interface DbSchema {
|
|
35
40
|
tables: Record<string, DbTable>;
|
|
36
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* PostgreSQL implementation of schema introspection.
|
|
44
|
+
*/
|
|
37
45
|
export declare class PostgresIntrospector implements DatabaseIntrospector {
|
|
38
46
|
static readonly BRAND: "tango.migrations.postgres_introspector";
|
|
39
47
|
readonly __tangoBrand: typeof PostgresIntrospector.BRAND;
|
|
48
|
+
/**
|
|
49
|
+
* Narrow an unknown value to the PostgreSQL schema introspector.
|
|
50
|
+
*/
|
|
40
51
|
static isPostgresIntrospector(value: unknown): value is PostgresIntrospector;
|
|
52
|
+
/**
|
|
53
|
+
* Read table and column metadata from PostgreSQL system catalogs.
|
|
54
|
+
*/
|
|
41
55
|
introspect(client: DBClient): Promise<DbSchema>;
|
|
42
56
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { DBClient, DatabaseIntrospector } from './DatabaseIntrospector';
|
|
2
|
+
/** Introspected column metadata. */
|
|
2
3
|
export interface DbColumn {
|
|
3
4
|
name: string;
|
|
4
5
|
type: string;
|
|
@@ -7,6 +8,7 @@ export interface DbColumn {
|
|
|
7
8
|
isPk: boolean;
|
|
8
9
|
isUnique: boolean;
|
|
9
10
|
}
|
|
11
|
+
/** Introspected table metadata. */
|
|
10
12
|
export interface DbTable {
|
|
11
13
|
name: string;
|
|
12
14
|
columns: Record<string, DbColumn>;
|
|
@@ -29,12 +31,23 @@ export interface DbTable {
|
|
|
29
31
|
validated: boolean;
|
|
30
32
|
}>;
|
|
31
33
|
}
|
|
34
|
+
/** Introspected schema metadata. */
|
|
32
35
|
export interface DbSchema {
|
|
33
36
|
tables: Record<string, DbTable>;
|
|
34
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* SQLite implementation of schema introspection.
|
|
40
|
+
*/
|
|
35
41
|
export declare class SqliteIntrospector implements DatabaseIntrospector {
|
|
36
42
|
static readonly BRAND: "tango.migrations.sqlite_introspector";
|
|
37
43
|
readonly __tangoBrand: typeof SqliteIntrospector.BRAND;
|
|
44
|
+
private readonly sqlSafety;
|
|
45
|
+
/**
|
|
46
|
+
* Narrow an unknown value to the SQLite schema introspector.
|
|
47
|
+
*/
|
|
38
48
|
static isSqliteIntrospector(value: unknown): value is SqliteIntrospector;
|
|
49
|
+
/**
|
|
50
|
+
* Read table/column/index metadata from SQLite pragmas.
|
|
51
|
+
*/
|
|
39
52
|
introspect(client: DBClient): Promise<DbSchema>;
|
|
40
53
|
}
|
package/dist/introspect/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "../
|
|
1
|
+
import "../MigrationSqlSafetyAdapter-CGRbB2k2.js";
|
|
2
|
+
import { PostgresIntrospector, SqliteIntrospector } from "../SqliteIntrospector-CWwPWhmA.js";
|
|
3
|
+
import "../introspect-TPv_jeD6.js";
|
|
3
4
|
|
|
4
5
|
export { PostgresIntrospector, SqliteIntrospector };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __export } from "./chunk-BkvOhyD0.js";
|
|
2
|
-
import { PostgresIntrospector, SqliteIntrospector } from "./SqliteIntrospector-
|
|
2
|
+
import { PostgresIntrospector, SqliteIntrospector } from "./SqliteIntrospector-CWwPWhmA.js";
|
|
3
3
|
|
|
4
4
|
//#region src/introspect/index.ts
|
|
5
5
|
var introspect_exports = {};
|
|
@@ -10,4 +10,4 @@ __export(introspect_exports, {
|
|
|
10
10
|
|
|
11
11
|
//#endregion
|
|
12
12
|
export { introspect_exports };
|
|
13
|
-
//# sourceMappingURL=introspect-
|
|
13
|
+
//# sourceMappingURL=introspect-TPv_jeD6.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"introspect-
|
|
1
|
+
{"version":3,"file":"introspect-TPv_jeD6.js","names":[],"sources":["../src/introspect/index.ts"],"sourcesContent":["/**\n * Domain boundary barrel: centralizes this subdomain's public contract.\n */\n\nexport type { DBClient, DatabaseIntrospector } from './DatabaseIntrospector';\nexport {\n PostgresIntrospector,\n type DbColumn as PostgresDbColumn,\n type DbForeignKey as PostgresDbForeignKey,\n type DbIndex as PostgresDbIndex,\n type DbSchema as PostgresDbSchema,\n type DbTable as PostgresDbTable,\n} from './PostgresIntrospector';\nexport {\n SqliteIntrospector,\n type DbColumn as SqliteDbColumn,\n type DbSchema as SqliteDbSchema,\n type DbTable as SqliteDbTable,\n} from './SqliteIntrospector';\n"],"mappings":""}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { Dialect } from '../domain/Dialect';
|
|
2
2
|
import type { CompilerStrategy } from '../strategies/CompilerStrategy';
|
|
3
|
+
/** DB client contract required by migration execution. */
|
|
3
4
|
interface DBClient {
|
|
5
|
+
/** Execute SQL with optional parameters. */
|
|
4
6
|
query<T = unknown>(sql: string, params?: readonly unknown[]): Promise<{
|
|
5
7
|
rows: T[];
|
|
6
8
|
}>;
|
|
9
|
+
/** Release underlying database resources. */
|
|
7
10
|
close(): Promise<void>;
|
|
8
11
|
}
|
|
9
12
|
/**
|
|
@@ -35,9 +38,12 @@ export declare class MigrationRunner {
|
|
|
35
38
|
private dialect;
|
|
36
39
|
private migrationsDir;
|
|
37
40
|
static readonly BRAND: "tango.migrations.runner";
|
|
38
|
-
private compilerStrategy;
|
|
39
41
|
readonly __tangoBrand: typeof MigrationRunner.BRAND;
|
|
42
|
+
private compilerStrategy;
|
|
40
43
|
constructor(client: DBClient, dialect: Dialect, migrationsDir?: string, compilerStrategy?: CompilerStrategy);
|
|
44
|
+
/**
|
|
45
|
+
* Narrow an unknown value to `MigrationRunner`.
|
|
46
|
+
*/
|
|
41
47
|
static isMigrationRunner(value: unknown): value is MigrationRunner;
|
|
42
48
|
/**
|
|
43
49
|
* Apply all pending migrations, optionally stopping at a specific migration ID.
|
package/dist/runner/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import "../CollectingBuilder
|
|
2
|
-
import "../Migration-
|
|
3
|
-
import "../InternalOperationKind-
|
|
4
|
-
import "../InternalColumnType-
|
|
5
|
-
import "../
|
|
6
|
-
import "../
|
|
7
|
-
import
|
|
8
|
-
import "../
|
|
1
|
+
import "../CollectingBuilder--4fqDQdE.js";
|
|
2
|
+
import "../Migration-DYQ0hUG7.js";
|
|
3
|
+
import "../InternalOperationKind-Bt6Weuon.js";
|
|
4
|
+
import "../InternalColumnType-G9zV9StN.js";
|
|
5
|
+
import "../MigrationSqlSafetyAdapter-CGRbB2k2.js";
|
|
6
|
+
import "../SqliteCompilerFactory-BAodJW9n.js";
|
|
7
|
+
import "../CompilerStrategy-yKw-Egxv.js";
|
|
8
|
+
import { MigrationRunner } from "../MigrationRunner-D1ZfbbS-.js";
|
|
9
|
+
import "../runner-C97xT8_W.js";
|
|
9
10
|
|
|
10
11
|
export { MigrationRunner };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __export } from "./chunk-BkvOhyD0.js";
|
|
2
|
-
import { MigrationRunner } from "./MigrationRunner-
|
|
2
|
+
import { MigrationRunner } from "./MigrationRunner-D1ZfbbS-.js";
|
|
3
3
|
|
|
4
4
|
//#region src/runner/index.ts
|
|
5
5
|
var runner_exports = {};
|
|
@@ -7,4 +7,4 @@ __export(runner_exports, { MigrationRunner: () => MigrationRunner });
|
|
|
7
7
|
|
|
8
8
|
//#endregion
|
|
9
9
|
export { runner_exports };
|
|
10
|
-
//# sourceMappingURL=runner-
|
|
10
|
+
//# sourceMappingURL=runner-C97xT8_W.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner-
|
|
1
|
+
{"version":3,"file":"runner-C97xT8_W.js","names":[],"sources":["../src/runner/index.ts"],"sourcesContent":["/**\n * Domain boundary barrel: centralizes this subdomain's public contract.\n */\n\nexport { MigrationRunner } from './MigrationRunner';\n"],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Load a module from a Tango app project root.
|
|
3
|
+
*
|
|
4
|
+
* TypeScript modules are loaded through jiti and JavaScript/ESM modules are loaded
|
|
5
|
+
* through native dynamic import so published installs behave like end-user runtime.
|
|
6
|
+
*/
|
|
7
|
+
export declare function loadModule(modulePath: string, options?: {
|
|
8
|
+
projectRoot?: string;
|
|
9
|
+
}): Promise<Record<string, unknown>>;
|
|
10
|
+
/**
|
|
11
|
+
* Load a module and return default export when present.
|
|
12
|
+
*/
|
|
13
|
+
export declare function loadDefaultExport(modulePath: string, options?: {
|
|
14
|
+
projectRoot?: string;
|
|
15
|
+
}): Promise<unknown>;
|
|
@@ -4,17 +4,35 @@ import type { CustomMigrationOperation, MigrationOperation } from '../domain/Mig
|
|
|
4
4
|
import type { SQL } from '../compilers/contracts/SQL';
|
|
5
5
|
import type { SQLCompiler } from '../compilers/contracts/SQLCompiler';
|
|
6
6
|
type CompilerFactoryRegistry = Record<Dialect, CompilerFactory>;
|
|
7
|
+
/**
|
|
8
|
+
* Dialect-aware SQL compiler orchestration with optional custom-op handlers.
|
|
9
|
+
*/
|
|
7
10
|
export declare class CompilerStrategy {
|
|
8
11
|
private readonly factories;
|
|
9
12
|
static readonly BRAND: "tango.migrations.compiler_strategy";
|
|
13
|
+
readonly __tangoBrand: typeof CompilerStrategy.BRAND;
|
|
10
14
|
private readonly compilerCache;
|
|
11
15
|
private readonly customHandlers;
|
|
12
|
-
readonly __tangoBrand: typeof CompilerStrategy.BRAND;
|
|
13
16
|
constructor(factories: CompilerFactoryRegistry);
|
|
17
|
+
/**
|
|
18
|
+
* Narrow an unknown value to the dialect-aware migration compiler strategy.
|
|
19
|
+
*/
|
|
14
20
|
static isCompilerStrategy(value: unknown): value is CompilerStrategy;
|
|
21
|
+
/**
|
|
22
|
+
* Compile a migration operation to SQL for a target dialect.
|
|
23
|
+
*/
|
|
15
24
|
compile(dialect: Dialect, operation: MigrationOperation): SQL[];
|
|
25
|
+
/**
|
|
26
|
+
* Register a handler for custom migration operations.
|
|
27
|
+
*/
|
|
16
28
|
registerCustomHandler<TName extends string, TArgs extends object>(name: TName, handler: (dialect: Dialect, op: CustomMigrationOperation<TName, TArgs>) => SQL[]): this;
|
|
29
|
+
/**
|
|
30
|
+
* Resolve and cache a compiler instance for a dialect.
|
|
31
|
+
*/
|
|
17
32
|
getCompiler(dialect: Dialect): SQLCompiler;
|
|
18
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Create the default compiler strategy with built-in dialect factories.
|
|
36
|
+
*/
|
|
19
37
|
export declare function createDefaultCompilerStrategy(): CompilerStrategy;
|
|
20
38
|
export {};
|
|
@@ -5,15 +5,30 @@ type IntrospectorFactory = {
|
|
|
5
5
|
create(): DatabaseIntrospector;
|
|
6
6
|
};
|
|
7
7
|
type IntrospectorFactoryRegistry = Record<Dialect, IntrospectorFactory>;
|
|
8
|
+
/**
|
|
9
|
+
* Dialect-aware schema introspection orchestration.
|
|
10
|
+
*/
|
|
8
11
|
export declare class IntrospectorStrategy {
|
|
9
12
|
private readonly factories;
|
|
10
13
|
static readonly BRAND: "tango.migrations.introspector_strategy";
|
|
11
|
-
private readonly introspectorCache;
|
|
12
14
|
readonly __tangoBrand: typeof IntrospectorStrategy.BRAND;
|
|
15
|
+
private readonly introspectorCache;
|
|
13
16
|
constructor(factories: IntrospectorFactoryRegistry);
|
|
17
|
+
/**
|
|
18
|
+
* Narrow an unknown value to the dialect-aware schema introspection strategy.
|
|
19
|
+
*/
|
|
14
20
|
static isIntrospectorStrategy(value: unknown): value is IntrospectorStrategy;
|
|
21
|
+
/**
|
|
22
|
+
* Introspect database schema using a dialect-specific introspector.
|
|
23
|
+
*/
|
|
15
24
|
introspect(dialect: Dialect, client: DBClient): Promise<DbSchema>;
|
|
25
|
+
/**
|
|
26
|
+
* Resolve and cache an introspector instance for a dialect.
|
|
27
|
+
*/
|
|
16
28
|
getIntrospector(dialect: Dialect): DatabaseIntrospector;
|
|
17
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Create the default introspector strategy with built-in dialect support.
|
|
32
|
+
*/
|
|
18
33
|
export declare function createDefaultIntrospectorStrategy(): IntrospectorStrategy;
|
|
19
34
|
export {};
|
package/dist/strategies/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import "../InternalOperationKind-
|
|
2
|
-
import "../InternalColumnType-
|
|
3
|
-
import "../
|
|
4
|
-
import
|
|
5
|
-
import "../
|
|
6
|
-
import
|
|
7
|
-
import "../
|
|
1
|
+
import "../InternalOperationKind-Bt6Weuon.js";
|
|
2
|
+
import "../InternalColumnType-G9zV9StN.js";
|
|
3
|
+
import "../MigrationSqlSafetyAdapter-CGRbB2k2.js";
|
|
4
|
+
import "../SqliteCompilerFactory-BAodJW9n.js";
|
|
5
|
+
import { CompilerStrategy, createDefaultCompilerStrategy } from "../CompilerStrategy-yKw-Egxv.js";
|
|
6
|
+
import "../SqliteIntrospector-CWwPWhmA.js";
|
|
7
|
+
import { IntrospectorStrategy, createDefaultIntrospectorStrategy } from "../IntrospectorStrategy-blvwSU3_.js";
|
|
8
|
+
import "../strategies-D9ymSvbG.js";
|
|
8
9
|
|
|
9
10
|
export { CompilerStrategy, IntrospectorStrategy, createDefaultCompilerStrategy, createDefaultIntrospectorStrategy };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __export } from "./chunk-BkvOhyD0.js";
|
|
2
|
-
import { CompilerStrategy, createDefaultCompilerStrategy } from "./CompilerStrategy-
|
|
3
|
-
import { IntrospectorStrategy, createDefaultIntrospectorStrategy } from "./IntrospectorStrategy-
|
|
2
|
+
import { CompilerStrategy, createDefaultCompilerStrategy } from "./CompilerStrategy-yKw-Egxv.js";
|
|
3
|
+
import { IntrospectorStrategy, createDefaultIntrospectorStrategy } from "./IntrospectorStrategy-blvwSU3_.js";
|
|
4
4
|
|
|
5
5
|
//#region src/strategies/index.ts
|
|
6
6
|
var strategies_exports = {};
|
|
@@ -13,4 +13,4 @@ __export(strategies_exports, {
|
|
|
13
13
|
|
|
14
14
|
//#endregion
|
|
15
15
|
export { strategies_exports };
|
|
16
|
-
//# sourceMappingURL=strategies-
|
|
16
|
+
//# sourceMappingURL=strategies-D9ymSvbG.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strategies-
|
|
1
|
+
{"version":3,"file":"strategies-D9ymSvbG.js","names":[],"sources":["../src/strategies/index.ts"],"sourcesContent":["/**\n * Domain boundary barrel: centralizes this subdomain's public contract.\n */\n\nexport { CompilerStrategy, createDefaultCompilerStrategy } from './CompilerStrategy';\nexport { IntrospectorStrategy, createDefaultIntrospectorStrategy } from './IntrospectorStrategy';\n"],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,101 +1,107 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
"name": "@danceroutine/tango-migrations",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Auto-migration system with ops DSL for Tango",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
10
12
|
},
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"import": "./dist/index.js"
|
|
15
|
-
},
|
|
16
|
-
"./compilers": {
|
|
17
|
-
"types": "./dist/index.d.ts",
|
|
18
|
-
"import": "./dist/index.js"
|
|
19
|
-
},
|
|
20
|
-
"./strategies": {
|
|
21
|
-
"types": "./dist/index.d.ts",
|
|
22
|
-
"import": "./dist/index.js"
|
|
23
|
-
},
|
|
24
|
-
"./introspect": {
|
|
25
|
-
"types": "./dist/index.d.ts",
|
|
26
|
-
"import": "./dist/index.js"
|
|
27
|
-
},
|
|
28
|
-
"./domain": {
|
|
29
|
-
"types": "./dist/index.d.ts",
|
|
30
|
-
"import": "./dist/index.js"
|
|
31
|
-
},
|
|
32
|
-
"./builder": {
|
|
33
|
-
"types": "./dist/index.d.ts",
|
|
34
|
-
"import": "./dist/index.js"
|
|
35
|
-
},
|
|
36
|
-
"./runner": {
|
|
37
|
-
"types": "./dist/index.d.ts",
|
|
38
|
-
"import": "./dist/index.js"
|
|
39
|
-
},
|
|
40
|
-
"./generator": {
|
|
41
|
-
"types": "./dist/index.d.ts",
|
|
42
|
-
"import": "./dist/index.js"
|
|
43
|
-
},
|
|
44
|
-
"./diff": {
|
|
45
|
-
"types": "./dist/index.d.ts",
|
|
46
|
-
"import": "./dist/index.js"
|
|
47
|
-
}
|
|
13
|
+
"./commands": {
|
|
14
|
+
"types": "./dist/commands/index.d.ts",
|
|
15
|
+
"import": "./dist/commands/index.js"
|
|
48
16
|
},
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"scripts": {
|
|
53
|
-
"build": "tsdown",
|
|
54
|
-
"test": "vitest run --coverage",
|
|
55
|
-
"test:integration": "vitest run src/tests/integration",
|
|
56
|
-
"test:watch": "vitest",
|
|
57
|
-
"typecheck": "tsc --noEmit"
|
|
17
|
+
"./compilers": {
|
|
18
|
+
"types": "./dist/compilers/index.d.ts",
|
|
19
|
+
"import": "./dist/compilers/index.js"
|
|
58
20
|
},
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"database",
|
|
63
|
-
"orm"
|
|
64
|
-
],
|
|
65
|
-
"author": "Pedro Del Moral Lopez",
|
|
66
|
-
"license": "MIT",
|
|
67
|
-
"repository": {
|
|
68
|
-
"type": "git",
|
|
69
|
-
"url": "https://github.com/danceroutine/tango.git",
|
|
70
|
-
"directory": "packages/migrations"
|
|
21
|
+
"./strategies": {
|
|
22
|
+
"types": "./dist/strategies/index.d.ts",
|
|
23
|
+
"import": "./dist/strategies/index.js"
|
|
71
24
|
},
|
|
72
|
-
"
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
"yargs": "^17.7.2"
|
|
25
|
+
"./introspect": {
|
|
26
|
+
"types": "./dist/introspect/index.d.ts",
|
|
27
|
+
"import": "./dist/introspect/index.js"
|
|
76
28
|
},
|
|
77
|
-
"
|
|
78
|
-
|
|
79
|
-
|
|
29
|
+
"./domain": {
|
|
30
|
+
"types": "./dist/domain/index.d.ts",
|
|
31
|
+
"import": "./dist/domain/index.js"
|
|
80
32
|
},
|
|
81
|
-
"
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
},
|
|
85
|
-
"better-sqlite3": {
|
|
86
|
-
"optional": true
|
|
87
|
-
}
|
|
33
|
+
"./builder": {
|
|
34
|
+
"types": "./dist/builder/index.d.ts",
|
|
35
|
+
"import": "./dist/builder/index.js"
|
|
88
36
|
},
|
|
89
|
-
"
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
37
|
+
"./runner": {
|
|
38
|
+
"types": "./dist/runner/index.d.ts",
|
|
39
|
+
"import": "./dist/runner/index.js"
|
|
40
|
+
},
|
|
41
|
+
"./generator": {
|
|
42
|
+
"types": "./dist/generator/index.d.ts",
|
|
43
|
+
"import": "./dist/generator/index.js"
|
|
44
|
+
},
|
|
45
|
+
"./diff": {
|
|
46
|
+
"types": "./dist/diff/index.d.ts",
|
|
47
|
+
"import": "./dist/diff/index.js"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"files": [
|
|
51
|
+
"dist"
|
|
52
|
+
],
|
|
53
|
+
"keywords": [
|
|
54
|
+
"tango",
|
|
55
|
+
"migrations",
|
|
56
|
+
"database",
|
|
57
|
+
"orm"
|
|
58
|
+
],
|
|
59
|
+
"author": "Pedro Del Moral Lopez",
|
|
60
|
+
"license": "MIT",
|
|
61
|
+
"repository": {
|
|
62
|
+
"type": "git",
|
|
63
|
+
"url": "https://github.com/danceroutine/tango.git",
|
|
64
|
+
"directory": "packages/migrations"
|
|
65
|
+
},
|
|
66
|
+
"dependencies": {
|
|
67
|
+
"jiti": "^2.6.1",
|
|
68
|
+
"kleur": "^4.1.5",
|
|
69
|
+
"yargs": "^17.7.2",
|
|
70
|
+
"@danceroutine/tango-config": "1.0.0",
|
|
71
|
+
"@danceroutine/tango-core": "1.0.0"
|
|
72
|
+
},
|
|
73
|
+
"peerDependencies": {
|
|
74
|
+
"pg": "^8.13.1",
|
|
75
|
+
"better-sqlite3": "^11.7.0"
|
|
76
|
+
},
|
|
77
|
+
"peerDependenciesMeta": {
|
|
78
|
+
"pg": {
|
|
79
|
+
"optional": true
|
|
80
|
+
},
|
|
81
|
+
"better-sqlite3": {
|
|
82
|
+
"optional": true
|
|
100
83
|
}
|
|
101
|
-
}
|
|
84
|
+
},
|
|
85
|
+
"devDependencies": {
|
|
86
|
+
"@types/better-sqlite3": "^7.6.12",
|
|
87
|
+
"@types/node": "^22.9.0",
|
|
88
|
+
"@types/pg": "^8.11.10",
|
|
89
|
+
"@types/yargs": "^17.0.33",
|
|
90
|
+
"better-sqlite3": "^11.7.0",
|
|
91
|
+
"pg": "^8.13.1",
|
|
92
|
+
"tsdown": "^0.4.0",
|
|
93
|
+
"typescript": "^5.6.3",
|
|
94
|
+
"vitest": "^4.0.6",
|
|
95
|
+
"@danceroutine/tango-testing": "1.0.0",
|
|
96
|
+
"@danceroutine/tango-orm": "1.0.0"
|
|
97
|
+
},
|
|
98
|
+
"scripts": {
|
|
99
|
+
"build": "tsdown",
|
|
100
|
+
"test": "vitest run --coverage",
|
|
101
|
+
"test:integration": "vitest run src/tests/integration",
|
|
102
|
+
"test:watch": "vitest",
|
|
103
|
+
"typecheck": "pnpm run typecheck:prod && pnpm run typecheck:test",
|
|
104
|
+
"typecheck:prod": "tsc --noEmit -p tsconfig.json",
|
|
105
|
+
"typecheck:test": "tsc --noEmit -p tsconfig.tests.json"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CollectingBuilder-C6qnwyrb.js","names":["value: unknown","fn: (ctx: { query(sql: string, params?: readonly unknown[]): Promise<void> }) => Promise<void>","o: { mode?: MigrationMode }"],"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';\nexport class CollectingBuilder implements Builder {\n static readonly BRAND = 'tango.migrations.collecting_builder' as const;\n private mode?: MigrationMode;\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\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 run(...ops: MigrationOperation[]): void {\n this.ops.push(...ops);\n }\n\n data(fn: (ctx: { query(sql: string, params?: readonly unknown[]): Promise<void> }) => Promise<void>): void {\n this.dataFns.push(fn);\n }\n\n options(o: { mode?: MigrationMode }): void {\n this.mode = o.mode;\n }\n\n getMode(): MigrationMode | undefined {\n return this.mode;\n }\n}\n"],"mappings":";;IAGa,oBAAN,MAAM,kBAAqC;CAC9C,OAAgB,QAAQ;CACxB;CACA,eAAwD,kBAAkB;CAC1E,MAA4B,CAAE;CAC9B,UAA6G,CAAE;CAE/G,OAAO,oBAAoBA,OAA4C;AACnE,gBACW,UAAU,YACjB,UAAU,QACT,MAAqC,iBAAiB,kBAAkB;CAEhF;CAED,IAAI,GAAG,KAAiC;AACpC,OAAK,IAAI,KAAK,GAAG,IAAI;CACxB;CAED,KAAKC,IAAsG;AACvG,OAAK,QAAQ,KAAK,GAAG;CACxB;CAED,QAAQC,GAAmC;AACvC,OAAK,OAAO,EAAE;CACjB;CAED,UAAqC;AACjC,SAAO,KAAK;CACf;AACJ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CompilerStrategy-Cv1woBmO.js","names":["factories: CompilerFactoryRegistry","value: unknown","dialect: Dialect","operation: MigrationOperation","name: TName","handler: (dialect: Dialect, op: CustomMigrationOperation<TName, TArgs>) => SQL[]"],"sources":["../src/domain/internal/InternalDialect.ts","../src/strategies/CompilerStrategy.ts"],"sourcesContent":["export enum InternalDialect {\n POSTGRES = 'postgres',\n SQLITE = 'sqlite',\n}\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\nexport class CompilerStrategy {\n static readonly BRAND = 'tango.migrations.compiler_strategy' as const;\n private readonly compilerCache = new Map<Dialect, SQLCompiler>();\n private readonly customHandlers = new Map<string, (dialect: Dialect, op: CustomMigrationOperation) => SQL[]>();\n readonly __tangoBrand: typeof CompilerStrategy.BRAND = CompilerStrategy.BRAND;\n\n constructor(private readonly factories: CompilerFactoryRegistry) {}\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 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 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 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\nexport function createDefaultCompilerStrategy(): CompilerStrategy {\n return new CompilerStrategy({\n [InternalDialect.POSTGRES]: new PostgresCompilerFactory(),\n [InternalDialect.SQLITE]: new SqliteCompilerFactory(),\n });\n}\n"],"mappings":";;;IAAY,kBAAA,SAAA,mBAAL;AACH,mBAAA,cAAA;AACA,mBAAA,YAAA;AAAA,QAAA;AACH,EAAA,CAAA,EAAA;;;;ICQY,mBAAN,MAAM,iBAAiB;CAC1B,OAAgB,QAAQ;CACxB,gBAAiC,IAAI;CACrC,iBAAkC,IAAI;CACtC,eAAuD,iBAAiB;CAExE,YAA6BA,WAAoC;AAAA,OAApC,YAAA;CAAsC;CAEnE,OAAO,mBAAmBC,OAA2C;AACjE,gBACW,UAAU,YACjB,UAAU,QACT,MAAqC,iBAAiB,iBAAiB;CAE/E;CAED,QAAQC,SAAkBC,WAAsC;AAC5D,MAAI,UAAU,SAAS,UAAU;GAC7B,MAAM,UAAU,KAAK,eAAe,IAAI,UAAU,KAAK;AACvD,QAAK,QACD,OAAM,IAAI,OAAO,mCAAmC,UAAU,KAAK;AAEvE,UAAO,QAAQ,SAAS,UAAU;EACrC;EACD,MAAM,WAAW,KAAK,YAAY,QAAQ;AAC1C,SAAO,SAAS,QAAQ,UAAU;CACrC;CAED,sBACIC,MACAC,SACI;AACJ,OAAK,eAAe,IAAI,MAAM,QAAqE;AACnG,SAAO;CACV;CAED,YAAYH,SAA+B;EACvC,MAAM,SAAS,KAAK,cAAc,IAAI,QAAQ;AAC9C,MAAI,OACA,QAAO;EAGX,MAAM,UAAU,KAAK,UAAU;AAC/B,OAAK,QACD,OAAM,IAAI,OAAO,kDAAkD,OAAO,QAAQ,CAAC;EAEvF,MAAM,WAAW,QAAQ,QAAQ;AACjC,OAAK,cAAc,IAAI,SAAS,SAAS;AACzC,SAAO;CACV;AACJ;AAEM,SAAS,gCAAkD;AAC9D,QAAO,IAAI,iBAAiB;GACvB,gBAAgB,WAAW,IAAI;GAC/B,gBAAgB,SAAS,IAAI;CACjC;AACJ"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/domain/internal/InternalColumnType.ts
|
|
3
|
-
let InternalColumnType = function(InternalColumnType$1) {
|
|
4
|
-
InternalColumnType$1["SERIAL"] = "serial";
|
|
5
|
-
InternalColumnType$1["INT"] = "int";
|
|
6
|
-
InternalColumnType$1["BIGINT"] = "bigint";
|
|
7
|
-
InternalColumnType$1["TEXT"] = "text";
|
|
8
|
-
InternalColumnType$1["BOOL"] = "bool";
|
|
9
|
-
InternalColumnType$1["TIMESTAMPTZ"] = "timestamptz";
|
|
10
|
-
InternalColumnType$1["JSONB"] = "jsonb";
|
|
11
|
-
InternalColumnType$1["UUID"] = "uuid";
|
|
12
|
-
return InternalColumnType$1;
|
|
13
|
-
}({});
|
|
14
|
-
|
|
15
|
-
//#endregion
|
|
16
|
-
export { InternalColumnType };
|
|
17
|
-
//# sourceMappingURL=InternalColumnType-_YAz7RqI.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InternalColumnType-_YAz7RqI.js","names":[],"sources":["../src/domain/internal/InternalColumnType.ts"],"sourcesContent":["export enum 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}\n"],"mappings":";;IAAY,qBAAA,SAAA,sBAAL;AACH,sBAAA,YAAA;AACA,sBAAA,SAAA;AACA,sBAAA,YAAA;AACA,sBAAA,UAAA;AACA,sBAAA,UAAA;AACA,sBAAA,iBAAA;AACA,sBAAA,WAAA;AACA,sBAAA,UAAA;AAAA,QAAA;AACH,EAAA,CAAA,EAAA"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/domain/internal/InternalOperationKind.ts
|
|
3
|
-
let InternalOperationKind = function(InternalOperationKind$1) {
|
|
4
|
-
InternalOperationKind$1["TABLE_CREATE"] = "table.create";
|
|
5
|
-
InternalOperationKind$1["TABLE_DROP"] = "table.drop";
|
|
6
|
-
InternalOperationKind$1["COLUMN_ADD"] = "column.add";
|
|
7
|
-
InternalOperationKind$1["COLUMN_DROP"] = "column.drop";
|
|
8
|
-
InternalOperationKind$1["COLUMN_ALTER"] = "column.alter";
|
|
9
|
-
InternalOperationKind$1["COLUMN_RENAME"] = "column.rename";
|
|
10
|
-
InternalOperationKind$1["INDEX_CREATE"] = "index.create";
|
|
11
|
-
InternalOperationKind$1["INDEX_DROP"] = "index.drop";
|
|
12
|
-
InternalOperationKind$1["FK_CREATE"] = "fk.create";
|
|
13
|
-
InternalOperationKind$1["FK_VALIDATE"] = "fk.validate";
|
|
14
|
-
InternalOperationKind$1["FK_DROP"] = "fk.drop";
|
|
15
|
-
return InternalOperationKind$1;
|
|
16
|
-
}({});
|
|
17
|
-
|
|
18
|
-
//#endregion
|
|
19
|
-
export { InternalOperationKind };
|
|
20
|
-
//# sourceMappingURL=InternalOperationKind-BPVoOQwD.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InternalOperationKind-BPVoOQwD.js","names":[],"sources":["../src/domain/internal/InternalOperationKind.ts"],"sourcesContent":["export enum 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}\n"],"mappings":";;IAAY,wBAAA,SAAA,yBAAL;AACH,yBAAA,kBAAA;AACA,yBAAA,gBAAA;AACA,yBAAA,gBAAA;AACA,yBAAA,iBAAA;AACA,yBAAA,kBAAA;AACA,yBAAA,mBAAA;AACA,yBAAA,kBAAA;AACA,yBAAA,gBAAA;AACA,yBAAA,eAAA;AACA,yBAAA,iBAAA;AACA,yBAAA,aAAA;AAAA,QAAA;AACH,EAAA,CAAA,EAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IntrospectorStrategy-BM1Eizfc.js","names":["factories: IntrospectorFactoryRegistry","value: unknown","dialect: Dialect","client: DBClient"],"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>;\nexport class IntrospectorStrategy {\n static readonly BRAND = 'tango.migrations.introspector_strategy' as const;\n private readonly introspectorCache = new Map<Dialect, DatabaseIntrospector>();\n readonly __tangoBrand: typeof IntrospectorStrategy.BRAND = IntrospectorStrategy.BRAND;\n\n constructor(private readonly factories: IntrospectorFactoryRegistry) {}\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 introspect(dialect: Dialect, client: DBClient): Promise<DbSchema> {\n const introspector = this.getIntrospector(dialect);\n return introspector.introspect(client);\n }\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\nexport function createDefaultIntrospectorStrategy(): IntrospectorStrategy {\n return new IntrospectorStrategy({\n [InternalDialect.POSTGRES]: { create: () => new PostgresIntrospector() },\n [InternalDialect.SQLITE]: { create: () => new SqliteIntrospector() },\n });\n}\n"],"mappings":";;;;IAYa,uBAAN,MAAM,qBAAqB;CAC9B,OAAgB,QAAQ;CACxB,oBAAqC,IAAI;CACzC,eAA2D,qBAAqB;CAEhF,YAA6BA,WAAwC;AAAA,OAAxC,YAAA;CAA0C;CAEvE,OAAO,uBAAuBC,OAA+C;AACzE,gBACW,UAAU,YACjB,UAAU,QACT,MAAqC,iBAAiB,qBAAqB;CAEnF;CAED,WAAWC,SAAkBC,QAAqC;EAC9D,MAAM,eAAe,KAAK,gBAAgB,QAAQ;AAClD,SAAO,aAAa,WAAW,OAAO;CACzC;CAED,gBAAgBD,SAAwC;EACpD,MAAM,SAAS,KAAK,kBAAkB,IAAI,QAAQ;AAClD,MAAI,OACA,QAAO;EAGX,MAAM,UAAU,KAAK,UAAU;AAC/B,OAAK,QACD,OAAM,IAAI,OAAO,2DAA2D,OAAO,QAAQ,CAAC;EAGhG,MAAM,eAAe,QAAQ,QAAQ;AACrC,OAAK,kBAAkB,IAAI,SAAS,aAAa;AACjD,SAAO;CACV;AACJ;AAEM,SAAS,oCAA0D;AACtE,QAAO,IAAI,qBAAqB;GAC3B,gBAAgB,WAAW,EAAE,QAAQ,MAAM,IAAI,uBAAwB;GACvE,gBAAgB,SAAS,EAAE,QAAQ,MAAM,IAAI,qBAAsB;CACvE;AACJ"}
|