drizzle-kit 0.20.17-c8aaf94 → 0.20.17-f1d07ae
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/@types/utils.d.ts +0 -1
- package/bin.cjs +14444 -24287
- package/cli/commands/migrate.d.ts +2 -2
- package/cli/commands/pgIntrospect.d.ts +1 -1
- package/cli/commands/utils.d.ts +2 -2
- package/cli/validations/cli.d.ts +22 -22
- package/cli/validations/common.d.ts +13 -13
- package/cli/validations/outputs.d.ts +2 -1
- package/cli/views.d.ts +0 -1
- package/index.d.mts +48 -2
- package/index.d.ts +48 -2
- package/package.json +1 -2
- package/payload.js +55 -75
- package/payload.mjs +55 -75
- package/schemaValidator.d.ts +7 -7
- package/serializer/pgSchema.d.ts +14 -14
- package/serializer/studio.d.ts +1 -1
- package/snapshotsDiffer.d.ts +2 -1
- package/utils-studio.js +8 -11
- package/utils-studio.mjs +8 -11
- package/utils.js +5 -5
- package/utils.mjs +5 -5
package/payload.mjs
CHANGED
|
@@ -4701,7 +4701,7 @@ var init_pgSchema = __esm({
|
|
|
4701
4701
|
}).strict();
|
|
4702
4702
|
pgSchemaInternal = objectType({
|
|
4703
4703
|
version: literalType("6"),
|
|
4704
|
-
dialect: literalType("
|
|
4704
|
+
dialect: literalType("pg"),
|
|
4705
4705
|
tables: recordType(stringType(), table2),
|
|
4706
4706
|
enums: recordType(stringType(), enumSchema),
|
|
4707
4707
|
schemas: recordType(stringType(), stringType()),
|
|
@@ -4730,14 +4730,14 @@ var init_pgSchema = __esm({
|
|
|
4730
4730
|
}).strict();
|
|
4731
4731
|
pgSchemaSquashedV4 = objectType({
|
|
4732
4732
|
version: literalType("4"),
|
|
4733
|
-
dialect:
|
|
4733
|
+
dialect: enumType(["pg"]),
|
|
4734
4734
|
tables: recordType(stringType(), tableSquashedV42),
|
|
4735
4735
|
enums: recordType(stringType(), enumSchemaV1),
|
|
4736
4736
|
schemas: recordType(stringType(), stringType())
|
|
4737
4737
|
}).strict();
|
|
4738
4738
|
pgSchemaSquashed = objectType({
|
|
4739
4739
|
version: literalType("6"),
|
|
4740
|
-
dialect:
|
|
4740
|
+
dialect: enumType(["pg"]),
|
|
4741
4741
|
tables: recordType(stringType(), tableSquashed2),
|
|
4742
4742
|
enums: recordType(stringType(), enumSchema),
|
|
4743
4743
|
schemas: recordType(stringType(), stringType())
|
|
@@ -4848,7 +4848,7 @@ var init_pgSchema = __esm({
|
|
|
4848
4848
|
};
|
|
4849
4849
|
dryPg = pgSchema.parse({
|
|
4850
4850
|
version: snapshotVersion,
|
|
4851
|
-
dialect: "
|
|
4851
|
+
dialect: "pg",
|
|
4852
4852
|
id: originUUID,
|
|
4853
4853
|
prevId: "",
|
|
4854
4854
|
tables: {},
|
|
@@ -5311,8 +5311,7 @@ var init_outputs = __esm({
|
|
|
5311
5311
|
warning: (str) => `${source_default.white.bgGray(" Warning ")} ${str}`,
|
|
5312
5312
|
errorWarning: (str) => `${source_default.red(`${source_default.white.bgRed(" Warning ")} ${str}`)}`,
|
|
5313
5313
|
fullWarning: (str) => `${source_default.black.bgYellow("[Warning]")} ${source_default.bold(str)}`,
|
|
5314
|
-
suggestion: (str) => `${source_default.white.bgGray(" Suggestion ")} ${str}
|
|
5315
|
-
info: (str) => `${source_default.grey(str)}`
|
|
5314
|
+
suggestion: (str) => `${source_default.white.bgGray(" Suggestion ")} ${str}`
|
|
5316
5315
|
};
|
|
5317
5316
|
}
|
|
5318
5317
|
});
|
|
@@ -5397,7 +5396,7 @@ var init_schemaValidator = __esm({
|
|
|
5397
5396
|
init_mysqlSchema();
|
|
5398
5397
|
init_pgSchema();
|
|
5399
5398
|
init_sqliteSchema();
|
|
5400
|
-
dialect3 = enumType(["
|
|
5399
|
+
dialect3 = enumType(["pg", "mysql", "sqlite"]);
|
|
5401
5400
|
commonSquashedSchema = unionType([
|
|
5402
5401
|
pgSchemaSquashed,
|
|
5403
5402
|
mysqlSchemaSquashed,
|
|
@@ -5517,8 +5516,8 @@ var init_cli = __esm({
|
|
|
5517
5516
|
dialect: dialect3,
|
|
5518
5517
|
schema: unionType([stringType(), stringType().array()]).optional(),
|
|
5519
5518
|
tablesFilter: unionType([stringType(), stringType().array()]).optional(),
|
|
5520
|
-
|
|
5521
|
-
driver: stringType()
|
|
5519
|
+
schemaFilters: unionType([stringType(), stringType().array()]).optional().default(["public"]),
|
|
5520
|
+
driver: stringType(),
|
|
5522
5521
|
// pg
|
|
5523
5522
|
connectionString: stringType().optional(),
|
|
5524
5523
|
// mysql
|
|
@@ -5556,7 +5555,7 @@ var init_cli = __esm({
|
|
|
5556
5555
|
authToken: stringType().optional(),
|
|
5557
5556
|
introspectCasing: casing,
|
|
5558
5557
|
breakpoints: booleanType().optional().default(true)
|
|
5559
|
-
})
|
|
5558
|
+
});
|
|
5560
5559
|
configCheck = objectType({
|
|
5561
5560
|
dialect: dialect3.optional(),
|
|
5562
5561
|
out: stringType().optional()
|
|
@@ -11516,7 +11515,7 @@ ${withStyle.errorWarning(
|
|
|
11516
11515
|
);
|
|
11517
11516
|
return {
|
|
11518
11517
|
version: "6",
|
|
11519
|
-
dialect: "
|
|
11518
|
+
dialect: "pg",
|
|
11520
11519
|
tables: result,
|
|
11521
11520
|
enums: enumsToReturn,
|
|
11522
11521
|
schemas: schemasObject,
|
|
@@ -11723,7 +11722,7 @@ ${withStyle.errorWarning(
|
|
|
11723
11722
|
const columnName = columnResponse.attname;
|
|
11724
11723
|
const columnAdditionalDT = columnResponse.additional_dt;
|
|
11725
11724
|
const columnDimensions = columnResponse.array_dimensions;
|
|
11726
|
-
const
|
|
11725
|
+
const enumType2 = columnResponse.enum_name;
|
|
11727
11726
|
let columnType = columnResponse.data_type;
|
|
11728
11727
|
const primaryKey = tableConstraints.filter(
|
|
11729
11728
|
(mapRow) => columnName === mapRow.column_name && mapRow.constraint_type === "PRIMARY KEY"
|
|
@@ -11787,8 +11786,8 @@ ${withStyle.errorWarning(
|
|
|
11787
11786
|
columnTypeMapped = trimChar(columnTypeMapped, '"');
|
|
11788
11787
|
columnToReturn[columnName] = {
|
|
11789
11788
|
name: columnName,
|
|
11790
|
-
type: columnAdditionalDT === "USER-DEFINED" ?
|
|
11791
|
-
typeSchema: enumsToReturn[`${tableSchema}.${
|
|
11789
|
+
type: columnAdditionalDT === "USER-DEFINED" ? enumType2 : columnTypeMapped,
|
|
11790
|
+
typeSchema: enumsToReturn[`${tableSchema}.${enumType2}`] !== void 0 ? enumsToReturn[`${tableSchema}.${enumType2}`].schema : void 0,
|
|
11792
11791
|
primaryKey: primaryKey.length === 1 && cprimaryKey.length < 2,
|
|
11793
11792
|
// default: isSerial ? undefined : defaultValue,
|
|
11794
11793
|
notNull: columnResponse.is_nullable === "NO"
|
|
@@ -11871,7 +11870,7 @@ ${withStyle.errorWarning(
|
|
|
11871
11870
|
const schemasObject = Object.fromEntries([...schemas].map((it) => [it, it]));
|
|
11872
11871
|
return {
|
|
11873
11872
|
version: "6",
|
|
11874
|
-
dialect: "
|
|
11873
|
+
dialect: "pg",
|
|
11875
11874
|
tables: result,
|
|
11876
11875
|
enums: enumsToReturn,
|
|
11877
11876
|
schemas: schemasObject,
|
|
@@ -15102,7 +15101,7 @@ var init_snapshotsDiffer = __esm({
|
|
|
15102
15101
|
const jsonTableAlternations = alteredTables.map((it) => {
|
|
15103
15102
|
return preparePgAlterColumns(it.name, it.schema, it.altered, json2);
|
|
15104
15103
|
}).flat();
|
|
15105
|
-
const
|
|
15104
|
+
const jsonCreateIndexesForAllAlteredTables = alteredTables.map((it) => {
|
|
15106
15105
|
return prepareCreateIndexesJson(
|
|
15107
15106
|
it.name,
|
|
15108
15107
|
it.schema,
|
|
@@ -15131,21 +15130,14 @@ var init_snapshotsDiffer = __esm({
|
|
|
15131
15130
|
},
|
|
15132
15131
|
{}
|
|
15133
15132
|
);
|
|
15134
|
-
|
|
15133
|
+
jsonCreateIndexesForAllAlteredTables.push(
|
|
15135
15134
|
...prepareCreateIndexesJson(it.name, it.schema, createdIndexes || {})
|
|
15136
15135
|
);
|
|
15137
15136
|
jsonDropIndexesForAllAlteredTables.push(
|
|
15138
15137
|
...prepareDropIndexesJson(it.name, it.schema, droppedIndexes || {})
|
|
15139
15138
|
);
|
|
15140
15139
|
});
|
|
15141
|
-
const
|
|
15142
|
-
return prepareCreateReferencesJson(
|
|
15143
|
-
it.name,
|
|
15144
|
-
it.schema,
|
|
15145
|
-
it.foreignKeys
|
|
15146
|
-
);
|
|
15147
|
-
}).flat();
|
|
15148
|
-
const jsonReferencesForAlteredTables = alteredTables.map((it) => {
|
|
15140
|
+
const jsonReferencesForAllAlteredTables = alteredTables.map((it) => {
|
|
15149
15141
|
const forAdded = prepareCreateReferencesJson(
|
|
15150
15142
|
it.name,
|
|
15151
15143
|
it.schema,
|
|
@@ -15163,10 +15155,10 @@ var init_snapshotsDiffer = __esm({
|
|
|
15163
15155
|
);
|
|
15164
15156
|
return [...forAdded, ...forAltered, ...alteredFKs];
|
|
15165
15157
|
}).flat();
|
|
15166
|
-
const jsonCreatedReferencesForAlteredTables =
|
|
15158
|
+
const jsonCreatedReferencesForAlteredTables = jsonReferencesForAllAlteredTables.filter(
|
|
15167
15159
|
(t) => t.type === "create_reference"
|
|
15168
15160
|
);
|
|
15169
|
-
const jsonDroppedReferencesForAlteredTables =
|
|
15161
|
+
const jsonDroppedReferencesForAlteredTables = jsonReferencesForAllAlteredTables.filter(
|
|
15170
15162
|
(t) => t.type === "delete_reference"
|
|
15171
15163
|
);
|
|
15172
15164
|
const createEnums = createdEnums.map((it) => {
|
|
@@ -15193,7 +15185,7 @@ var init_snapshotsDiffer = __esm({
|
|
|
15193
15185
|
const dropSchemas = prepareDeleteSchemasJson(
|
|
15194
15186
|
deletedSchemas.map((it) => it.name)
|
|
15195
15187
|
);
|
|
15196
|
-
const
|
|
15188
|
+
const jsonPgCreateTables = createdTables.map((it) => {
|
|
15197
15189
|
return preparePgCreateTableJson(it, curFull);
|
|
15198
15190
|
});
|
|
15199
15191
|
jsonStatements.push(...createSchemas);
|
|
@@ -15202,7 +15194,7 @@ var init_snapshotsDiffer = __esm({
|
|
|
15202
15194
|
jsonStatements.push(...moveEnums);
|
|
15203
15195
|
jsonStatements.push(...renameEnums);
|
|
15204
15196
|
jsonStatements.push(...jsonAlterEnumsWithAddedValues);
|
|
15205
|
-
jsonStatements.push(...
|
|
15197
|
+
jsonStatements.push(...jsonPgCreateTables);
|
|
15206
15198
|
jsonStatements.push(...jsonDropTables);
|
|
15207
15199
|
jsonStatements.push(...jsonSetTableSchemas);
|
|
15208
15200
|
jsonStatements.push(...jsonRenameTables);
|
|
@@ -15213,16 +15205,15 @@ var init_snapshotsDiffer = __esm({
|
|
|
15213
15205
|
jsonStatements.push(...jsonTableAlternations);
|
|
15214
15206
|
jsonStatements.push(...jsonAddedCompositePKs);
|
|
15215
15207
|
jsonStatements.push(...jsonAddColumnsStatemets);
|
|
15216
|
-
jsonStatements.push(...jsonCreateReferencesForCreatedTables);
|
|
15217
15208
|
jsonStatements.push(...jsonCreateIndexesForCreatedTables);
|
|
15209
|
+
jsonStatements.push(...jsonCreateIndexesForAllAlteredTables);
|
|
15218
15210
|
jsonStatements.push(...jsonCreatedReferencesForAlteredTables);
|
|
15219
|
-
jsonStatements.push(...jsonCreateIndexesFoAlteredTables);
|
|
15220
15211
|
jsonStatements.push(...jsonDropColumnsStatemets);
|
|
15221
15212
|
jsonStatements.push(...jsonAlteredCompositePKs);
|
|
15222
15213
|
jsonStatements.push(...jsonAlteredUniqueConstraints);
|
|
15223
15214
|
jsonStatements.push(...dropEnums);
|
|
15224
15215
|
jsonStatements.push(...dropSchemas);
|
|
15225
|
-
const sqlStatements = fromJson(jsonStatements, "
|
|
15216
|
+
const sqlStatements = fromJson(jsonStatements, "pg");
|
|
15226
15217
|
const uniqueSqlStatements = [];
|
|
15227
15218
|
sqlStatements.forEach((ss) => {
|
|
15228
15219
|
if (!uniqueSqlStatements.includes(ss)) {
|
|
@@ -15360,8 +15351,8 @@ var init_snapshotsDiffer = __esm({
|
|
|
15360
15351
|
const jsonDeletedUniqueConstraints = [];
|
|
15361
15352
|
const jsonAlteredUniqueConstraints = [];
|
|
15362
15353
|
const jsonRenameColumnsStatements = columnRenames.map((it) => prepareRenameColumns(it.table, "", it.renames)).flat();
|
|
15363
|
-
const jsonAddColumnsStatemets = columnCreates.map((it) => _prepareAddColumns(it.table, "", it.columns)).flat();
|
|
15364
15354
|
const jsonDropColumnsStatemets = columnDeletes.map((it) => _prepareDropColumns(it.table, "", it.columns)).flat();
|
|
15355
|
+
const jsonAddColumnsStatemets = columnDeletes.map((it) => _prepareAddColumns(it.table, "", it.columns)).flat();
|
|
15365
15356
|
alteredTables.forEach((it) => {
|
|
15366
15357
|
let addedColumns = [];
|
|
15367
15358
|
for (const addedPkName of Object.keys(it.addedCompositePKs)) {
|
|
@@ -15475,13 +15466,6 @@ var init_snapshotsDiffer = __esm({
|
|
|
15475
15466
|
...prepareDropIndexesJson(it.name, it.schema, droppedIndexes || {})
|
|
15476
15467
|
);
|
|
15477
15468
|
});
|
|
15478
|
-
const jsonCreateReferencesForCreatedTables = createdTables.map((it) => {
|
|
15479
|
-
return prepareCreateReferencesJson(
|
|
15480
|
-
it.name,
|
|
15481
|
-
it.schema,
|
|
15482
|
-
it.foreignKeys
|
|
15483
|
-
);
|
|
15484
|
-
}).flat();
|
|
15485
15469
|
const jsonReferencesForAllAlteredTables = alteredTables.map((it) => {
|
|
15486
15470
|
const forAdded = prepareCreateReferencesJson(
|
|
15487
15471
|
it.name,
|
|
@@ -15522,10 +15506,9 @@ var init_snapshotsDiffer = __esm({
|
|
|
15522
15506
|
jsonStatements.push(...jsonAddedUniqueConstraints);
|
|
15523
15507
|
jsonStatements.push(...jsonDeletedUniqueConstraints);
|
|
15524
15508
|
jsonStatements.push(...jsonAddColumnsStatemets);
|
|
15525
|
-
jsonStatements.push(...jsonCreateReferencesForCreatedTables);
|
|
15526
15509
|
jsonStatements.push(...jsonCreateIndexesForCreatedTables);
|
|
15527
|
-
jsonStatements.push(...jsonCreatedReferencesForAlteredTables);
|
|
15528
15510
|
jsonStatements.push(...jsonCreateIndexesForAllAlteredTables);
|
|
15511
|
+
jsonStatements.push(...jsonCreatedReferencesForAlteredTables);
|
|
15529
15512
|
jsonStatements.push(...jsonDropColumnsStatemets);
|
|
15530
15513
|
jsonStatements.push(...jsonAlteredCompositePKs);
|
|
15531
15514
|
jsonStatements.push(...jsonAddedUniqueConstraints);
|
|
@@ -16110,7 +16093,7 @@ var init_sqlgenerator = __esm({
|
|
|
16110
16093
|
};
|
|
16111
16094
|
PgCreateTableConvertor = class extends Convertor {
|
|
16112
16095
|
can(statement, dialect7) {
|
|
16113
|
-
return statement.type === "create_table" && dialect7 === "
|
|
16096
|
+
return statement.type === "create_table" && dialect7 === "pg";
|
|
16114
16097
|
}
|
|
16115
16098
|
convert(st) {
|
|
16116
16099
|
const { tableName, schema: schema4, columns, compositePKs, uniqueConstraints } = st;
|
|
@@ -16252,7 +16235,7 @@ var init_sqlgenerator = __esm({
|
|
|
16252
16235
|
};
|
|
16253
16236
|
PgAlterTableAddUniqueConstraintConvertor = class extends Convertor {
|
|
16254
16237
|
can(statement, dialect7) {
|
|
16255
|
-
return statement.type === "create_unique_constraint" && dialect7 === "
|
|
16238
|
+
return statement.type === "create_unique_constraint" && dialect7 === "pg";
|
|
16256
16239
|
}
|
|
16257
16240
|
convert(statement) {
|
|
16258
16241
|
const unsquashed = PgSquasher.unsquashUnique(statement.data);
|
|
@@ -16262,7 +16245,7 @@ var init_sqlgenerator = __esm({
|
|
|
16262
16245
|
};
|
|
16263
16246
|
PgAlterTableDropUniqueConstraintConvertor = class extends Convertor {
|
|
16264
16247
|
can(statement, dialect7) {
|
|
16265
|
-
return statement.type === "delete_unique_constraint" && dialect7 === "
|
|
16248
|
+
return statement.type === "delete_unique_constraint" && dialect7 === "pg";
|
|
16266
16249
|
}
|
|
16267
16250
|
convert(statement) {
|
|
16268
16251
|
const unsquashed = PgSquasher.unsquashUnique(statement.data);
|
|
@@ -16351,7 +16334,7 @@ var init_sqlgenerator = __esm({
|
|
|
16351
16334
|
};
|
|
16352
16335
|
PgDropTableConvertor = class extends Convertor {
|
|
16353
16336
|
can(statement, dialect7) {
|
|
16354
|
-
return statement.type === "drop_table" && dialect7 === "
|
|
16337
|
+
return statement.type === "drop_table" && dialect7 === "pg";
|
|
16355
16338
|
}
|
|
16356
16339
|
convert(statement) {
|
|
16357
16340
|
const { tableName, schema: schema4 } = statement;
|
|
@@ -16379,7 +16362,7 @@ var init_sqlgenerator = __esm({
|
|
|
16379
16362
|
};
|
|
16380
16363
|
PgRenameTableConvertor = class extends Convertor {
|
|
16381
16364
|
can(statement, dialect7) {
|
|
16382
|
-
return statement.type === "rename_table" && dialect7 === "
|
|
16365
|
+
return statement.type === "rename_table" && dialect7 === "pg";
|
|
16383
16366
|
}
|
|
16384
16367
|
convert(statement) {
|
|
16385
16368
|
const { tableNameFrom, tableNameTo, toSchema, fromSchema } = statement;
|
|
@@ -16410,7 +16393,7 @@ var init_sqlgenerator = __esm({
|
|
|
16410
16393
|
};
|
|
16411
16394
|
PgAlterTableRenameColumnConvertor = class extends Convertor {
|
|
16412
16395
|
can(statement, dialect7) {
|
|
16413
|
-
return statement.type === "alter_table_rename_column" && dialect7 === "
|
|
16396
|
+
return statement.type === "alter_table_rename_column" && dialect7 === "pg";
|
|
16414
16397
|
}
|
|
16415
16398
|
convert(statement) {
|
|
16416
16399
|
const { tableName, oldColumnName, newColumnName, schema: schema4 } = statement;
|
|
@@ -16438,7 +16421,7 @@ var init_sqlgenerator = __esm({
|
|
|
16438
16421
|
};
|
|
16439
16422
|
PgAlterTableDropColumnConvertor = class extends Convertor {
|
|
16440
16423
|
can(statement, dialect7) {
|
|
16441
|
-
return statement.type === "alter_table_drop_column" && dialect7 === "
|
|
16424
|
+
return statement.type === "alter_table_drop_column" && dialect7 === "pg";
|
|
16442
16425
|
}
|
|
16443
16426
|
convert(statement) {
|
|
16444
16427
|
const { tableName, columnName, schema: schema4 } = statement;
|
|
@@ -16466,7 +16449,7 @@ var init_sqlgenerator = __esm({
|
|
|
16466
16449
|
};
|
|
16467
16450
|
PgAlterTableAddColumnConvertor = class extends Convertor {
|
|
16468
16451
|
can(statement, dialect7) {
|
|
16469
|
-
return statement.type === "alter_table_add_column" && dialect7 === "
|
|
16452
|
+
return statement.type === "alter_table_add_column" && dialect7 === "pg";
|
|
16470
16453
|
}
|
|
16471
16454
|
convert(statement) {
|
|
16472
16455
|
const { tableName, column: column4, schema: schema4 } = statement;
|
|
@@ -16511,7 +16494,7 @@ var init_sqlgenerator = __esm({
|
|
|
16511
16494
|
};
|
|
16512
16495
|
PgAlterTableAlterColumnSetTypeConvertor = class extends Convertor {
|
|
16513
16496
|
can(statement, dialect7) {
|
|
16514
|
-
return statement.type === "alter_table_alter_column_set_type" && dialect7 === "
|
|
16497
|
+
return statement.type === "alter_table_alter_column_set_type" && dialect7 === "pg";
|
|
16515
16498
|
}
|
|
16516
16499
|
convert(statement) {
|
|
16517
16500
|
const { tableName, columnName, newDataType, schema: schema4 } = statement;
|
|
@@ -16536,7 +16519,7 @@ var init_sqlgenerator = __esm({
|
|
|
16536
16519
|
};
|
|
16537
16520
|
PgAlterTableAlterColumnSetDefaultConvertor = class extends Convertor {
|
|
16538
16521
|
can(statement, dialect7) {
|
|
16539
|
-
return statement.type === "alter_table_alter_column_set_default" && dialect7 === "
|
|
16522
|
+
return statement.type === "alter_table_alter_column_set_default" && dialect7 === "pg";
|
|
16540
16523
|
}
|
|
16541
16524
|
convert(statement) {
|
|
16542
16525
|
const { tableName, columnName, schema: schema4 } = statement;
|
|
@@ -16561,7 +16544,7 @@ var init_sqlgenerator = __esm({
|
|
|
16561
16544
|
};
|
|
16562
16545
|
PgAlterTableAlterColumnDropDefaultConvertor = class extends Convertor {
|
|
16563
16546
|
can(statement, dialect7) {
|
|
16564
|
-
return statement.type === "alter_table_alter_column_drop_default" && dialect7 === "
|
|
16547
|
+
return statement.type === "alter_table_alter_column_drop_default" && dialect7 === "pg";
|
|
16565
16548
|
}
|
|
16566
16549
|
convert(statement) {
|
|
16567
16550
|
const { tableName, columnName, schema: schema4 } = statement;
|
|
@@ -16673,7 +16656,7 @@ var init_sqlgenerator = __esm({
|
|
|
16673
16656
|
};
|
|
16674
16657
|
PgAlterTableCreateCompositePrimaryKeyConvertor = class extends Convertor {
|
|
16675
16658
|
can(statement, dialect7) {
|
|
16676
|
-
return statement.type === "create_composite_pk" && dialect7 === "
|
|
16659
|
+
return statement.type === "create_composite_pk" && dialect7 === "pg";
|
|
16677
16660
|
}
|
|
16678
16661
|
convert(statement) {
|
|
16679
16662
|
const { name, columns } = PgSquasher.unsquashPK(statement.data);
|
|
@@ -16683,7 +16666,7 @@ var init_sqlgenerator = __esm({
|
|
|
16683
16666
|
};
|
|
16684
16667
|
PgAlterTableDeleteCompositePrimaryKeyConvertor = class extends Convertor {
|
|
16685
16668
|
can(statement, dialect7) {
|
|
16686
|
-
return statement.type === "delete_composite_pk" && dialect7 === "
|
|
16669
|
+
return statement.type === "delete_composite_pk" && dialect7 === "pg";
|
|
16687
16670
|
}
|
|
16688
16671
|
convert(statement) {
|
|
16689
16672
|
const { name, columns } = PgSquasher.unsquashPK(statement.data);
|
|
@@ -16693,7 +16676,7 @@ var init_sqlgenerator = __esm({
|
|
|
16693
16676
|
};
|
|
16694
16677
|
PgAlterTableAlterCompositePrimaryKeyConvertor = class extends Convertor {
|
|
16695
16678
|
can(statement, dialect7) {
|
|
16696
|
-
return statement.type === "alter_composite_pk" && dialect7 === "
|
|
16679
|
+
return statement.type === "alter_composite_pk" && dialect7 === "pg";
|
|
16697
16680
|
}
|
|
16698
16681
|
convert(statement) {
|
|
16699
16682
|
const { name, columns } = PgSquasher.unsquashPK(statement.old);
|
|
@@ -16816,7 +16799,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
16816
16799
|
};
|
|
16817
16800
|
PgAlterTableAlterColumnSetPrimaryKeyConvertor = class extends Convertor {
|
|
16818
16801
|
can(statement, dialect7) {
|
|
16819
|
-
return statement.type === "alter_table_alter_column_set_pk" && dialect7 === "
|
|
16802
|
+
return statement.type === "alter_table_alter_column_set_pk" && dialect7 === "pg";
|
|
16820
16803
|
}
|
|
16821
16804
|
convert(statement) {
|
|
16822
16805
|
const { tableName, columnName } = statement;
|
|
@@ -16826,7 +16809,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
16826
16809
|
};
|
|
16827
16810
|
PgAlterTableAlterColumnDropPrimaryKeyConvertor = class extends Convertor {
|
|
16828
16811
|
can(statement, dialect7) {
|
|
16829
|
-
return statement.type === "alter_table_alter_column_drop_pk" && dialect7 === "
|
|
16812
|
+
return statement.type === "alter_table_alter_column_drop_pk" && dialect7 === "pg";
|
|
16830
16813
|
}
|
|
16831
16814
|
convert(statement) {
|
|
16832
16815
|
const { tableName, columnName, schema: schema4 } = statement;
|
|
@@ -16850,7 +16833,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
16850
16833
|
};
|
|
16851
16834
|
PgAlterTableAlterColumnSetNotNullConvertor = class extends Convertor {
|
|
16852
16835
|
can(statement, dialect7) {
|
|
16853
|
-
return statement.type === "alter_table_alter_column_set_notnull" && dialect7 === "
|
|
16836
|
+
return statement.type === "alter_table_alter_column_set_notnull" && dialect7 === "pg";
|
|
16854
16837
|
}
|
|
16855
16838
|
convert(statement) {
|
|
16856
16839
|
const { tableName, columnName } = statement;
|
|
@@ -16905,7 +16888,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
16905
16888
|
};
|
|
16906
16889
|
PgAlterTableAlterColumnDropNotNullConvertor = class extends Convertor {
|
|
16907
16890
|
can(statement, dialect7) {
|
|
16908
|
-
return statement.type === "alter_table_alter_column_drop_notnull" && dialect7 === "
|
|
16891
|
+
return statement.type === "alter_table_alter_column_drop_notnull" && dialect7 === "pg";
|
|
16909
16892
|
}
|
|
16910
16893
|
convert(statement) {
|
|
16911
16894
|
const { tableName, columnName } = statement;
|
|
@@ -16930,7 +16913,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
16930
16913
|
};
|
|
16931
16914
|
PgCreateForeignKeyConvertor = class extends Convertor {
|
|
16932
16915
|
can(statement, dialect7) {
|
|
16933
|
-
return statement.type === "create_reference" && dialect7 === "
|
|
16916
|
+
return statement.type === "create_reference" && dialect7 === "pg";
|
|
16934
16917
|
}
|
|
16935
16918
|
convert(statement) {
|
|
16936
16919
|
const {
|
|
@@ -16995,7 +16978,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
16995
16978
|
};
|
|
16996
16979
|
PgAlterForeignKeyConvertor = class extends Convertor {
|
|
16997
16980
|
can(statement, dialect7) {
|
|
16998
|
-
return statement.type === "alter_reference" && dialect7 === "
|
|
16981
|
+
return statement.type === "alter_reference" && dialect7 === "pg";
|
|
16999
16982
|
}
|
|
17000
16983
|
convert(statement) {
|
|
17001
16984
|
const newFk = PgSquasher.unsquashFK(statement.data);
|
|
@@ -17034,7 +17017,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17034
17017
|
};
|
|
17035
17018
|
PgDeleteForeignKeyConvertor = class extends Convertor {
|
|
17036
17019
|
can(statement, dialect7) {
|
|
17037
|
-
return statement.type === "delete_reference" && dialect7 === "
|
|
17020
|
+
return statement.type === "delete_reference" && dialect7 === "pg";
|
|
17038
17021
|
}
|
|
17039
17022
|
convert(statement) {
|
|
17040
17023
|
const tableFrom = statement.tableName;
|
|
@@ -17071,7 +17054,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17071
17054
|
};
|
|
17072
17055
|
CreatePgIndexConvertor = class extends Convertor {
|
|
17073
17056
|
can(statement, dialect7) {
|
|
17074
|
-
return statement.type === "create_index" && dialect7 === "
|
|
17057
|
+
return statement.type === "create_index" && dialect7 === "pg";
|
|
17075
17058
|
}
|
|
17076
17059
|
convert(statement) {
|
|
17077
17060
|
const { name, columns, isUnique } = PgSquasher.unsquashIdx(statement.data);
|
|
@@ -17110,7 +17093,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17110
17093
|
};
|
|
17111
17094
|
PgDropIndexConvertor = class extends Convertor {
|
|
17112
17095
|
can(statement, dialect7) {
|
|
17113
|
-
return statement.type === "drop_index" && dialect7 === "
|
|
17096
|
+
return statement.type === "drop_index" && dialect7 === "pg";
|
|
17114
17097
|
}
|
|
17115
17098
|
convert(statement) {
|
|
17116
17099
|
const { name } = PgSquasher.unsquashIdx(statement.data);
|
|
@@ -17119,7 +17102,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17119
17102
|
};
|
|
17120
17103
|
PgCreateSchemaConvertor = class extends Convertor {
|
|
17121
17104
|
can(statement, dialect7) {
|
|
17122
|
-
return statement.type === "create_schema" && dialect7 === "
|
|
17105
|
+
return statement.type === "create_schema" && dialect7 === "pg";
|
|
17123
17106
|
}
|
|
17124
17107
|
convert(statement) {
|
|
17125
17108
|
const { name } = statement;
|
|
@@ -17129,7 +17112,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17129
17112
|
};
|
|
17130
17113
|
PgRenameSchemaConvertor = class extends Convertor {
|
|
17131
17114
|
can(statement, dialect7) {
|
|
17132
|
-
return statement.type === "rename_schema" && dialect7 === "
|
|
17115
|
+
return statement.type === "rename_schema" && dialect7 === "pg";
|
|
17133
17116
|
}
|
|
17134
17117
|
convert(statement) {
|
|
17135
17118
|
const { from, to } = statement;
|
|
@@ -17139,7 +17122,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17139
17122
|
};
|
|
17140
17123
|
PgDropSchemaConvertor = class extends Convertor {
|
|
17141
17124
|
can(statement, dialect7) {
|
|
17142
|
-
return statement.type === "drop_schema" && dialect7 === "
|
|
17125
|
+
return statement.type === "drop_schema" && dialect7 === "pg";
|
|
17143
17126
|
}
|
|
17144
17127
|
convert(statement) {
|
|
17145
17128
|
const { name } = statement;
|
|
@@ -17149,7 +17132,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17149
17132
|
};
|
|
17150
17133
|
PgAlterTableSetSchemaConvertor = class extends Convertor {
|
|
17151
17134
|
can(statement, dialect7) {
|
|
17152
|
-
return statement.type === "alter_table_set_schema" && dialect7 === "
|
|
17135
|
+
return statement.type === "alter_table_set_schema" && dialect7 === "pg";
|
|
17153
17136
|
}
|
|
17154
17137
|
convert(statement) {
|
|
17155
17138
|
const { tableName, schemaFrom, schemaTo } = statement;
|
|
@@ -17159,7 +17142,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17159
17142
|
};
|
|
17160
17143
|
PgAlterTableSetNewSchemaConvertor = class extends Convertor {
|
|
17161
17144
|
can(statement, dialect7) {
|
|
17162
|
-
return statement.type === "alter_table_set_new_schema" && dialect7 === "
|
|
17145
|
+
return statement.type === "alter_table_set_new_schema" && dialect7 === "pg";
|
|
17163
17146
|
}
|
|
17164
17147
|
convert(statement) {
|
|
17165
17148
|
const { tableName, to, from } = statement;
|
|
@@ -17170,7 +17153,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17170
17153
|
};
|
|
17171
17154
|
PgAlterTableRemoveFromSchemaConvertor = class extends Convertor {
|
|
17172
17155
|
can(statement, dialect7) {
|
|
17173
|
-
return statement.type === "alter_table_remove_from_schema" && dialect7 === "
|
|
17156
|
+
return statement.type === "alter_table_remove_from_schema" && dialect7 === "pg";
|
|
17174
17157
|
}
|
|
17175
17158
|
convert(statement) {
|
|
17176
17159
|
const { tableName, schema: schema4 } = statement;
|
|
@@ -18945,7 +18928,7 @@ var pgSuggestions = async (db, statements) => {
|
|
|
18945
18928
|
}
|
|
18946
18929
|
}
|
|
18947
18930
|
}
|
|
18948
|
-
const stmnt = fromJson([statement], "
|
|
18931
|
+
const stmnt = fromJson([statement], "pg")[0];
|
|
18949
18932
|
if (typeof stmnt !== "undefined") {
|
|
18950
18933
|
if (statement.type === "drop_table") {
|
|
18951
18934
|
statementsToExecute.push(
|
|
@@ -19073,9 +19056,6 @@ String.prototype.squashSpaces = function() {
|
|
|
19073
19056
|
String.prototype.camelCase = function() {
|
|
19074
19057
|
return camelCase(String(this));
|
|
19075
19058
|
};
|
|
19076
|
-
String.prototype.capitalise = function() {
|
|
19077
|
-
return this && this.length > 0 ? `${this[0].toUpperCase()}${this.slice(1)}` : String(this);
|
|
19078
|
-
};
|
|
19079
19059
|
String.prototype.concatIf = function(it, condition) {
|
|
19080
19060
|
return condition ? `${this}${it}` : String(this);
|
|
19081
19061
|
};
|
package/schemaValidator.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { TypeOf } from "zod";
|
|
2
|
-
export declare const dialect: import("zod").ZodEnum<["
|
|
2
|
+
export declare const dialect: import("zod").ZodEnum<["pg", "mysql", "sqlite"]>;
|
|
3
3
|
export type Dialect = TypeOf<typeof dialect>;
|
|
4
4
|
declare const commonSquashedSchema: import("zod").ZodUnion<[import("zod").ZodObject<{
|
|
5
5
|
version: import("zod").ZodLiteral<"6">;
|
|
6
|
-
dialect: import("zod").
|
|
6
|
+
dialect: import("zod").ZodEnum<["pg"]>;
|
|
7
7
|
tables: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
|
|
8
8
|
name: import("zod").ZodString;
|
|
9
9
|
schema: import("zod").ZodString;
|
|
@@ -114,7 +114,7 @@ declare const commonSquashedSchema: import("zod").ZodUnion<[import("zod").ZodObj
|
|
|
114
114
|
uniqueConstraints: Record<string, string>;
|
|
115
115
|
}>;
|
|
116
116
|
version: "6";
|
|
117
|
-
dialect: "
|
|
117
|
+
dialect: "pg";
|
|
118
118
|
schemas: Record<string, string>;
|
|
119
119
|
enums: Record<string, {
|
|
120
120
|
name: string;
|
|
@@ -142,7 +142,7 @@ declare const commonSquashedSchema: import("zod").ZodUnion<[import("zod").ZodObj
|
|
|
142
142
|
uniqueConstraints: Record<string, string>;
|
|
143
143
|
}>;
|
|
144
144
|
version: "6";
|
|
145
|
-
dialect: "
|
|
145
|
+
dialect: "pg";
|
|
146
146
|
schemas: Record<string, string>;
|
|
147
147
|
enums: Record<string, {
|
|
148
148
|
name: string;
|
|
@@ -354,7 +354,7 @@ declare const commonSquashedSchema: import("zod").ZodUnion<[import("zod").ZodObj
|
|
|
354
354
|
}>]>;
|
|
355
355
|
declare const commonSchema: import("zod").ZodUnion<[import("zod").ZodObject<import("zod").extendShape<{
|
|
356
356
|
version: import("zod").ZodLiteral<"6">;
|
|
357
|
-
dialect: import("zod").ZodLiteral<"
|
|
357
|
+
dialect: import("zod").ZodLiteral<"pg">;
|
|
358
358
|
tables: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
|
|
359
359
|
name: import("zod").ZodString;
|
|
360
360
|
schema: import("zod").ZodString;
|
|
@@ -657,7 +657,7 @@ declare const commonSchema: import("zod").ZodUnion<[import("zod").ZodObject<impo
|
|
|
657
657
|
id: string;
|
|
658
658
|
prevId: string;
|
|
659
659
|
version: "6";
|
|
660
|
-
dialect: "
|
|
660
|
+
dialect: "pg";
|
|
661
661
|
schemas: Record<string, string>;
|
|
662
662
|
_meta: {
|
|
663
663
|
columns: Record<string, string>;
|
|
@@ -721,7 +721,7 @@ declare const commonSchema: import("zod").ZodUnion<[import("zod").ZodObject<impo
|
|
|
721
721
|
id: string;
|
|
722
722
|
prevId: string;
|
|
723
723
|
version: "6";
|
|
724
|
-
dialect: "
|
|
724
|
+
dialect: "pg";
|
|
725
725
|
schemas: Record<string, string>;
|
|
726
726
|
_meta: {
|
|
727
727
|
columns: Record<string, string>;
|