drizzle-kit 0.20.17-14a4eaa → 0.20.17-388fa1b
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/bin.cjs +14408 -24236
- 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 +2 -1
- package/index.d.mts +48 -2
- package/index.d.ts +48 -2
- package/package.json +1 -2
- package/payload.js +57 -73
- package/payload.mjs +57 -73
- 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 -8
- package/utils-studio.mjs +8 -8
- package/utils.js +5 -5
- package/utils.mjs +5 -5
package/payload.js
CHANGED
|
@@ -4695,7 +4695,7 @@ var init_pgSchema = __esm({
|
|
|
4695
4695
|
}).strict();
|
|
4696
4696
|
pgSchemaInternal = objectType({
|
|
4697
4697
|
version: literalType("6"),
|
|
4698
|
-
dialect: literalType("
|
|
4698
|
+
dialect: literalType("pg"),
|
|
4699
4699
|
tables: recordType(stringType(), table2),
|
|
4700
4700
|
enums: recordType(stringType(), enumSchema),
|
|
4701
4701
|
schemas: recordType(stringType(), stringType()),
|
|
@@ -4724,14 +4724,14 @@ var init_pgSchema = __esm({
|
|
|
4724
4724
|
}).strict();
|
|
4725
4725
|
pgSchemaSquashedV4 = objectType({
|
|
4726
4726
|
version: literalType("4"),
|
|
4727
|
-
dialect:
|
|
4727
|
+
dialect: enumType(["pg"]),
|
|
4728
4728
|
tables: recordType(stringType(), tableSquashedV42),
|
|
4729
4729
|
enums: recordType(stringType(), enumSchemaV1),
|
|
4730
4730
|
schemas: recordType(stringType(), stringType())
|
|
4731
4731
|
}).strict();
|
|
4732
4732
|
pgSchemaSquashed = objectType({
|
|
4733
4733
|
version: literalType("6"),
|
|
4734
|
-
dialect:
|
|
4734
|
+
dialect: enumType(["pg"]),
|
|
4735
4735
|
tables: recordType(stringType(), tableSquashed2),
|
|
4736
4736
|
enums: recordType(stringType(), enumSchema),
|
|
4737
4737
|
schemas: recordType(stringType(), stringType())
|
|
@@ -4842,7 +4842,7 @@ var init_pgSchema = __esm({
|
|
|
4842
4842
|
};
|
|
4843
4843
|
dryPg = pgSchema.parse({
|
|
4844
4844
|
version: snapshotVersion,
|
|
4845
|
-
dialect: "
|
|
4845
|
+
dialect: "pg",
|
|
4846
4846
|
id: originUUID,
|
|
4847
4847
|
prevId: "",
|
|
4848
4848
|
tables: {},
|
|
@@ -5305,8 +5305,7 @@ var init_outputs = __esm({
|
|
|
5305
5305
|
warning: (str) => `${source_default.white.bgGray(" Warning ")} ${str}`,
|
|
5306
5306
|
errorWarning: (str) => `${source_default.red(`${source_default.white.bgRed(" Warning ")} ${str}`)}`,
|
|
5307
5307
|
fullWarning: (str) => `${source_default.black.bgYellow("[Warning]")} ${source_default.bold(str)}`,
|
|
5308
|
-
suggestion: (str) => `${source_default.white.bgGray(" Suggestion ")} ${str}
|
|
5309
|
-
info: (str) => `${source_default.grey(str)}`
|
|
5308
|
+
suggestion: (str) => `${source_default.white.bgGray(" Suggestion ")} ${str}`
|
|
5310
5309
|
};
|
|
5311
5310
|
}
|
|
5312
5311
|
});
|
|
@@ -5328,6 +5327,7 @@ var init_mysql = __esm({
|
|
|
5328
5327
|
}),
|
|
5329
5328
|
objectType({
|
|
5330
5329
|
url: stringType()
|
|
5330
|
+
// TODO: change docs
|
|
5331
5331
|
})
|
|
5332
5332
|
]);
|
|
5333
5333
|
}
|
|
@@ -5391,7 +5391,7 @@ var init_schemaValidator = __esm({
|
|
|
5391
5391
|
init_mysqlSchema();
|
|
5392
5392
|
init_pgSchema();
|
|
5393
5393
|
init_sqliteSchema();
|
|
5394
|
-
dialect3 = enumType(["
|
|
5394
|
+
dialect3 = enumType(["pg", "mysql", "sqlite"]);
|
|
5395
5395
|
commonSquashedSchema = unionType([
|
|
5396
5396
|
pgSchemaSquashed,
|
|
5397
5397
|
mysqlSchemaSquashed,
|
|
@@ -5511,8 +5511,8 @@ var init_cli = __esm({
|
|
|
5511
5511
|
dialect: dialect3,
|
|
5512
5512
|
schema: unionType([stringType(), stringType().array()]).optional(),
|
|
5513
5513
|
tablesFilter: unionType([stringType(), stringType().array()]).optional(),
|
|
5514
|
-
|
|
5515
|
-
driver: stringType()
|
|
5514
|
+
schemaFilters: unionType([stringType(), stringType().array()]).optional().default(["public"]),
|
|
5515
|
+
driver: stringType(),
|
|
5516
5516
|
// pg
|
|
5517
5517
|
connectionString: stringType().optional(),
|
|
5518
5518
|
// mysql
|
|
@@ -5548,9 +5548,9 @@ var init_cli = __esm({
|
|
|
5548
5548
|
ssl: stringType().optional(),
|
|
5549
5549
|
url: stringType().optional(),
|
|
5550
5550
|
authToken: stringType().optional(),
|
|
5551
|
-
|
|
5551
|
+
"introspect-casing": casing,
|
|
5552
5552
|
breakpoints: booleanType().optional().default(true)
|
|
5553
|
-
})
|
|
5553
|
+
});
|
|
5554
5554
|
configCheck = objectType({
|
|
5555
5555
|
dialect: dialect3.optional(),
|
|
5556
5556
|
out: stringType().optional()
|
|
@@ -11502,7 +11502,7 @@ ${withStyle.errorWarning(
|
|
|
11502
11502
|
);
|
|
11503
11503
|
return {
|
|
11504
11504
|
version: "6",
|
|
11505
|
-
dialect: "
|
|
11505
|
+
dialect: "pg",
|
|
11506
11506
|
tables: result,
|
|
11507
11507
|
enums: enumsToReturn,
|
|
11508
11508
|
schemas: schemasObject,
|
|
@@ -11709,7 +11709,7 @@ ${withStyle.errorWarning(
|
|
|
11709
11709
|
const columnName = columnResponse.attname;
|
|
11710
11710
|
const columnAdditionalDT = columnResponse.additional_dt;
|
|
11711
11711
|
const columnDimensions = columnResponse.array_dimensions;
|
|
11712
|
-
const
|
|
11712
|
+
const enumType2 = columnResponse.enum_name;
|
|
11713
11713
|
let columnType = columnResponse.data_type;
|
|
11714
11714
|
const primaryKey = tableConstraints.filter(
|
|
11715
11715
|
(mapRow) => columnName === mapRow.column_name && mapRow.constraint_type === "PRIMARY KEY"
|
|
@@ -11773,8 +11773,8 @@ ${withStyle.errorWarning(
|
|
|
11773
11773
|
columnTypeMapped = trimChar(columnTypeMapped, '"');
|
|
11774
11774
|
columnToReturn[columnName] = {
|
|
11775
11775
|
name: columnName,
|
|
11776
|
-
type: columnAdditionalDT === "USER-DEFINED" ?
|
|
11777
|
-
typeSchema: enumsToReturn[`${tableSchema}.${
|
|
11776
|
+
type: columnAdditionalDT === "USER-DEFINED" ? enumType2 : columnTypeMapped,
|
|
11777
|
+
typeSchema: enumsToReturn[`${tableSchema}.${enumType2}`] !== void 0 ? enumsToReturn[`${tableSchema}.${enumType2}`].schema : void 0,
|
|
11778
11778
|
primaryKey: primaryKey.length === 1 && cprimaryKey.length < 2,
|
|
11779
11779
|
// default: isSerial ? undefined : defaultValue,
|
|
11780
11780
|
notNull: columnResponse.is_nullable === "NO"
|
|
@@ -11857,7 +11857,7 @@ ${withStyle.errorWarning(
|
|
|
11857
11857
|
const schemasObject = Object.fromEntries([...schemas].map((it) => [it, it]));
|
|
11858
11858
|
return {
|
|
11859
11859
|
version: "6",
|
|
11860
|
-
dialect: "
|
|
11860
|
+
dialect: "pg",
|
|
11861
11861
|
tables: result,
|
|
11862
11862
|
enums: enumsToReturn,
|
|
11863
11863
|
schemas: schemasObject,
|
|
@@ -15088,7 +15088,7 @@ var init_snapshotsDiffer = __esm({
|
|
|
15088
15088
|
const jsonTableAlternations = alteredTables.map((it) => {
|
|
15089
15089
|
return preparePgAlterColumns(it.name, it.schema, it.altered, json2);
|
|
15090
15090
|
}).flat();
|
|
15091
|
-
const
|
|
15091
|
+
const jsonCreateIndexesForAllAlteredTables = alteredTables.map((it) => {
|
|
15092
15092
|
return prepareCreateIndexesJson(
|
|
15093
15093
|
it.name,
|
|
15094
15094
|
it.schema,
|
|
@@ -15117,21 +15117,14 @@ var init_snapshotsDiffer = __esm({
|
|
|
15117
15117
|
},
|
|
15118
15118
|
{}
|
|
15119
15119
|
);
|
|
15120
|
-
|
|
15120
|
+
jsonCreateIndexesForAllAlteredTables.push(
|
|
15121
15121
|
...prepareCreateIndexesJson(it.name, it.schema, createdIndexes || {})
|
|
15122
15122
|
);
|
|
15123
15123
|
jsonDropIndexesForAllAlteredTables.push(
|
|
15124
15124
|
...prepareDropIndexesJson(it.name, it.schema, droppedIndexes || {})
|
|
15125
15125
|
);
|
|
15126
15126
|
});
|
|
15127
|
-
const
|
|
15128
|
-
return prepareCreateReferencesJson(
|
|
15129
|
-
it.name,
|
|
15130
|
-
it.schema,
|
|
15131
|
-
it.foreignKeys
|
|
15132
|
-
);
|
|
15133
|
-
}).flat();
|
|
15134
|
-
const jsonReferencesForAlteredTables = alteredTables.map((it) => {
|
|
15127
|
+
const jsonReferencesForAllAlteredTables = alteredTables.map((it) => {
|
|
15135
15128
|
const forAdded = prepareCreateReferencesJson(
|
|
15136
15129
|
it.name,
|
|
15137
15130
|
it.schema,
|
|
@@ -15149,10 +15142,10 @@ var init_snapshotsDiffer = __esm({
|
|
|
15149
15142
|
);
|
|
15150
15143
|
return [...forAdded, ...forAltered, ...alteredFKs];
|
|
15151
15144
|
}).flat();
|
|
15152
|
-
const jsonCreatedReferencesForAlteredTables =
|
|
15145
|
+
const jsonCreatedReferencesForAlteredTables = jsonReferencesForAllAlteredTables.filter(
|
|
15153
15146
|
(t) => t.type === "create_reference"
|
|
15154
15147
|
);
|
|
15155
|
-
const jsonDroppedReferencesForAlteredTables =
|
|
15148
|
+
const jsonDroppedReferencesForAlteredTables = jsonReferencesForAllAlteredTables.filter(
|
|
15156
15149
|
(t) => t.type === "delete_reference"
|
|
15157
15150
|
);
|
|
15158
15151
|
const createEnums = createdEnums.map((it) => {
|
|
@@ -15179,7 +15172,7 @@ var init_snapshotsDiffer = __esm({
|
|
|
15179
15172
|
const dropSchemas = prepareDeleteSchemasJson(
|
|
15180
15173
|
deletedSchemas.map((it) => it.name)
|
|
15181
15174
|
);
|
|
15182
|
-
const
|
|
15175
|
+
const jsonPgCreateTables = createdTables.map((it) => {
|
|
15183
15176
|
return preparePgCreateTableJson(it, curFull);
|
|
15184
15177
|
});
|
|
15185
15178
|
jsonStatements.push(...createSchemas);
|
|
@@ -15188,7 +15181,7 @@ var init_snapshotsDiffer = __esm({
|
|
|
15188
15181
|
jsonStatements.push(...moveEnums);
|
|
15189
15182
|
jsonStatements.push(...renameEnums);
|
|
15190
15183
|
jsonStatements.push(...jsonAlterEnumsWithAddedValues);
|
|
15191
|
-
jsonStatements.push(...
|
|
15184
|
+
jsonStatements.push(...jsonPgCreateTables);
|
|
15192
15185
|
jsonStatements.push(...jsonDropTables);
|
|
15193
15186
|
jsonStatements.push(...jsonSetTableSchemas);
|
|
15194
15187
|
jsonStatements.push(...jsonRenameTables);
|
|
@@ -15199,16 +15192,15 @@ var init_snapshotsDiffer = __esm({
|
|
|
15199
15192
|
jsonStatements.push(...jsonTableAlternations);
|
|
15200
15193
|
jsonStatements.push(...jsonAddedCompositePKs);
|
|
15201
15194
|
jsonStatements.push(...jsonAddColumnsStatemets);
|
|
15202
|
-
jsonStatements.push(...jsonCreateReferencesForCreatedTables);
|
|
15203
15195
|
jsonStatements.push(...jsonCreateIndexesForCreatedTables);
|
|
15196
|
+
jsonStatements.push(...jsonCreateIndexesForAllAlteredTables);
|
|
15204
15197
|
jsonStatements.push(...jsonCreatedReferencesForAlteredTables);
|
|
15205
|
-
jsonStatements.push(...jsonCreateIndexesFoAlteredTables);
|
|
15206
15198
|
jsonStatements.push(...jsonDropColumnsStatemets);
|
|
15207
15199
|
jsonStatements.push(...jsonAlteredCompositePKs);
|
|
15208
15200
|
jsonStatements.push(...jsonAlteredUniqueConstraints);
|
|
15209
15201
|
jsonStatements.push(...dropEnums);
|
|
15210
15202
|
jsonStatements.push(...dropSchemas);
|
|
15211
|
-
const sqlStatements = fromJson(jsonStatements, "
|
|
15203
|
+
const sqlStatements = fromJson(jsonStatements, "pg");
|
|
15212
15204
|
const uniqueSqlStatements = [];
|
|
15213
15205
|
sqlStatements.forEach((ss) => {
|
|
15214
15206
|
if (!uniqueSqlStatements.includes(ss)) {
|
|
@@ -15346,8 +15338,8 @@ var init_snapshotsDiffer = __esm({
|
|
|
15346
15338
|
const jsonDeletedUniqueConstraints = [];
|
|
15347
15339
|
const jsonAlteredUniqueConstraints = [];
|
|
15348
15340
|
const jsonRenameColumnsStatements = columnRenames.map((it) => prepareRenameColumns(it.table, "", it.renames)).flat();
|
|
15349
|
-
const jsonAddColumnsStatemets = columnCreates.map((it) => _prepareAddColumns(it.table, "", it.columns)).flat();
|
|
15350
15341
|
const jsonDropColumnsStatemets = columnDeletes.map((it) => _prepareDropColumns(it.table, "", it.columns)).flat();
|
|
15342
|
+
const jsonAddColumnsStatemets = columnDeletes.map((it) => _prepareAddColumns(it.table, "", it.columns)).flat();
|
|
15351
15343
|
alteredTables.forEach((it) => {
|
|
15352
15344
|
let addedColumns = [];
|
|
15353
15345
|
for (const addedPkName of Object.keys(it.addedCompositePKs)) {
|
|
@@ -15461,13 +15453,6 @@ var init_snapshotsDiffer = __esm({
|
|
|
15461
15453
|
...prepareDropIndexesJson(it.name, it.schema, droppedIndexes || {})
|
|
15462
15454
|
);
|
|
15463
15455
|
});
|
|
15464
|
-
const jsonCreateReferencesForCreatedTables = createdTables.map((it) => {
|
|
15465
|
-
return prepareCreateReferencesJson(
|
|
15466
|
-
it.name,
|
|
15467
|
-
it.schema,
|
|
15468
|
-
it.foreignKeys
|
|
15469
|
-
);
|
|
15470
|
-
}).flat();
|
|
15471
15456
|
const jsonReferencesForAllAlteredTables = alteredTables.map((it) => {
|
|
15472
15457
|
const forAdded = prepareCreateReferencesJson(
|
|
15473
15458
|
it.name,
|
|
@@ -15508,10 +15493,9 @@ var init_snapshotsDiffer = __esm({
|
|
|
15508
15493
|
jsonStatements.push(...jsonAddedUniqueConstraints);
|
|
15509
15494
|
jsonStatements.push(...jsonDeletedUniqueConstraints);
|
|
15510
15495
|
jsonStatements.push(...jsonAddColumnsStatemets);
|
|
15511
|
-
jsonStatements.push(...jsonCreateReferencesForCreatedTables);
|
|
15512
15496
|
jsonStatements.push(...jsonCreateIndexesForCreatedTables);
|
|
15513
|
-
jsonStatements.push(...jsonCreatedReferencesForAlteredTables);
|
|
15514
15497
|
jsonStatements.push(...jsonCreateIndexesForAllAlteredTables);
|
|
15498
|
+
jsonStatements.push(...jsonCreatedReferencesForAlteredTables);
|
|
15515
15499
|
jsonStatements.push(...jsonDropColumnsStatemets);
|
|
15516
15500
|
jsonStatements.push(...jsonAlteredCompositePKs);
|
|
15517
15501
|
jsonStatements.push(...jsonAddedUniqueConstraints);
|
|
@@ -16096,7 +16080,7 @@ var init_sqlgenerator = __esm({
|
|
|
16096
16080
|
};
|
|
16097
16081
|
PgCreateTableConvertor = class extends Convertor {
|
|
16098
16082
|
can(statement, dialect7) {
|
|
16099
|
-
return statement.type === "create_table" && dialect7 === "
|
|
16083
|
+
return statement.type === "create_table" && dialect7 === "pg";
|
|
16100
16084
|
}
|
|
16101
16085
|
convert(st) {
|
|
16102
16086
|
const { tableName, schema: schema4, columns, compositePKs, uniqueConstraints } = st;
|
|
@@ -16238,7 +16222,7 @@ var init_sqlgenerator = __esm({
|
|
|
16238
16222
|
};
|
|
16239
16223
|
PgAlterTableAddUniqueConstraintConvertor = class extends Convertor {
|
|
16240
16224
|
can(statement, dialect7) {
|
|
16241
|
-
return statement.type === "create_unique_constraint" && dialect7 === "
|
|
16225
|
+
return statement.type === "create_unique_constraint" && dialect7 === "pg";
|
|
16242
16226
|
}
|
|
16243
16227
|
convert(statement) {
|
|
16244
16228
|
const unsquashed = PgSquasher.unsquashUnique(statement.data);
|
|
@@ -16248,7 +16232,7 @@ var init_sqlgenerator = __esm({
|
|
|
16248
16232
|
};
|
|
16249
16233
|
PgAlterTableDropUniqueConstraintConvertor = class extends Convertor {
|
|
16250
16234
|
can(statement, dialect7) {
|
|
16251
|
-
return statement.type === "delete_unique_constraint" && dialect7 === "
|
|
16235
|
+
return statement.type === "delete_unique_constraint" && dialect7 === "pg";
|
|
16252
16236
|
}
|
|
16253
16237
|
convert(statement) {
|
|
16254
16238
|
const unsquashed = PgSquasher.unsquashUnique(statement.data);
|
|
@@ -16337,7 +16321,7 @@ var init_sqlgenerator = __esm({
|
|
|
16337
16321
|
};
|
|
16338
16322
|
PgDropTableConvertor = class extends Convertor {
|
|
16339
16323
|
can(statement, dialect7) {
|
|
16340
|
-
return statement.type === "drop_table" && dialect7 === "
|
|
16324
|
+
return statement.type === "drop_table" && dialect7 === "pg";
|
|
16341
16325
|
}
|
|
16342
16326
|
convert(statement) {
|
|
16343
16327
|
const { tableName, schema: schema4 } = statement;
|
|
@@ -16365,7 +16349,7 @@ var init_sqlgenerator = __esm({
|
|
|
16365
16349
|
};
|
|
16366
16350
|
PgRenameTableConvertor = class extends Convertor {
|
|
16367
16351
|
can(statement, dialect7) {
|
|
16368
|
-
return statement.type === "rename_table" && dialect7 === "
|
|
16352
|
+
return statement.type === "rename_table" && dialect7 === "pg";
|
|
16369
16353
|
}
|
|
16370
16354
|
convert(statement) {
|
|
16371
16355
|
const { tableNameFrom, tableNameTo, toSchema, fromSchema } = statement;
|
|
@@ -16396,7 +16380,7 @@ var init_sqlgenerator = __esm({
|
|
|
16396
16380
|
};
|
|
16397
16381
|
PgAlterTableRenameColumnConvertor = class extends Convertor {
|
|
16398
16382
|
can(statement, dialect7) {
|
|
16399
|
-
return statement.type === "alter_table_rename_column" && dialect7 === "
|
|
16383
|
+
return statement.type === "alter_table_rename_column" && dialect7 === "pg";
|
|
16400
16384
|
}
|
|
16401
16385
|
convert(statement) {
|
|
16402
16386
|
const { tableName, oldColumnName, newColumnName, schema: schema4 } = statement;
|
|
@@ -16424,7 +16408,7 @@ var init_sqlgenerator = __esm({
|
|
|
16424
16408
|
};
|
|
16425
16409
|
PgAlterTableDropColumnConvertor = class extends Convertor {
|
|
16426
16410
|
can(statement, dialect7) {
|
|
16427
|
-
return statement.type === "alter_table_drop_column" && dialect7 === "
|
|
16411
|
+
return statement.type === "alter_table_drop_column" && dialect7 === "pg";
|
|
16428
16412
|
}
|
|
16429
16413
|
convert(statement) {
|
|
16430
16414
|
const { tableName, columnName, schema: schema4 } = statement;
|
|
@@ -16452,7 +16436,7 @@ var init_sqlgenerator = __esm({
|
|
|
16452
16436
|
};
|
|
16453
16437
|
PgAlterTableAddColumnConvertor = class extends Convertor {
|
|
16454
16438
|
can(statement, dialect7) {
|
|
16455
|
-
return statement.type === "alter_table_add_column" && dialect7 === "
|
|
16439
|
+
return statement.type === "alter_table_add_column" && dialect7 === "pg";
|
|
16456
16440
|
}
|
|
16457
16441
|
convert(statement) {
|
|
16458
16442
|
const { tableName, column: column4, schema: schema4 } = statement;
|
|
@@ -16497,7 +16481,7 @@ var init_sqlgenerator = __esm({
|
|
|
16497
16481
|
};
|
|
16498
16482
|
PgAlterTableAlterColumnSetTypeConvertor = class extends Convertor {
|
|
16499
16483
|
can(statement, dialect7) {
|
|
16500
|
-
return statement.type === "alter_table_alter_column_set_type" && dialect7 === "
|
|
16484
|
+
return statement.type === "alter_table_alter_column_set_type" && dialect7 === "pg";
|
|
16501
16485
|
}
|
|
16502
16486
|
convert(statement) {
|
|
16503
16487
|
const { tableName, columnName, newDataType, schema: schema4 } = statement;
|
|
@@ -16522,7 +16506,7 @@ var init_sqlgenerator = __esm({
|
|
|
16522
16506
|
};
|
|
16523
16507
|
PgAlterTableAlterColumnSetDefaultConvertor = class extends Convertor {
|
|
16524
16508
|
can(statement, dialect7) {
|
|
16525
|
-
return statement.type === "alter_table_alter_column_set_default" && dialect7 === "
|
|
16509
|
+
return statement.type === "alter_table_alter_column_set_default" && dialect7 === "pg";
|
|
16526
16510
|
}
|
|
16527
16511
|
convert(statement) {
|
|
16528
16512
|
const { tableName, columnName, schema: schema4 } = statement;
|
|
@@ -16547,7 +16531,7 @@ var init_sqlgenerator = __esm({
|
|
|
16547
16531
|
};
|
|
16548
16532
|
PgAlterTableAlterColumnDropDefaultConvertor = class extends Convertor {
|
|
16549
16533
|
can(statement, dialect7) {
|
|
16550
|
-
return statement.type === "alter_table_alter_column_drop_default" && dialect7 === "
|
|
16534
|
+
return statement.type === "alter_table_alter_column_drop_default" && dialect7 === "pg";
|
|
16551
16535
|
}
|
|
16552
16536
|
convert(statement) {
|
|
16553
16537
|
const { tableName, columnName, schema: schema4 } = statement;
|
|
@@ -16659,7 +16643,7 @@ var init_sqlgenerator = __esm({
|
|
|
16659
16643
|
};
|
|
16660
16644
|
PgAlterTableCreateCompositePrimaryKeyConvertor = class extends Convertor {
|
|
16661
16645
|
can(statement, dialect7) {
|
|
16662
|
-
return statement.type === "create_composite_pk" && dialect7 === "
|
|
16646
|
+
return statement.type === "create_composite_pk" && dialect7 === "pg";
|
|
16663
16647
|
}
|
|
16664
16648
|
convert(statement) {
|
|
16665
16649
|
const { name, columns } = PgSquasher.unsquashPK(statement.data);
|
|
@@ -16669,7 +16653,7 @@ var init_sqlgenerator = __esm({
|
|
|
16669
16653
|
};
|
|
16670
16654
|
PgAlterTableDeleteCompositePrimaryKeyConvertor = class extends Convertor {
|
|
16671
16655
|
can(statement, dialect7) {
|
|
16672
|
-
return statement.type === "delete_composite_pk" && dialect7 === "
|
|
16656
|
+
return statement.type === "delete_composite_pk" && dialect7 === "pg";
|
|
16673
16657
|
}
|
|
16674
16658
|
convert(statement) {
|
|
16675
16659
|
const { name, columns } = PgSquasher.unsquashPK(statement.data);
|
|
@@ -16679,7 +16663,7 @@ var init_sqlgenerator = __esm({
|
|
|
16679
16663
|
};
|
|
16680
16664
|
PgAlterTableAlterCompositePrimaryKeyConvertor = class extends Convertor {
|
|
16681
16665
|
can(statement, dialect7) {
|
|
16682
|
-
return statement.type === "alter_composite_pk" && dialect7 === "
|
|
16666
|
+
return statement.type === "alter_composite_pk" && dialect7 === "pg";
|
|
16683
16667
|
}
|
|
16684
16668
|
convert(statement) {
|
|
16685
16669
|
const { name, columns } = PgSquasher.unsquashPK(statement.old);
|
|
@@ -16802,7 +16786,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
16802
16786
|
};
|
|
16803
16787
|
PgAlterTableAlterColumnSetPrimaryKeyConvertor = class extends Convertor {
|
|
16804
16788
|
can(statement, dialect7) {
|
|
16805
|
-
return statement.type === "alter_table_alter_column_set_pk" && dialect7 === "
|
|
16789
|
+
return statement.type === "alter_table_alter_column_set_pk" && dialect7 === "pg";
|
|
16806
16790
|
}
|
|
16807
16791
|
convert(statement) {
|
|
16808
16792
|
const { tableName, columnName } = statement;
|
|
@@ -16812,7 +16796,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
16812
16796
|
};
|
|
16813
16797
|
PgAlterTableAlterColumnDropPrimaryKeyConvertor = class extends Convertor {
|
|
16814
16798
|
can(statement, dialect7) {
|
|
16815
|
-
return statement.type === "alter_table_alter_column_drop_pk" && dialect7 === "
|
|
16799
|
+
return statement.type === "alter_table_alter_column_drop_pk" && dialect7 === "pg";
|
|
16816
16800
|
}
|
|
16817
16801
|
convert(statement) {
|
|
16818
16802
|
const { tableName, columnName, schema: schema4 } = statement;
|
|
@@ -16836,7 +16820,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
16836
16820
|
};
|
|
16837
16821
|
PgAlterTableAlterColumnSetNotNullConvertor = class extends Convertor {
|
|
16838
16822
|
can(statement, dialect7) {
|
|
16839
|
-
return statement.type === "alter_table_alter_column_set_notnull" && dialect7 === "
|
|
16823
|
+
return statement.type === "alter_table_alter_column_set_notnull" && dialect7 === "pg";
|
|
16840
16824
|
}
|
|
16841
16825
|
convert(statement) {
|
|
16842
16826
|
const { tableName, columnName } = statement;
|
|
@@ -16891,7 +16875,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
16891
16875
|
};
|
|
16892
16876
|
PgAlterTableAlterColumnDropNotNullConvertor = class extends Convertor {
|
|
16893
16877
|
can(statement, dialect7) {
|
|
16894
|
-
return statement.type === "alter_table_alter_column_drop_notnull" && dialect7 === "
|
|
16878
|
+
return statement.type === "alter_table_alter_column_drop_notnull" && dialect7 === "pg";
|
|
16895
16879
|
}
|
|
16896
16880
|
convert(statement) {
|
|
16897
16881
|
const { tableName, columnName } = statement;
|
|
@@ -16916,7 +16900,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
16916
16900
|
};
|
|
16917
16901
|
PgCreateForeignKeyConvertor = class extends Convertor {
|
|
16918
16902
|
can(statement, dialect7) {
|
|
16919
|
-
return statement.type === "create_reference" && dialect7 === "
|
|
16903
|
+
return statement.type === "create_reference" && dialect7 === "pg";
|
|
16920
16904
|
}
|
|
16921
16905
|
convert(statement) {
|
|
16922
16906
|
const {
|
|
@@ -16981,7 +16965,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
16981
16965
|
};
|
|
16982
16966
|
PgAlterForeignKeyConvertor = class extends Convertor {
|
|
16983
16967
|
can(statement, dialect7) {
|
|
16984
|
-
return statement.type === "alter_reference" && dialect7 === "
|
|
16968
|
+
return statement.type === "alter_reference" && dialect7 === "pg";
|
|
16985
16969
|
}
|
|
16986
16970
|
convert(statement) {
|
|
16987
16971
|
const newFk = PgSquasher.unsquashFK(statement.data);
|
|
@@ -17020,7 +17004,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17020
17004
|
};
|
|
17021
17005
|
PgDeleteForeignKeyConvertor = class extends Convertor {
|
|
17022
17006
|
can(statement, dialect7) {
|
|
17023
|
-
return statement.type === "delete_reference" && dialect7 === "
|
|
17007
|
+
return statement.type === "delete_reference" && dialect7 === "pg";
|
|
17024
17008
|
}
|
|
17025
17009
|
convert(statement) {
|
|
17026
17010
|
const tableFrom = statement.tableName;
|
|
@@ -17057,7 +17041,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17057
17041
|
};
|
|
17058
17042
|
CreatePgIndexConvertor = class extends Convertor {
|
|
17059
17043
|
can(statement, dialect7) {
|
|
17060
|
-
return statement.type === "create_index" && dialect7 === "
|
|
17044
|
+
return statement.type === "create_index" && dialect7 === "pg";
|
|
17061
17045
|
}
|
|
17062
17046
|
convert(statement) {
|
|
17063
17047
|
const { name, columns, isUnique } = PgSquasher.unsquashIdx(statement.data);
|
|
@@ -17096,7 +17080,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17096
17080
|
};
|
|
17097
17081
|
PgDropIndexConvertor = class extends Convertor {
|
|
17098
17082
|
can(statement, dialect7) {
|
|
17099
|
-
return statement.type === "drop_index" && dialect7 === "
|
|
17083
|
+
return statement.type === "drop_index" && dialect7 === "pg";
|
|
17100
17084
|
}
|
|
17101
17085
|
convert(statement) {
|
|
17102
17086
|
const { name } = PgSquasher.unsquashIdx(statement.data);
|
|
@@ -17105,7 +17089,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17105
17089
|
};
|
|
17106
17090
|
PgCreateSchemaConvertor = class extends Convertor {
|
|
17107
17091
|
can(statement, dialect7) {
|
|
17108
|
-
return statement.type === "create_schema" && dialect7 === "
|
|
17092
|
+
return statement.type === "create_schema" && dialect7 === "pg";
|
|
17109
17093
|
}
|
|
17110
17094
|
convert(statement) {
|
|
17111
17095
|
const { name } = statement;
|
|
@@ -17115,7 +17099,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17115
17099
|
};
|
|
17116
17100
|
PgRenameSchemaConvertor = class extends Convertor {
|
|
17117
17101
|
can(statement, dialect7) {
|
|
17118
|
-
return statement.type === "rename_schema" && dialect7 === "
|
|
17102
|
+
return statement.type === "rename_schema" && dialect7 === "pg";
|
|
17119
17103
|
}
|
|
17120
17104
|
convert(statement) {
|
|
17121
17105
|
const { from, to } = statement;
|
|
@@ -17125,7 +17109,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17125
17109
|
};
|
|
17126
17110
|
PgDropSchemaConvertor = class extends Convertor {
|
|
17127
17111
|
can(statement, dialect7) {
|
|
17128
|
-
return statement.type === "drop_schema" && dialect7 === "
|
|
17112
|
+
return statement.type === "drop_schema" && dialect7 === "pg";
|
|
17129
17113
|
}
|
|
17130
17114
|
convert(statement) {
|
|
17131
17115
|
const { name } = statement;
|
|
@@ -17135,7 +17119,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17135
17119
|
};
|
|
17136
17120
|
PgAlterTableSetSchemaConvertor = class extends Convertor {
|
|
17137
17121
|
can(statement, dialect7) {
|
|
17138
|
-
return statement.type === "alter_table_set_schema" && dialect7 === "
|
|
17122
|
+
return statement.type === "alter_table_set_schema" && dialect7 === "pg";
|
|
17139
17123
|
}
|
|
17140
17124
|
convert(statement) {
|
|
17141
17125
|
const { tableName, schemaFrom, schemaTo } = statement;
|
|
@@ -17145,7 +17129,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17145
17129
|
};
|
|
17146
17130
|
PgAlterTableSetNewSchemaConvertor = class extends Convertor {
|
|
17147
17131
|
can(statement, dialect7) {
|
|
17148
|
-
return statement.type === "alter_table_set_new_schema" && dialect7 === "
|
|
17132
|
+
return statement.type === "alter_table_set_new_schema" && dialect7 === "pg";
|
|
17149
17133
|
}
|
|
17150
17134
|
convert(statement) {
|
|
17151
17135
|
const { tableName, to, from } = statement;
|
|
@@ -17156,7 +17140,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17156
17140
|
};
|
|
17157
17141
|
PgAlterTableRemoveFromSchemaConvertor = class extends Convertor {
|
|
17158
17142
|
can(statement, dialect7) {
|
|
17159
|
-
return statement.type === "alter_table_remove_from_schema" && dialect7 === "
|
|
17143
|
+
return statement.type === "alter_table_remove_from_schema" && dialect7 === "pg";
|
|
17160
17144
|
}
|
|
17161
17145
|
convert(statement) {
|
|
17162
17146
|
const { tableName, schema: schema4 } = statement;
|
|
@@ -18936,7 +18920,7 @@ var pgSuggestions = async (db, statements) => {
|
|
|
18936
18920
|
}
|
|
18937
18921
|
}
|
|
18938
18922
|
}
|
|
18939
|
-
const stmnt = fromJson([statement], "
|
|
18923
|
+
const stmnt = fromJson([statement], "pg")[0];
|
|
18940
18924
|
if (typeof stmnt !== "undefined") {
|
|
18941
18925
|
if (statement.type === "drop_table") {
|
|
18942
18926
|
statementsToExecute.push(
|