drizzle-kit 1.0.0-beta.2-84ab15f → 1.0.0-beta.2-2dc306e
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/api-postgres.js +27 -23
- package/api-postgres.mjs +27 -23
- package/bin.cjs +27 -23
- package/package.json +1 -1
package/api-postgres.js
CHANGED
|
@@ -23002,7 +23002,7 @@ var init_convertor = __esm({
|
|
|
23002
23002
|
return [drop, add];
|
|
23003
23003
|
});
|
|
23004
23004
|
alterColumnConvertor = convertor("alter_column", (st) => {
|
|
23005
|
-
const { diff: diff2, to: column8, isEnum, wasEnum } = st;
|
|
23005
|
+
const { diff: diff2, to: column8, isEnum, wasEnum, wasSerial } = st;
|
|
23006
23006
|
const statements = [];
|
|
23007
23007
|
const key = column8.schema !== "public" ? `"${column8.schema}"."${column8.table}"` : `"${column8.table}"`;
|
|
23008
23008
|
const recreateDefault = diff2.type && (isEnum || wasEnum) && (column8.default || diff2.default && diff2.default.from);
|
|
@@ -23012,13 +23012,18 @@ var init_convertor = __esm({
|
|
|
23012
23012
|
if (diff2.type) {
|
|
23013
23013
|
const typeSchema = column8.typeSchema && column8.typeSchema !== "public" ? `"${column8.typeSchema}".` : "";
|
|
23014
23014
|
const textProxy = wasEnum && isEnum ? "text::" : "";
|
|
23015
|
-
const suffix = isEnum ? ` USING "${column8.name}"::${textProxy}${typeSchema}"${column8.type}"${"[]".repeat(column8.dimensions)}` : ""
|
|
23015
|
+
const suffix = isEnum ? ` USING "${column8.name}"::${textProxy}${typeSchema}"${column8.type}"${"[]".repeat(column8.dimensions)}` : ` USING "${column8.name}"::${column8.type}${"[]".repeat(column8.dimensions)}`;
|
|
23016
23016
|
let type;
|
|
23017
23017
|
if (diff2.type) {
|
|
23018
23018
|
type = diff2.typeSchema?.to && diff2.typeSchema.to !== "public" ? `"${diff2.typeSchema.to}"."${diff2.type.to}"` : isEnum ? `"${diff2.type.to}"` : diff2.type.to;
|
|
23019
23019
|
} else {
|
|
23020
23020
|
type = `${typeSchema}${column8.typeSchema ? `"${column8.type}"` : column8.type}`;
|
|
23021
23021
|
}
|
|
23022
|
+
if (wasSerial) {
|
|
23023
|
+
statements.push(`ALTER TABLE ${key} ALTER COLUMN "${column8.name}" DROP DEFAULT`);
|
|
23024
|
+
const sequenceKey = column8.schema !== "public" ? `"${column8.schema}"."${column8.table}_${column8.name}_seq"` : `"${column8.table}_${column8.name}_seq"`;
|
|
23025
|
+
statements.push(`DROP SEQUENCE ${sequenceKey}`);
|
|
23026
|
+
}
|
|
23022
23027
|
statements.push(
|
|
23023
23028
|
`ALTER TABLE ${key} ALTER COLUMN "${column8.name}" SET DATA TYPE ${type}${"[]".repeat(column8.dimensions)}${suffix};`
|
|
23024
23029
|
);
|
|
@@ -23053,6 +23058,11 @@ var init_convertor = __esm({
|
|
|
23053
23058
|
const cycle = identity.cycle ? ` CYCLE` : "";
|
|
23054
23059
|
const identityStatement = `GENERATED ${typeClause} AS IDENTITY (sequence name ${identityWithSchema}${incrementClause}${minClause}${maxClause}${startWith}${cache6}${cycle})`;
|
|
23055
23060
|
statements.push(`ALTER TABLE ${key} ALTER COLUMN "${column8.name}" ADD ${identityStatement};`);
|
|
23061
|
+
if (wasSerial && column8.identity) {
|
|
23062
|
+
statements.push(
|
|
23063
|
+
`SELECT setval('${column8.identity.name}'::regclass, (SELECT COALESCE(MAX(id), 1) FROM ${key}), false);`
|
|
23064
|
+
);
|
|
23065
|
+
}
|
|
23056
23066
|
} else if (diff2.identity.to === null) {
|
|
23057
23067
|
statements.push(`ALTER TABLE ${key} ALTER COLUMN "${column8.name}" DROP IDENTITY;`);
|
|
23058
23068
|
} else {
|
|
@@ -24298,11 +24308,15 @@ var init_diff = __esm({
|
|
|
24298
24308
|
return ddl22.columns.hasDiff(it);
|
|
24299
24309
|
}).map((it) => {
|
|
24300
24310
|
const column8 = it.$right;
|
|
24311
|
+
const wasSerial = isSerialType(it.$left.type);
|
|
24312
|
+
const isEnum = ddl22.enums.one({ schema: column8.typeSchema ?? "public", name: column8.type }) !== null;
|
|
24313
|
+
const wasEnum = (it.type && ddl1.enums.one({ schema: column8.typeSchema ?? "public", name: it.type.from }) !== null) ?? false;
|
|
24301
24314
|
return prepareStatement("alter_column", {
|
|
24302
24315
|
diff: it,
|
|
24303
|
-
|
|
24304
|
-
|
|
24305
|
-
|
|
24316
|
+
to: column8,
|
|
24317
|
+
isEnum,
|
|
24318
|
+
wasEnum,
|
|
24319
|
+
wasSerial
|
|
24306
24320
|
});
|
|
24307
24321
|
});
|
|
24308
24322
|
const createSequences = createdSequences.map((it) => prepareStatement("create_sequence", { sequence: it }));
|
|
@@ -24983,12 +24997,6 @@ var init_introspect = __esm({
|
|
|
24983
24997
|
values: it.values
|
|
24984
24998
|
});
|
|
24985
24999
|
}
|
|
24986
|
-
let columnsCount = 0;
|
|
24987
|
-
let indexesCount = 0;
|
|
24988
|
-
let foreignKeysCount = 0;
|
|
24989
|
-
let tableCount = 0;
|
|
24990
|
-
let checksCount = 0;
|
|
24991
|
-
let viewsCount = 0;
|
|
24992
25000
|
for (const seq of sequencesList) {
|
|
24993
25001
|
const depend = dependList.find((it) => it.oid === seq.oid);
|
|
24994
25002
|
if (depend && (depend.deptype === "a" || depend.deptype === "i")) {
|
|
@@ -25006,7 +25014,6 @@ var init_introspect = __esm({
|
|
|
25006
25014
|
cacheSize: Number(stringFromDatabaseIdentityProperty(seq.cacheSize) ?? 1)
|
|
25007
25015
|
});
|
|
25008
25016
|
}
|
|
25009
|
-
progressCallback("enums", Object.keys(groupedEnums).length, "done");
|
|
25010
25017
|
for (const dbRole of rolesList) {
|
|
25011
25018
|
roles.push({
|
|
25012
25019
|
entityType: "roles",
|
|
@@ -25049,7 +25056,6 @@ var init_introspect = __esm({
|
|
|
25049
25056
|
withCheck: it.withCheck ?? null
|
|
25050
25057
|
});
|
|
25051
25058
|
}
|
|
25052
|
-
progressCallback("policies", policiesList.length, "done");
|
|
25053
25059
|
for (const column8 of columnsList.filter((x6) => x6.kind === "r" || x6.kind === "p")) {
|
|
25054
25060
|
const type = column8.type;
|
|
25055
25061
|
if (!(type === "smallint" || type === "bigint" || type === "integer")) {
|
|
@@ -25328,10 +25334,6 @@ ${JSON.stringify(column8.metadata)}`
|
|
|
25328
25334
|
forPK
|
|
25329
25335
|
});
|
|
25330
25336
|
}
|
|
25331
|
-
progressCallback("columns", columnsCount, "fetching");
|
|
25332
|
-
progressCallback("checks", checksCount, "fetching");
|
|
25333
|
-
progressCallback("indexes", indexesCount, "fetching");
|
|
25334
|
-
progressCallback("tables", tableCount, "done");
|
|
25335
25337
|
for (const it of columnsList.filter((x6) => x6.kind === "m" || x6.kind === "v")) {
|
|
25336
25338
|
const view6 = viewsList.find((x6) => x6.oid === it.tableId);
|
|
25337
25339
|
const typeDimensions = it.type.split("[]").length - 1;
|
|
@@ -25355,7 +25357,6 @@ ${JSON.stringify(column8.metadata)}`
|
|
|
25355
25357
|
});
|
|
25356
25358
|
}
|
|
25357
25359
|
for (const view6 of viewsList) {
|
|
25358
|
-
tableCount += 1;
|
|
25359
25360
|
const accessMethod = view6.accessMethod === 0 ? null : ams.find((it) => it.oid === view6.accessMethod);
|
|
25360
25361
|
const tablespace = view6.tablespaceid === 0 ? null : tablespaces.find((it) => it.oid === view6.tablespaceid).name;
|
|
25361
25362
|
const definition = parseViewDefinition(view6.definition);
|
|
@@ -25407,11 +25408,14 @@ ${JSON.stringify(column8.metadata)}`
|
|
|
25407
25408
|
withNoData: null
|
|
25408
25409
|
});
|
|
25409
25410
|
}
|
|
25410
|
-
progressCallback("
|
|
25411
|
-
progressCallback("
|
|
25412
|
-
progressCallback("
|
|
25413
|
-
progressCallback("
|
|
25414
|
-
progressCallback("views",
|
|
25411
|
+
progressCallback("tables", filteredTables.length, "done");
|
|
25412
|
+
progressCallback("columns", columnsList.length, "done");
|
|
25413
|
+
progressCallback("checks", checks.length, "done");
|
|
25414
|
+
progressCallback("indexes", indexes.length, "fetching");
|
|
25415
|
+
progressCallback("views", viewsList.length, "done");
|
|
25416
|
+
progressCallback("fks", fks.length, "done");
|
|
25417
|
+
progressCallback("enums", Object.keys(groupedEnums).length, "done");
|
|
25418
|
+
progressCallback("policies", policiesList.length, "done");
|
|
25415
25419
|
const resultSchemas = schemas.filter((x6) => filter2({ type: "schema", name: x6.name }));
|
|
25416
25420
|
const resultTables = tables.filter((x6) => filter2({ type: "table", schema: x6.schema, name: x6.name }));
|
|
25417
25421
|
const resultEnums = enums.filter((x6) => resultSchemas.some((s7) => s7.name === x6.schema));
|
package/api-postgres.mjs
CHANGED
|
@@ -23038,7 +23038,7 @@ var init_convertor = __esm({
|
|
|
23038
23038
|
return [drop, add];
|
|
23039
23039
|
});
|
|
23040
23040
|
alterColumnConvertor = convertor("alter_column", (st) => {
|
|
23041
|
-
const { diff: diff2, to: column8, isEnum, wasEnum } = st;
|
|
23041
|
+
const { diff: diff2, to: column8, isEnum, wasEnum, wasSerial } = st;
|
|
23042
23042
|
const statements = [];
|
|
23043
23043
|
const key = column8.schema !== "public" ? `"${column8.schema}"."${column8.table}"` : `"${column8.table}"`;
|
|
23044
23044
|
const recreateDefault = diff2.type && (isEnum || wasEnum) && (column8.default || diff2.default && diff2.default.from);
|
|
@@ -23048,13 +23048,18 @@ var init_convertor = __esm({
|
|
|
23048
23048
|
if (diff2.type) {
|
|
23049
23049
|
const typeSchema = column8.typeSchema && column8.typeSchema !== "public" ? `"${column8.typeSchema}".` : "";
|
|
23050
23050
|
const textProxy = wasEnum && isEnum ? "text::" : "";
|
|
23051
|
-
const suffix = isEnum ? ` USING "${column8.name}"::${textProxy}${typeSchema}"${column8.type}"${"[]".repeat(column8.dimensions)}` : ""
|
|
23051
|
+
const suffix = isEnum ? ` USING "${column8.name}"::${textProxy}${typeSchema}"${column8.type}"${"[]".repeat(column8.dimensions)}` : ` USING "${column8.name}"::${column8.type}${"[]".repeat(column8.dimensions)}`;
|
|
23052
23052
|
let type;
|
|
23053
23053
|
if (diff2.type) {
|
|
23054
23054
|
type = diff2.typeSchema?.to && diff2.typeSchema.to !== "public" ? `"${diff2.typeSchema.to}"."${diff2.type.to}"` : isEnum ? `"${diff2.type.to}"` : diff2.type.to;
|
|
23055
23055
|
} else {
|
|
23056
23056
|
type = `${typeSchema}${column8.typeSchema ? `"${column8.type}"` : column8.type}`;
|
|
23057
23057
|
}
|
|
23058
|
+
if (wasSerial) {
|
|
23059
|
+
statements.push(`ALTER TABLE ${key} ALTER COLUMN "${column8.name}" DROP DEFAULT`);
|
|
23060
|
+
const sequenceKey = column8.schema !== "public" ? `"${column8.schema}"."${column8.table}_${column8.name}_seq"` : `"${column8.table}_${column8.name}_seq"`;
|
|
23061
|
+
statements.push(`DROP SEQUENCE ${sequenceKey}`);
|
|
23062
|
+
}
|
|
23058
23063
|
statements.push(
|
|
23059
23064
|
`ALTER TABLE ${key} ALTER COLUMN "${column8.name}" SET DATA TYPE ${type}${"[]".repeat(column8.dimensions)}${suffix};`
|
|
23060
23065
|
);
|
|
@@ -23089,6 +23094,11 @@ var init_convertor = __esm({
|
|
|
23089
23094
|
const cycle = identity.cycle ? ` CYCLE` : "";
|
|
23090
23095
|
const identityStatement = `GENERATED ${typeClause} AS IDENTITY (sequence name ${identityWithSchema}${incrementClause}${minClause}${maxClause}${startWith}${cache6}${cycle})`;
|
|
23091
23096
|
statements.push(`ALTER TABLE ${key} ALTER COLUMN "${column8.name}" ADD ${identityStatement};`);
|
|
23097
|
+
if (wasSerial && column8.identity) {
|
|
23098
|
+
statements.push(
|
|
23099
|
+
`SELECT setval('${column8.identity.name}'::regclass, (SELECT COALESCE(MAX(id), 1) FROM ${key}), false);`
|
|
23100
|
+
);
|
|
23101
|
+
}
|
|
23092
23102
|
} else if (diff2.identity.to === null) {
|
|
23093
23103
|
statements.push(`ALTER TABLE ${key} ALTER COLUMN "${column8.name}" DROP IDENTITY;`);
|
|
23094
23104
|
} else {
|
|
@@ -24334,11 +24344,15 @@ var init_diff = __esm({
|
|
|
24334
24344
|
return ddl22.columns.hasDiff(it);
|
|
24335
24345
|
}).map((it) => {
|
|
24336
24346
|
const column8 = it.$right;
|
|
24347
|
+
const wasSerial = isSerialType(it.$left.type);
|
|
24348
|
+
const isEnum = ddl22.enums.one({ schema: column8.typeSchema ?? "public", name: column8.type }) !== null;
|
|
24349
|
+
const wasEnum = (it.type && ddl1.enums.one({ schema: column8.typeSchema ?? "public", name: it.type.from }) !== null) ?? false;
|
|
24337
24350
|
return prepareStatement("alter_column", {
|
|
24338
24351
|
diff: it,
|
|
24339
|
-
|
|
24340
|
-
|
|
24341
|
-
|
|
24352
|
+
to: column8,
|
|
24353
|
+
isEnum,
|
|
24354
|
+
wasEnum,
|
|
24355
|
+
wasSerial
|
|
24342
24356
|
});
|
|
24343
24357
|
});
|
|
24344
24358
|
const createSequences = createdSequences.map((it) => prepareStatement("create_sequence", { sequence: it }));
|
|
@@ -25019,12 +25033,6 @@ var init_introspect = __esm({
|
|
|
25019
25033
|
values: it.values
|
|
25020
25034
|
});
|
|
25021
25035
|
}
|
|
25022
|
-
let columnsCount = 0;
|
|
25023
|
-
let indexesCount = 0;
|
|
25024
|
-
let foreignKeysCount = 0;
|
|
25025
|
-
let tableCount = 0;
|
|
25026
|
-
let checksCount = 0;
|
|
25027
|
-
let viewsCount = 0;
|
|
25028
25036
|
for (const seq of sequencesList) {
|
|
25029
25037
|
const depend = dependList.find((it) => it.oid === seq.oid);
|
|
25030
25038
|
if (depend && (depend.deptype === "a" || depend.deptype === "i")) {
|
|
@@ -25042,7 +25050,6 @@ var init_introspect = __esm({
|
|
|
25042
25050
|
cacheSize: Number(stringFromDatabaseIdentityProperty(seq.cacheSize) ?? 1)
|
|
25043
25051
|
});
|
|
25044
25052
|
}
|
|
25045
|
-
progressCallback("enums", Object.keys(groupedEnums).length, "done");
|
|
25046
25053
|
for (const dbRole of rolesList) {
|
|
25047
25054
|
roles.push({
|
|
25048
25055
|
entityType: "roles",
|
|
@@ -25085,7 +25092,6 @@ var init_introspect = __esm({
|
|
|
25085
25092
|
withCheck: it.withCheck ?? null
|
|
25086
25093
|
});
|
|
25087
25094
|
}
|
|
25088
|
-
progressCallback("policies", policiesList.length, "done");
|
|
25089
25095
|
for (const column8 of columnsList.filter((x6) => x6.kind === "r" || x6.kind === "p")) {
|
|
25090
25096
|
const type = column8.type;
|
|
25091
25097
|
if (!(type === "smallint" || type === "bigint" || type === "integer")) {
|
|
@@ -25364,10 +25370,6 @@ ${JSON.stringify(column8.metadata)}`
|
|
|
25364
25370
|
forPK
|
|
25365
25371
|
});
|
|
25366
25372
|
}
|
|
25367
|
-
progressCallback("columns", columnsCount, "fetching");
|
|
25368
|
-
progressCallback("checks", checksCount, "fetching");
|
|
25369
|
-
progressCallback("indexes", indexesCount, "fetching");
|
|
25370
|
-
progressCallback("tables", tableCount, "done");
|
|
25371
25373
|
for (const it of columnsList.filter((x6) => x6.kind === "m" || x6.kind === "v")) {
|
|
25372
25374
|
const view6 = viewsList.find((x6) => x6.oid === it.tableId);
|
|
25373
25375
|
const typeDimensions = it.type.split("[]").length - 1;
|
|
@@ -25391,7 +25393,6 @@ ${JSON.stringify(column8.metadata)}`
|
|
|
25391
25393
|
});
|
|
25392
25394
|
}
|
|
25393
25395
|
for (const view6 of viewsList) {
|
|
25394
|
-
tableCount += 1;
|
|
25395
25396
|
const accessMethod = view6.accessMethod === 0 ? null : ams.find((it) => it.oid === view6.accessMethod);
|
|
25396
25397
|
const tablespace = view6.tablespaceid === 0 ? null : tablespaces.find((it) => it.oid === view6.tablespaceid).name;
|
|
25397
25398
|
const definition = parseViewDefinition(view6.definition);
|
|
@@ -25443,11 +25444,14 @@ ${JSON.stringify(column8.metadata)}`
|
|
|
25443
25444
|
withNoData: null
|
|
25444
25445
|
});
|
|
25445
25446
|
}
|
|
25446
|
-
progressCallback("
|
|
25447
|
-
progressCallback("
|
|
25448
|
-
progressCallback("
|
|
25449
|
-
progressCallback("
|
|
25450
|
-
progressCallback("views",
|
|
25447
|
+
progressCallback("tables", filteredTables.length, "done");
|
|
25448
|
+
progressCallback("columns", columnsList.length, "done");
|
|
25449
|
+
progressCallback("checks", checks.length, "done");
|
|
25450
|
+
progressCallback("indexes", indexes.length, "fetching");
|
|
25451
|
+
progressCallback("views", viewsList.length, "done");
|
|
25452
|
+
progressCallback("fks", fks.length, "done");
|
|
25453
|
+
progressCallback("enums", Object.keys(groupedEnums).length, "done");
|
|
25454
|
+
progressCallback("policies", policiesList.length, "done");
|
|
25451
25455
|
const resultSchemas = schemas.filter((x6) => filter2({ type: "schema", name: x6.name }));
|
|
25452
25456
|
const resultTables = tables.filter((x6) => filter2({ type: "table", schema: x6.schema, name: x6.name }));
|
|
25453
25457
|
const resultEnums = enums.filter((x6) => resultSchemas.some((s7) => s7.name === x6.schema));
|
package/bin.cjs
CHANGED
|
@@ -38986,7 +38986,7 @@ var init_convertor = __esm({
|
|
|
38986
38986
|
});
|
|
38987
38987
|
alterColumnConvertor = convertor("alter_column", (st2) => {
|
|
38988
38988
|
var _a5;
|
|
38989
|
-
const { diff: diff2, to: column12, isEnum, wasEnum } = st2;
|
|
38989
|
+
const { diff: diff2, to: column12, isEnum, wasEnum, wasSerial } = st2;
|
|
38990
38990
|
const statements = [];
|
|
38991
38991
|
const key = column12.schema !== "public" ? `"${column12.schema}"."${column12.table}"` : `"${column12.table}"`;
|
|
38992
38992
|
const recreateDefault = diff2.type && (isEnum || wasEnum) && (column12.default || diff2.default && diff2.default.from);
|
|
@@ -38996,13 +38996,18 @@ var init_convertor = __esm({
|
|
|
38996
38996
|
if (diff2.type) {
|
|
38997
38997
|
const typeSchema = column12.typeSchema && column12.typeSchema !== "public" ? `"${column12.typeSchema}".` : "";
|
|
38998
38998
|
const textProxy = wasEnum && isEnum ? "text::" : "";
|
|
38999
|
-
const suffix = isEnum ? ` USING "${column12.name}"::${textProxy}${typeSchema}"${column12.type}"${"[]".repeat(column12.dimensions)}` : ""
|
|
38999
|
+
const suffix = isEnum ? ` USING "${column12.name}"::${textProxy}${typeSchema}"${column12.type}"${"[]".repeat(column12.dimensions)}` : ` USING "${column12.name}"::${column12.type}${"[]".repeat(column12.dimensions)}`;
|
|
39000
39000
|
let type;
|
|
39001
39001
|
if (diff2.type) {
|
|
39002
39002
|
type = ((_a5 = diff2.typeSchema) == null ? void 0 : _a5.to) && diff2.typeSchema.to !== "public" ? `"${diff2.typeSchema.to}"."${diff2.type.to}"` : isEnum ? `"${diff2.type.to}"` : diff2.type.to;
|
|
39003
39003
|
} else {
|
|
39004
39004
|
type = `${typeSchema}${column12.typeSchema ? `"${column12.type}"` : column12.type}`;
|
|
39005
39005
|
}
|
|
39006
|
+
if (wasSerial) {
|
|
39007
|
+
statements.push(`ALTER TABLE ${key} ALTER COLUMN "${column12.name}" DROP DEFAULT`);
|
|
39008
|
+
const sequenceKey = column12.schema !== "public" ? `"${column12.schema}"."${column12.table}_${column12.name}_seq"` : `"${column12.table}_${column12.name}_seq"`;
|
|
39009
|
+
statements.push(`DROP SEQUENCE ${sequenceKey}`);
|
|
39010
|
+
}
|
|
39006
39011
|
statements.push(
|
|
39007
39012
|
`ALTER TABLE ${key} ALTER COLUMN "${column12.name}" SET DATA TYPE ${type}${"[]".repeat(column12.dimensions)}${suffix};`
|
|
39008
39013
|
);
|
|
@@ -39037,6 +39042,11 @@ var init_convertor = __esm({
|
|
|
39037
39042
|
const cycle = identity.cycle ? ` CYCLE` : "";
|
|
39038
39043
|
const identityStatement = `GENERATED ${typeClause} AS IDENTITY (sequence name ${identityWithSchema}${incrementClause}${minClause}${maxClause}${startWith}${cache4}${cycle})`;
|
|
39039
39044
|
statements.push(`ALTER TABLE ${key} ALTER COLUMN "${column12.name}" ADD ${identityStatement};`);
|
|
39045
|
+
if (wasSerial && column12.identity) {
|
|
39046
|
+
statements.push(
|
|
39047
|
+
`SELECT setval('${column12.identity.name}'::regclass, (SELECT COALESCE(MAX(id), 1) FROM ${key}), false);`
|
|
39048
|
+
);
|
|
39049
|
+
}
|
|
39040
39050
|
} else if (diff2.identity.to === null) {
|
|
39041
39051
|
statements.push(`ALTER TABLE ${key} ALTER COLUMN "${column12.name}" DROP IDENTITY;`);
|
|
39042
39052
|
} else {
|
|
@@ -40283,11 +40293,15 @@ var init_diff = __esm({
|
|
|
40283
40293
|
return ddl22.columns.hasDiff(it2);
|
|
40284
40294
|
}).map((it2) => {
|
|
40285
40295
|
const column12 = it2.$right;
|
|
40296
|
+
const wasSerial = isSerialType(it2.$left.type);
|
|
40297
|
+
const isEnum = ddl22.enums.one({ schema: column12.typeSchema ?? "public", name: column12.type }) !== null;
|
|
40298
|
+
const wasEnum = (it2.type && ddl1.enums.one({ schema: column12.typeSchema ?? "public", name: it2.type.from }) !== null) ?? false;
|
|
40286
40299
|
return prepareStatement("alter_column", {
|
|
40287
40300
|
diff: it2,
|
|
40288
|
-
|
|
40289
|
-
|
|
40290
|
-
|
|
40301
|
+
to: column12,
|
|
40302
|
+
isEnum,
|
|
40303
|
+
wasEnum,
|
|
40304
|
+
wasSerial
|
|
40291
40305
|
});
|
|
40292
40306
|
});
|
|
40293
40307
|
const createSequences = createdSequences.map((it2) => prepareStatement("create_sequence", { sequence: it2 }));
|
|
@@ -169553,12 +169567,6 @@ var init_introspect2 = __esm({
|
|
|
169553
169567
|
values: it2.values
|
|
169554
169568
|
});
|
|
169555
169569
|
}
|
|
169556
|
-
let columnsCount = 0;
|
|
169557
|
-
let indexesCount = 0;
|
|
169558
|
-
let foreignKeysCount = 0;
|
|
169559
|
-
let tableCount = 0;
|
|
169560
|
-
let checksCount = 0;
|
|
169561
|
-
let viewsCount = 0;
|
|
169562
169570
|
for (const seq of sequencesList) {
|
|
169563
169571
|
const depend = dependList.find((it2) => it2.oid === seq.oid);
|
|
169564
169572
|
if (depend && (depend.deptype === "a" || depend.deptype === "i")) {
|
|
@@ -169576,7 +169584,6 @@ var init_introspect2 = __esm({
|
|
|
169576
169584
|
cacheSize: Number(stringFromDatabaseIdentityProperty(seq.cacheSize) ?? 1)
|
|
169577
169585
|
});
|
|
169578
169586
|
}
|
|
169579
|
-
progressCallback("enums", Object.keys(groupedEnums).length, "done");
|
|
169580
169587
|
for (const dbRole of rolesList) {
|
|
169581
169588
|
roles.push({
|
|
169582
169589
|
entityType: "roles",
|
|
@@ -169619,7 +169626,6 @@ var init_introspect2 = __esm({
|
|
|
169619
169626
|
withCheck: it2.withCheck ?? null
|
|
169620
169627
|
});
|
|
169621
169628
|
}
|
|
169622
|
-
progressCallback("policies", policiesList.length, "done");
|
|
169623
169629
|
for (const column12 of columnsList.filter((x6) => x6.kind === "r" || x6.kind === "p")) {
|
|
169624
169630
|
const type = column12.type;
|
|
169625
169631
|
if (!(type === "smallint" || type === "bigint" || type === "integer")) {
|
|
@@ -169898,10 +169904,6 @@ ${JSON.stringify(column12.metadata)}`
|
|
|
169898
169904
|
forPK
|
|
169899
169905
|
});
|
|
169900
169906
|
}
|
|
169901
|
-
progressCallback("columns", columnsCount, "fetching");
|
|
169902
|
-
progressCallback("checks", checksCount, "fetching");
|
|
169903
|
-
progressCallback("indexes", indexesCount, "fetching");
|
|
169904
|
-
progressCallback("tables", tableCount, "done");
|
|
169905
169907
|
for (const it2 of columnsList.filter((x6) => x6.kind === "m" || x6.kind === "v")) {
|
|
169906
169908
|
const view6 = viewsList.find((x6) => x6.oid === it2.tableId);
|
|
169907
169909
|
const typeDimensions = it2.type.split("[]").length - 1;
|
|
@@ -169925,7 +169927,6 @@ ${JSON.stringify(column12.metadata)}`
|
|
|
169925
169927
|
});
|
|
169926
169928
|
}
|
|
169927
169929
|
for (const view6 of viewsList) {
|
|
169928
|
-
tableCount += 1;
|
|
169929
169930
|
const accessMethod = view6.accessMethod === 0 ? null : ams.find((it2) => it2.oid === view6.accessMethod);
|
|
169930
169931
|
const tablespace = view6.tablespaceid === 0 ? null : tablespaces.find((it2) => it2.oid === view6.tablespaceid).name;
|
|
169931
169932
|
const definition = parseViewDefinition(view6.definition);
|
|
@@ -169977,11 +169978,14 @@ ${JSON.stringify(column12.metadata)}`
|
|
|
169977
169978
|
withNoData: null
|
|
169978
169979
|
});
|
|
169979
169980
|
}
|
|
169980
|
-
progressCallback("
|
|
169981
|
-
progressCallback("
|
|
169982
|
-
progressCallback("
|
|
169983
|
-
progressCallback("
|
|
169984
|
-
progressCallback("views",
|
|
169981
|
+
progressCallback("tables", filteredTables.length, "done");
|
|
169982
|
+
progressCallback("columns", columnsList.length, "done");
|
|
169983
|
+
progressCallback("checks", checks.length, "done");
|
|
169984
|
+
progressCallback("indexes", indexes.length, "fetching");
|
|
169985
|
+
progressCallback("views", viewsList.length, "done");
|
|
169986
|
+
progressCallback("fks", fks.length, "done");
|
|
169987
|
+
progressCallback("enums", Object.keys(groupedEnums).length, "done");
|
|
169988
|
+
progressCallback("policies", policiesList.length, "done");
|
|
169985
169989
|
const resultSchemas = schemas.filter((x6) => filter2({ type: "schema", name: x6.name }));
|
|
169986
169990
|
const resultTables = tables.filter((x6) => filter2({ type: "table", schema: x6.schema, name: x6.name }));
|
|
169987
169991
|
const resultEnums = enums.filter((x6) => resultSchemas.some((s6) => s6.name === x6.schema));
|