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