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