drizzle-kit 0.20.17-0d9aa5f → 0.20.17-14a4eaa
Sign up to get free protection for your applications and to get access to all the features.
- package/bin.cjs +24249 -14419
- 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 +25 -25
- package/cli/validations/common.d.ts +13 -13
- package/cli/validations/outputs.d.ts +1 -2
- package/index.d.mts +2 -48
- package/index.d.ts +2 -48
- package/package.json +2 -1
- package/payload.js +73 -56
- package/payload.mjs +73 -56
- package/schemaValidator.d.ts +7 -7
- package/serializer/pgSchema.d.ts +14 -14
- package/serializer/studio.d.ts +1 -1
- package/snapshotsDiffer.d.ts +1 -2
- package/utils-studio.js +8 -8
- package/utils-studio.mjs +8 -8
- 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("postgresql"),
|
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: literalType("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: literalType("postgresql"),
|
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: "postgresql",
|
4852
4852
|
id: originUUID,
|
4853
4853
|
prevId: "",
|
4854
4854
|
tables: {},
|
@@ -5311,7 +5311,8 @@ 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}
|
5314
|
+
suggestion: (str) => `${source_default.white.bgGray(" Suggestion ")} ${str}`,
|
5315
|
+
info: (str) => `${source_default.grey(str)}`
|
5315
5316
|
};
|
5316
5317
|
}
|
5317
5318
|
});
|
@@ -5396,7 +5397,7 @@ var init_schemaValidator = __esm({
|
|
5396
5397
|
init_mysqlSchema();
|
5397
5398
|
init_pgSchema();
|
5398
5399
|
init_sqliteSchema();
|
5399
|
-
dialect3 = enumType(["
|
5400
|
+
dialect3 = enumType(["postgresql", "mysql", "sqlite"]);
|
5400
5401
|
commonSquashedSchema = unionType([
|
5401
5402
|
pgSchemaSquashed,
|
5402
5403
|
mysqlSchemaSquashed,
|
@@ -5516,8 +5517,8 @@ var init_cli = __esm({
|
|
5516
5517
|
dialect: dialect3,
|
5517
5518
|
schema: unionType([stringType(), stringType().array()]).optional(),
|
5518
5519
|
tablesFilter: unionType([stringType(), stringType().array()]).optional(),
|
5519
|
-
|
5520
|
-
driver: stringType(),
|
5520
|
+
schemaFilter: unionType([stringType(), stringType().array()]).optional().default(["public"]),
|
5521
|
+
driver: stringType().optional(),
|
5521
5522
|
// pg
|
5522
5523
|
connectionString: stringType().optional(),
|
5523
5524
|
// mysql
|
@@ -5553,9 +5554,9 @@ var init_cli = __esm({
|
|
5553
5554
|
ssl: stringType().optional(),
|
5554
5555
|
url: stringType().optional(),
|
5555
5556
|
authToken: stringType().optional(),
|
5556
|
-
|
5557
|
+
introspectCasing: casing,
|
5557
5558
|
breakpoints: booleanType().optional().default(true)
|
5558
|
-
});
|
5559
|
+
}).passthrough();
|
5559
5560
|
configCheck = objectType({
|
5560
5561
|
dialect: dialect3.optional(),
|
5561
5562
|
out: stringType().optional()
|
@@ -11515,7 +11516,7 @@ ${withStyle.errorWarning(
|
|
11515
11516
|
);
|
11516
11517
|
return {
|
11517
11518
|
version: "6",
|
11518
|
-
dialect: "
|
11519
|
+
dialect: "postgresql",
|
11519
11520
|
tables: result,
|
11520
11521
|
enums: enumsToReturn,
|
11521
11522
|
schemas: schemasObject,
|
@@ -11722,7 +11723,7 @@ ${withStyle.errorWarning(
|
|
11722
11723
|
const columnName = columnResponse.attname;
|
11723
11724
|
const columnAdditionalDT = columnResponse.additional_dt;
|
11724
11725
|
const columnDimensions = columnResponse.array_dimensions;
|
11725
|
-
const
|
11726
|
+
const enumType3 = columnResponse.enum_name;
|
11726
11727
|
let columnType = columnResponse.data_type;
|
11727
11728
|
const primaryKey = tableConstraints.filter(
|
11728
11729
|
(mapRow) => columnName === mapRow.column_name && mapRow.constraint_type === "PRIMARY KEY"
|
@@ -11786,8 +11787,8 @@ ${withStyle.errorWarning(
|
|
11786
11787
|
columnTypeMapped = trimChar(columnTypeMapped, '"');
|
11787
11788
|
columnToReturn[columnName] = {
|
11788
11789
|
name: columnName,
|
11789
|
-
type: columnAdditionalDT === "USER-DEFINED" ?
|
11790
|
-
typeSchema: enumsToReturn[`${tableSchema}.${
|
11790
|
+
type: columnAdditionalDT === "USER-DEFINED" ? enumType3 : columnTypeMapped,
|
11791
|
+
typeSchema: enumsToReturn[`${tableSchema}.${enumType3}`] !== void 0 ? enumsToReturn[`${tableSchema}.${enumType3}`].schema : void 0,
|
11791
11792
|
primaryKey: primaryKey.length === 1 && cprimaryKey.length < 2,
|
11792
11793
|
// default: isSerial ? undefined : defaultValue,
|
11793
11794
|
notNull: columnResponse.is_nullable === "NO"
|
@@ -11870,7 +11871,7 @@ ${withStyle.errorWarning(
|
|
11870
11871
|
const schemasObject = Object.fromEntries([...schemas].map((it) => [it, it]));
|
11871
11872
|
return {
|
11872
11873
|
version: "6",
|
11873
|
-
dialect: "
|
11874
|
+
dialect: "postgresql",
|
11874
11875
|
tables: result,
|
11875
11876
|
enums: enumsToReturn,
|
11876
11877
|
schemas: schemasObject,
|
@@ -15101,7 +15102,7 @@ var init_snapshotsDiffer = __esm({
|
|
15101
15102
|
const jsonTableAlternations = alteredTables.map((it) => {
|
15102
15103
|
return preparePgAlterColumns(it.name, it.schema, it.altered, json2);
|
15103
15104
|
}).flat();
|
15104
|
-
const
|
15105
|
+
const jsonCreateIndexesFoAlteredTables = alteredTables.map((it) => {
|
15105
15106
|
return prepareCreateIndexesJson(
|
15106
15107
|
it.name,
|
15107
15108
|
it.schema,
|
@@ -15130,14 +15131,21 @@ var init_snapshotsDiffer = __esm({
|
|
15130
15131
|
},
|
15131
15132
|
{}
|
15132
15133
|
);
|
15133
|
-
|
15134
|
+
jsonCreateIndexesFoAlteredTables.push(
|
15134
15135
|
...prepareCreateIndexesJson(it.name, it.schema, createdIndexes || {})
|
15135
15136
|
);
|
15136
15137
|
jsonDropIndexesForAllAlteredTables.push(
|
15137
15138
|
...prepareDropIndexesJson(it.name, it.schema, droppedIndexes || {})
|
15138
15139
|
);
|
15139
15140
|
});
|
15140
|
-
const
|
15141
|
+
const jsonCreateReferencesForCreatedTables = createdTables.map((it) => {
|
15142
|
+
return prepareCreateReferencesJson(
|
15143
|
+
it.name,
|
15144
|
+
it.schema,
|
15145
|
+
it.foreignKeys
|
15146
|
+
);
|
15147
|
+
}).flat();
|
15148
|
+
const jsonReferencesForAlteredTables = alteredTables.map((it) => {
|
15141
15149
|
const forAdded = prepareCreateReferencesJson(
|
15142
15150
|
it.name,
|
15143
15151
|
it.schema,
|
@@ -15155,10 +15163,10 @@ var init_snapshotsDiffer = __esm({
|
|
15155
15163
|
);
|
15156
15164
|
return [...forAdded, ...forAltered, ...alteredFKs];
|
15157
15165
|
}).flat();
|
15158
|
-
const jsonCreatedReferencesForAlteredTables =
|
15166
|
+
const jsonCreatedReferencesForAlteredTables = jsonReferencesForAlteredTables.filter(
|
15159
15167
|
(t) => t.type === "create_reference"
|
15160
15168
|
);
|
15161
|
-
const jsonDroppedReferencesForAlteredTables =
|
15169
|
+
const jsonDroppedReferencesForAlteredTables = jsonReferencesForAlteredTables.filter(
|
15162
15170
|
(t) => t.type === "delete_reference"
|
15163
15171
|
);
|
15164
15172
|
const createEnums = createdEnums.map((it) => {
|
@@ -15185,7 +15193,7 @@ var init_snapshotsDiffer = __esm({
|
|
15185
15193
|
const dropSchemas = prepareDeleteSchemasJson(
|
15186
15194
|
deletedSchemas.map((it) => it.name)
|
15187
15195
|
);
|
15188
|
-
const
|
15196
|
+
const createTables = createdTables.map((it) => {
|
15189
15197
|
return preparePgCreateTableJson(it, curFull);
|
15190
15198
|
});
|
15191
15199
|
jsonStatements.push(...createSchemas);
|
@@ -15194,7 +15202,7 @@ var init_snapshotsDiffer = __esm({
|
|
15194
15202
|
jsonStatements.push(...moveEnums);
|
15195
15203
|
jsonStatements.push(...renameEnums);
|
15196
15204
|
jsonStatements.push(...jsonAlterEnumsWithAddedValues);
|
15197
|
-
jsonStatements.push(...
|
15205
|
+
jsonStatements.push(...createTables);
|
15198
15206
|
jsonStatements.push(...jsonDropTables);
|
15199
15207
|
jsonStatements.push(...jsonSetTableSchemas);
|
15200
15208
|
jsonStatements.push(...jsonRenameTables);
|
@@ -15205,15 +15213,16 @@ var init_snapshotsDiffer = __esm({
|
|
15205
15213
|
jsonStatements.push(...jsonTableAlternations);
|
15206
15214
|
jsonStatements.push(...jsonAddedCompositePKs);
|
15207
15215
|
jsonStatements.push(...jsonAddColumnsStatemets);
|
15216
|
+
jsonStatements.push(...jsonCreateReferencesForCreatedTables);
|
15208
15217
|
jsonStatements.push(...jsonCreateIndexesForCreatedTables);
|
15209
|
-
jsonStatements.push(...jsonCreateIndexesForAllAlteredTables);
|
15210
15218
|
jsonStatements.push(...jsonCreatedReferencesForAlteredTables);
|
15219
|
+
jsonStatements.push(...jsonCreateIndexesFoAlteredTables);
|
15211
15220
|
jsonStatements.push(...jsonDropColumnsStatemets);
|
15212
15221
|
jsonStatements.push(...jsonAlteredCompositePKs);
|
15213
15222
|
jsonStatements.push(...jsonAlteredUniqueConstraints);
|
15214
15223
|
jsonStatements.push(...dropEnums);
|
15215
15224
|
jsonStatements.push(...dropSchemas);
|
15216
|
-
const sqlStatements = fromJson(jsonStatements, "
|
15225
|
+
const sqlStatements = fromJson(jsonStatements, "postgresql");
|
15217
15226
|
const uniqueSqlStatements = [];
|
15218
15227
|
sqlStatements.forEach((ss) => {
|
15219
15228
|
if (!uniqueSqlStatements.includes(ss)) {
|
@@ -15351,8 +15360,8 @@ var init_snapshotsDiffer = __esm({
|
|
15351
15360
|
const jsonDeletedUniqueConstraints = [];
|
15352
15361
|
const jsonAlteredUniqueConstraints = [];
|
15353
15362
|
const jsonRenameColumnsStatements = columnRenames.map((it) => prepareRenameColumns(it.table, "", it.renames)).flat();
|
15363
|
+
const jsonAddColumnsStatemets = columnCreates.map((it) => _prepareAddColumns(it.table, "", it.columns)).flat();
|
15354
15364
|
const jsonDropColumnsStatemets = columnDeletes.map((it) => _prepareDropColumns(it.table, "", it.columns)).flat();
|
15355
|
-
const jsonAddColumnsStatemets = columnDeletes.map((it) => _prepareAddColumns(it.table, "", it.columns)).flat();
|
15356
15365
|
alteredTables.forEach((it) => {
|
15357
15366
|
let addedColumns = [];
|
15358
15367
|
for (const addedPkName of Object.keys(it.addedCompositePKs)) {
|
@@ -15466,6 +15475,13 @@ var init_snapshotsDiffer = __esm({
|
|
15466
15475
|
...prepareDropIndexesJson(it.name, it.schema, droppedIndexes || {})
|
15467
15476
|
);
|
15468
15477
|
});
|
15478
|
+
const jsonCreateReferencesForCreatedTables = createdTables.map((it) => {
|
15479
|
+
return prepareCreateReferencesJson(
|
15480
|
+
it.name,
|
15481
|
+
it.schema,
|
15482
|
+
it.foreignKeys
|
15483
|
+
);
|
15484
|
+
}).flat();
|
15469
15485
|
const jsonReferencesForAllAlteredTables = alteredTables.map((it) => {
|
15470
15486
|
const forAdded = prepareCreateReferencesJson(
|
15471
15487
|
it.name,
|
@@ -15506,9 +15522,10 @@ var init_snapshotsDiffer = __esm({
|
|
15506
15522
|
jsonStatements.push(...jsonAddedUniqueConstraints);
|
15507
15523
|
jsonStatements.push(...jsonDeletedUniqueConstraints);
|
15508
15524
|
jsonStatements.push(...jsonAddColumnsStatemets);
|
15525
|
+
jsonStatements.push(...jsonCreateReferencesForCreatedTables);
|
15509
15526
|
jsonStatements.push(...jsonCreateIndexesForCreatedTables);
|
15510
|
-
jsonStatements.push(...jsonCreateIndexesForAllAlteredTables);
|
15511
15527
|
jsonStatements.push(...jsonCreatedReferencesForAlteredTables);
|
15528
|
+
jsonStatements.push(...jsonCreateIndexesForAllAlteredTables);
|
15512
15529
|
jsonStatements.push(...jsonDropColumnsStatemets);
|
15513
15530
|
jsonStatements.push(...jsonAlteredCompositePKs);
|
15514
15531
|
jsonStatements.push(...jsonAddedUniqueConstraints);
|
@@ -16093,7 +16110,7 @@ var init_sqlgenerator = __esm({
|
|
16093
16110
|
};
|
16094
16111
|
PgCreateTableConvertor = class extends Convertor {
|
16095
16112
|
can(statement, dialect7) {
|
16096
|
-
return statement.type === "create_table" && dialect7 === "
|
16113
|
+
return statement.type === "create_table" && dialect7 === "postgresql";
|
16097
16114
|
}
|
16098
16115
|
convert(st) {
|
16099
16116
|
const { tableName, schema: schema4, columns, compositePKs, uniqueConstraints } = st;
|
@@ -16235,7 +16252,7 @@ var init_sqlgenerator = __esm({
|
|
16235
16252
|
};
|
16236
16253
|
PgAlterTableAddUniqueConstraintConvertor = class extends Convertor {
|
16237
16254
|
can(statement, dialect7) {
|
16238
|
-
return statement.type === "create_unique_constraint" && dialect7 === "
|
16255
|
+
return statement.type === "create_unique_constraint" && dialect7 === "postgresql";
|
16239
16256
|
}
|
16240
16257
|
convert(statement) {
|
16241
16258
|
const unsquashed = PgSquasher.unsquashUnique(statement.data);
|
@@ -16245,7 +16262,7 @@ var init_sqlgenerator = __esm({
|
|
16245
16262
|
};
|
16246
16263
|
PgAlterTableDropUniqueConstraintConvertor = class extends Convertor {
|
16247
16264
|
can(statement, dialect7) {
|
16248
|
-
return statement.type === "delete_unique_constraint" && dialect7 === "
|
16265
|
+
return statement.type === "delete_unique_constraint" && dialect7 === "postgresql";
|
16249
16266
|
}
|
16250
16267
|
convert(statement) {
|
16251
16268
|
const unsquashed = PgSquasher.unsquashUnique(statement.data);
|
@@ -16334,7 +16351,7 @@ var init_sqlgenerator = __esm({
|
|
16334
16351
|
};
|
16335
16352
|
PgDropTableConvertor = class extends Convertor {
|
16336
16353
|
can(statement, dialect7) {
|
16337
|
-
return statement.type === "drop_table" && dialect7 === "
|
16354
|
+
return statement.type === "drop_table" && dialect7 === "postgresql";
|
16338
16355
|
}
|
16339
16356
|
convert(statement) {
|
16340
16357
|
const { tableName, schema: schema4 } = statement;
|
@@ -16362,7 +16379,7 @@ var init_sqlgenerator = __esm({
|
|
16362
16379
|
};
|
16363
16380
|
PgRenameTableConvertor = class extends Convertor {
|
16364
16381
|
can(statement, dialect7) {
|
16365
|
-
return statement.type === "rename_table" && dialect7 === "
|
16382
|
+
return statement.type === "rename_table" && dialect7 === "postgresql";
|
16366
16383
|
}
|
16367
16384
|
convert(statement) {
|
16368
16385
|
const { tableNameFrom, tableNameTo, toSchema, fromSchema } = statement;
|
@@ -16393,7 +16410,7 @@ var init_sqlgenerator = __esm({
|
|
16393
16410
|
};
|
16394
16411
|
PgAlterTableRenameColumnConvertor = class extends Convertor {
|
16395
16412
|
can(statement, dialect7) {
|
16396
|
-
return statement.type === "alter_table_rename_column" && dialect7 === "
|
16413
|
+
return statement.type === "alter_table_rename_column" && dialect7 === "postgresql";
|
16397
16414
|
}
|
16398
16415
|
convert(statement) {
|
16399
16416
|
const { tableName, oldColumnName, newColumnName, schema: schema4 } = statement;
|
@@ -16421,7 +16438,7 @@ var init_sqlgenerator = __esm({
|
|
16421
16438
|
};
|
16422
16439
|
PgAlterTableDropColumnConvertor = class extends Convertor {
|
16423
16440
|
can(statement, dialect7) {
|
16424
|
-
return statement.type === "alter_table_drop_column" && dialect7 === "
|
16441
|
+
return statement.type === "alter_table_drop_column" && dialect7 === "postgresql";
|
16425
16442
|
}
|
16426
16443
|
convert(statement) {
|
16427
16444
|
const { tableName, columnName, schema: schema4 } = statement;
|
@@ -16449,7 +16466,7 @@ var init_sqlgenerator = __esm({
|
|
16449
16466
|
};
|
16450
16467
|
PgAlterTableAddColumnConvertor = class extends Convertor {
|
16451
16468
|
can(statement, dialect7) {
|
16452
|
-
return statement.type === "alter_table_add_column" && dialect7 === "
|
16469
|
+
return statement.type === "alter_table_add_column" && dialect7 === "postgresql";
|
16453
16470
|
}
|
16454
16471
|
convert(statement) {
|
16455
16472
|
const { tableName, column: column4, schema: schema4 } = statement;
|
@@ -16494,7 +16511,7 @@ var init_sqlgenerator = __esm({
|
|
16494
16511
|
};
|
16495
16512
|
PgAlterTableAlterColumnSetTypeConvertor = class extends Convertor {
|
16496
16513
|
can(statement, dialect7) {
|
16497
|
-
return statement.type === "alter_table_alter_column_set_type" && dialect7 === "
|
16514
|
+
return statement.type === "alter_table_alter_column_set_type" && dialect7 === "postgresql";
|
16498
16515
|
}
|
16499
16516
|
convert(statement) {
|
16500
16517
|
const { tableName, columnName, newDataType, schema: schema4 } = statement;
|
@@ -16519,7 +16536,7 @@ var init_sqlgenerator = __esm({
|
|
16519
16536
|
};
|
16520
16537
|
PgAlterTableAlterColumnSetDefaultConvertor = class extends Convertor {
|
16521
16538
|
can(statement, dialect7) {
|
16522
|
-
return statement.type === "alter_table_alter_column_set_default" && dialect7 === "
|
16539
|
+
return statement.type === "alter_table_alter_column_set_default" && dialect7 === "postgresql";
|
16523
16540
|
}
|
16524
16541
|
convert(statement) {
|
16525
16542
|
const { tableName, columnName, schema: schema4 } = statement;
|
@@ -16544,7 +16561,7 @@ var init_sqlgenerator = __esm({
|
|
16544
16561
|
};
|
16545
16562
|
PgAlterTableAlterColumnDropDefaultConvertor = class extends Convertor {
|
16546
16563
|
can(statement, dialect7) {
|
16547
|
-
return statement.type === "alter_table_alter_column_drop_default" && dialect7 === "
|
16564
|
+
return statement.type === "alter_table_alter_column_drop_default" && dialect7 === "postgresql";
|
16548
16565
|
}
|
16549
16566
|
convert(statement) {
|
16550
16567
|
const { tableName, columnName, schema: schema4 } = statement;
|
@@ -16656,7 +16673,7 @@ var init_sqlgenerator = __esm({
|
|
16656
16673
|
};
|
16657
16674
|
PgAlterTableCreateCompositePrimaryKeyConvertor = class extends Convertor {
|
16658
16675
|
can(statement, dialect7) {
|
16659
|
-
return statement.type === "create_composite_pk" && dialect7 === "
|
16676
|
+
return statement.type === "create_composite_pk" && dialect7 === "postgresql";
|
16660
16677
|
}
|
16661
16678
|
convert(statement) {
|
16662
16679
|
const { name, columns } = PgSquasher.unsquashPK(statement.data);
|
@@ -16666,7 +16683,7 @@ var init_sqlgenerator = __esm({
|
|
16666
16683
|
};
|
16667
16684
|
PgAlterTableDeleteCompositePrimaryKeyConvertor = class extends Convertor {
|
16668
16685
|
can(statement, dialect7) {
|
16669
|
-
return statement.type === "delete_composite_pk" && dialect7 === "
|
16686
|
+
return statement.type === "delete_composite_pk" && dialect7 === "postgresql";
|
16670
16687
|
}
|
16671
16688
|
convert(statement) {
|
16672
16689
|
const { name, columns } = PgSquasher.unsquashPK(statement.data);
|
@@ -16676,7 +16693,7 @@ var init_sqlgenerator = __esm({
|
|
16676
16693
|
};
|
16677
16694
|
PgAlterTableAlterCompositePrimaryKeyConvertor = class extends Convertor {
|
16678
16695
|
can(statement, dialect7) {
|
16679
|
-
return statement.type === "alter_composite_pk" && dialect7 === "
|
16696
|
+
return statement.type === "alter_composite_pk" && dialect7 === "postgresql";
|
16680
16697
|
}
|
16681
16698
|
convert(statement) {
|
16682
16699
|
const { name, columns } = PgSquasher.unsquashPK(statement.old);
|
@@ -16799,7 +16816,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
16799
16816
|
};
|
16800
16817
|
PgAlterTableAlterColumnSetPrimaryKeyConvertor = class extends Convertor {
|
16801
16818
|
can(statement, dialect7) {
|
16802
|
-
return statement.type === "alter_table_alter_column_set_pk" && dialect7 === "
|
16819
|
+
return statement.type === "alter_table_alter_column_set_pk" && dialect7 === "postgresql";
|
16803
16820
|
}
|
16804
16821
|
convert(statement) {
|
16805
16822
|
const { tableName, columnName } = statement;
|
@@ -16809,7 +16826,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
16809
16826
|
};
|
16810
16827
|
PgAlterTableAlterColumnDropPrimaryKeyConvertor = class extends Convertor {
|
16811
16828
|
can(statement, dialect7) {
|
16812
|
-
return statement.type === "alter_table_alter_column_drop_pk" && dialect7 === "
|
16829
|
+
return statement.type === "alter_table_alter_column_drop_pk" && dialect7 === "postgresql";
|
16813
16830
|
}
|
16814
16831
|
convert(statement) {
|
16815
16832
|
const { tableName, columnName, schema: schema4 } = statement;
|
@@ -16833,7 +16850,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
16833
16850
|
};
|
16834
16851
|
PgAlterTableAlterColumnSetNotNullConvertor = class extends Convertor {
|
16835
16852
|
can(statement, dialect7) {
|
16836
|
-
return statement.type === "alter_table_alter_column_set_notnull" && dialect7 === "
|
16853
|
+
return statement.type === "alter_table_alter_column_set_notnull" && dialect7 === "postgresql";
|
16837
16854
|
}
|
16838
16855
|
convert(statement) {
|
16839
16856
|
const { tableName, columnName } = statement;
|
@@ -16888,7 +16905,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
16888
16905
|
};
|
16889
16906
|
PgAlterTableAlterColumnDropNotNullConvertor = class extends Convertor {
|
16890
16907
|
can(statement, dialect7) {
|
16891
|
-
return statement.type === "alter_table_alter_column_drop_notnull" && dialect7 === "
|
16908
|
+
return statement.type === "alter_table_alter_column_drop_notnull" && dialect7 === "postgresql";
|
16892
16909
|
}
|
16893
16910
|
convert(statement) {
|
16894
16911
|
const { tableName, columnName } = statement;
|
@@ -16913,7 +16930,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
16913
16930
|
};
|
16914
16931
|
PgCreateForeignKeyConvertor = class extends Convertor {
|
16915
16932
|
can(statement, dialect7) {
|
16916
|
-
return statement.type === "create_reference" && dialect7 === "
|
16933
|
+
return statement.type === "create_reference" && dialect7 === "postgresql";
|
16917
16934
|
}
|
16918
16935
|
convert(statement) {
|
16919
16936
|
const {
|
@@ -16978,7 +16995,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
16978
16995
|
};
|
16979
16996
|
PgAlterForeignKeyConvertor = class extends Convertor {
|
16980
16997
|
can(statement, dialect7) {
|
16981
|
-
return statement.type === "alter_reference" && dialect7 === "
|
16998
|
+
return statement.type === "alter_reference" && dialect7 === "postgresql";
|
16982
16999
|
}
|
16983
17000
|
convert(statement) {
|
16984
17001
|
const newFk = PgSquasher.unsquashFK(statement.data);
|
@@ -17017,7 +17034,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
17017
17034
|
};
|
17018
17035
|
PgDeleteForeignKeyConvertor = class extends Convertor {
|
17019
17036
|
can(statement, dialect7) {
|
17020
|
-
return statement.type === "delete_reference" && dialect7 === "
|
17037
|
+
return statement.type === "delete_reference" && dialect7 === "postgresql";
|
17021
17038
|
}
|
17022
17039
|
convert(statement) {
|
17023
17040
|
const tableFrom = statement.tableName;
|
@@ -17054,7 +17071,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
17054
17071
|
};
|
17055
17072
|
CreatePgIndexConvertor = class extends Convertor {
|
17056
17073
|
can(statement, dialect7) {
|
17057
|
-
return statement.type === "create_index" && dialect7 === "
|
17074
|
+
return statement.type === "create_index" && dialect7 === "postgresql";
|
17058
17075
|
}
|
17059
17076
|
convert(statement) {
|
17060
17077
|
const { name, columns, isUnique } = PgSquasher.unsquashIdx(statement.data);
|
@@ -17093,7 +17110,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
17093
17110
|
};
|
17094
17111
|
PgDropIndexConvertor = class extends Convertor {
|
17095
17112
|
can(statement, dialect7) {
|
17096
|
-
return statement.type === "drop_index" && dialect7 === "
|
17113
|
+
return statement.type === "drop_index" && dialect7 === "postgresql";
|
17097
17114
|
}
|
17098
17115
|
convert(statement) {
|
17099
17116
|
const { name } = PgSquasher.unsquashIdx(statement.data);
|
@@ -17102,7 +17119,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
17102
17119
|
};
|
17103
17120
|
PgCreateSchemaConvertor = class extends Convertor {
|
17104
17121
|
can(statement, dialect7) {
|
17105
|
-
return statement.type === "create_schema" && dialect7 === "
|
17122
|
+
return statement.type === "create_schema" && dialect7 === "postgresql";
|
17106
17123
|
}
|
17107
17124
|
convert(statement) {
|
17108
17125
|
const { name } = statement;
|
@@ -17112,7 +17129,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
17112
17129
|
};
|
17113
17130
|
PgRenameSchemaConvertor = class extends Convertor {
|
17114
17131
|
can(statement, dialect7) {
|
17115
|
-
return statement.type === "rename_schema" && dialect7 === "
|
17132
|
+
return statement.type === "rename_schema" && dialect7 === "postgresql";
|
17116
17133
|
}
|
17117
17134
|
convert(statement) {
|
17118
17135
|
const { from, to } = statement;
|
@@ -17122,7 +17139,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
17122
17139
|
};
|
17123
17140
|
PgDropSchemaConvertor = class extends Convertor {
|
17124
17141
|
can(statement, dialect7) {
|
17125
|
-
return statement.type === "drop_schema" && dialect7 === "
|
17142
|
+
return statement.type === "drop_schema" && dialect7 === "postgresql";
|
17126
17143
|
}
|
17127
17144
|
convert(statement) {
|
17128
17145
|
const { name } = statement;
|
@@ -17132,7 +17149,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
17132
17149
|
};
|
17133
17150
|
PgAlterTableSetSchemaConvertor = class extends Convertor {
|
17134
17151
|
can(statement, dialect7) {
|
17135
|
-
return statement.type === "alter_table_set_schema" && dialect7 === "
|
17152
|
+
return statement.type === "alter_table_set_schema" && dialect7 === "postgresql";
|
17136
17153
|
}
|
17137
17154
|
convert(statement) {
|
17138
17155
|
const { tableName, schemaFrom, schemaTo } = statement;
|
@@ -17142,7 +17159,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
17142
17159
|
};
|
17143
17160
|
PgAlterTableSetNewSchemaConvertor = class extends Convertor {
|
17144
17161
|
can(statement, dialect7) {
|
17145
|
-
return statement.type === "alter_table_set_new_schema" && dialect7 === "
|
17162
|
+
return statement.type === "alter_table_set_new_schema" && dialect7 === "postgresql";
|
17146
17163
|
}
|
17147
17164
|
convert(statement) {
|
17148
17165
|
const { tableName, to, from } = statement;
|
@@ -17153,7 +17170,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
17153
17170
|
};
|
17154
17171
|
PgAlterTableRemoveFromSchemaConvertor = class extends Convertor {
|
17155
17172
|
can(statement, dialect7) {
|
17156
|
-
return statement.type === "alter_table_remove_from_schema" && dialect7 === "
|
17173
|
+
return statement.type === "alter_table_remove_from_schema" && dialect7 === "postgresql";
|
17157
17174
|
}
|
17158
17175
|
convert(statement) {
|
17159
17176
|
const { tableName, schema: schema4 } = statement;
|
@@ -18928,7 +18945,7 @@ var pgSuggestions = async (db, statements) => {
|
|
18928
18945
|
}
|
18929
18946
|
}
|
18930
18947
|
}
|
18931
|
-
const stmnt = fromJson([statement], "
|
18948
|
+
const stmnt = fromJson([statement], "postgresql")[0];
|
18932
18949
|
if (typeof stmnt !== "undefined") {
|
18933
18950
|
if (statement.type === "drop_table") {
|
18934
18951
|
statementsToExecute.push(
|
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<["postgresql", "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").ZodLiteral<"postgresql">;
|
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: "postgresql";
|
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: "postgresql";
|
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<"postgresql">;
|
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: "postgresql";
|
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: "postgresql";
|
725
725
|
schemas: Record<string, string>;
|
726
726
|
_meta: {
|
727
727
|
columns: Record<string, string>;
|
package/serializer/pgSchema.d.ts
CHANGED
@@ -2063,7 +2063,7 @@ export declare const pgSchemaExternal: import("zod").ZodObject<{
|
|
2063
2063
|
}>;
|
2064
2064
|
export declare const pgSchemaInternal: import("zod").ZodObject<{
|
2065
2065
|
version: import("zod").ZodLiteral<"6">;
|
2066
|
-
dialect: import("zod").ZodLiteral<"
|
2066
|
+
dialect: import("zod").ZodLiteral<"postgresql">;
|
2067
2067
|
tables: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
|
2068
2068
|
name: import("zod").ZodString;
|
2069
2069
|
schema: import("zod").ZodString;
|
@@ -2361,7 +2361,7 @@ export declare const pgSchemaInternal: import("zod").ZodObject<{
|
|
2361
2361
|
}>;
|
2362
2362
|
}>;
|
2363
2363
|
version: "6";
|
2364
|
-
dialect: "
|
2364
|
+
dialect: "postgresql";
|
2365
2365
|
schemas: Record<string, string>;
|
2366
2366
|
_meta: {
|
2367
2367
|
columns: Record<string, string>;
|
@@ -2423,7 +2423,7 @@ export declare const pgSchemaInternal: import("zod").ZodObject<{
|
|
2423
2423
|
}>;
|
2424
2424
|
}>;
|
2425
2425
|
version: "6";
|
2426
|
-
dialect: "
|
2426
|
+
dialect: "postgresql";
|
2427
2427
|
schemas: Record<string, string>;
|
2428
2428
|
_meta: {
|
2429
2429
|
columns: Record<string, string>;
|
@@ -2438,7 +2438,7 @@ export declare const pgSchemaInternal: import("zod").ZodObject<{
|
|
2438
2438
|
}>;
|
2439
2439
|
export declare const pgSchemaSquashedV4: import("zod").ZodObject<{
|
2440
2440
|
version: import("zod").ZodLiteral<"4">;
|
2441
|
-
dialect: import("zod").
|
2441
|
+
dialect: import("zod").ZodLiteral<"pg">;
|
2442
2442
|
tables: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
|
2443
2443
|
name: import("zod").ZodString;
|
2444
2444
|
schema: import("zod").ZodString;
|
@@ -2572,7 +2572,7 @@ export declare const pgSchemaSquashedV4: import("zod").ZodObject<{
|
|
2572
2572
|
}>;
|
2573
2573
|
export declare const pgSchemaSquashed: import("zod").ZodObject<{
|
2574
2574
|
version: import("zod").ZodLiteral<"6">;
|
2575
|
-
dialect: import("zod").
|
2575
|
+
dialect: import("zod").ZodLiteral<"postgresql">;
|
2576
2576
|
tables: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
|
2577
2577
|
name: import("zod").ZodString;
|
2578
2578
|
schema: import("zod").ZodString;
|
@@ -2683,7 +2683,7 @@ export declare const pgSchemaSquashed: import("zod").ZodObject<{
|
|
2683
2683
|
uniqueConstraints: Record<string, string>;
|
2684
2684
|
}>;
|
2685
2685
|
version: "6";
|
2686
|
-
dialect: "
|
2686
|
+
dialect: "postgresql";
|
2687
2687
|
schemas: Record<string, string>;
|
2688
2688
|
enums: Record<string, {
|
2689
2689
|
name: string;
|
@@ -2711,7 +2711,7 @@ export declare const pgSchemaSquashed: import("zod").ZodObject<{
|
|
2711
2711
|
uniqueConstraints: Record<string, string>;
|
2712
2712
|
}>;
|
2713
2713
|
version: "6";
|
2714
|
-
dialect: "
|
2714
|
+
dialect: "postgresql";
|
2715
2715
|
schemas: Record<string, string>;
|
2716
2716
|
enums: Record<string, {
|
2717
2717
|
name: string;
|
@@ -3554,7 +3554,7 @@ export declare const pgSchemaV5: import("zod").ZodObject<import("zod").extendSha
|
|
3554
3554
|
}>;
|
3555
3555
|
export declare const pgSchema: import("zod").ZodObject<import("zod").extendShape<{
|
3556
3556
|
version: import("zod").ZodLiteral<"6">;
|
3557
|
-
dialect: import("zod").ZodLiteral<"
|
3557
|
+
dialect: import("zod").ZodLiteral<"postgresql">;
|
3558
3558
|
tables: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
|
3559
3559
|
name: import("zod").ZodString;
|
3560
3560
|
schema: import("zod").ZodString;
|
@@ -3857,7 +3857,7 @@ export declare const pgSchema: import("zod").ZodObject<import("zod").extendShape
|
|
3857
3857
|
id: string;
|
3858
3858
|
prevId: string;
|
3859
3859
|
version: "6";
|
3860
|
-
dialect: "
|
3860
|
+
dialect: "postgresql";
|
3861
3861
|
schemas: Record<string, string>;
|
3862
3862
|
_meta: {
|
3863
3863
|
columns: Record<string, string>;
|
@@ -3921,7 +3921,7 @@ export declare const pgSchema: import("zod").ZodObject<import("zod").extendShape
|
|
3921
3921
|
id: string;
|
3922
3922
|
prevId: string;
|
3923
3923
|
version: "6";
|
3924
|
-
dialect: "
|
3924
|
+
dialect: "postgresql";
|
3925
3925
|
schemas: Record<string, string>;
|
3926
3926
|
_meta: {
|
3927
3927
|
columns: Record<string, string>;
|
@@ -4332,7 +4332,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
|
|
4332
4332
|
}>;
|
4333
4333
|
}>, import("zod").ZodObject<import("zod").extendShape<{
|
4334
4334
|
version: import("zod").ZodLiteral<"6">;
|
4335
|
-
dialect: import("zod").ZodLiteral<"
|
4335
|
+
dialect: import("zod").ZodLiteral<"postgresql">;
|
4336
4336
|
tables: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
|
4337
4337
|
name: import("zod").ZodString;
|
4338
4338
|
schema: import("zod").ZodString;
|
@@ -4635,7 +4635,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
|
|
4635
4635
|
id: string;
|
4636
4636
|
prevId: string;
|
4637
4637
|
version: "6";
|
4638
|
-
dialect: "
|
4638
|
+
dialect: "postgresql";
|
4639
4639
|
schemas: Record<string, string>;
|
4640
4640
|
_meta: {
|
4641
4641
|
columns: Record<string, string>;
|
@@ -4699,7 +4699,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
|
|
4699
4699
|
id: string;
|
4700
4700
|
prevId: string;
|
4701
4701
|
version: "6";
|
4702
|
-
dialect: "
|
4702
|
+
dialect: "postgresql";
|
4703
4703
|
schemas: Record<string, string>;
|
4704
4704
|
_meta: {
|
4705
4705
|
columns: Record<string, string>;
|
@@ -4776,7 +4776,7 @@ export declare const dryPg: {
|
|
4776
4776
|
id: string;
|
4777
4777
|
prevId: string;
|
4778
4778
|
version: "6";
|
4779
|
-
dialect: "
|
4779
|
+
dialect: "postgresql";
|
4780
4780
|
schemas: Record<string, string>;
|
4781
4781
|
_meta: {
|
4782
4782
|
columns: Record<string, string>;
|