drizzle-kit 0.26.2-4cb1bdb → 0.26.2-53e089b
Sign up to get free protection for your applications and to get access to all the features.
- package/api.d.mts +67 -7
- package/api.d.ts +67 -7
- package/api.js +388 -62
- package/api.mjs +388 -62
- package/bin.cjs +420 -91
- package/index.d.mts +2 -2
- package/index.d.ts +2 -2
- package/package.json +1 -1
- package/utils.js +11 -2
- package/utils.mjs +11 -2
package/bin.cjs
CHANGED
@@ -5832,7 +5832,7 @@ var init_vector = __esm({
|
|
5832
5832
|
});
|
5833
5833
|
|
5834
5834
|
// src/serializer/pgSchema.ts
|
5835
|
-
var indexV2, columnV2, tableV2, enumSchemaV1, enumSchema, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, indexColumn, index2, indexV4, indexV5, indexV6, fk2, sequenceSchema, roleSchema, sequenceSquashed, columnV7, column2, checkConstraint2, columnSquashed, tableV32, compositePK2, uniqueConstraint2, policy, viewWithOption, matViewWithOption, mergedViewWithOption, view2, tableV42, tableV5, tableV6, tableV7, table2, schemaHash2, kitInternals2, pgSchemaInternalV3, pgSchemaInternalV4, pgSchemaInternalV5, pgSchemaInternalV6, pgSchemaExternal, pgSchemaInternalV7, pgSchemaInternal, tableSquashed2, tableSquashedV42, pgSchemaSquashedV4, pgSchemaSquashedV6, pgSchemaSquashed, pgSchemaV3, pgSchemaV4, pgSchemaV5, pgSchemaV6, pgSchemaV7, pgSchema, backwardCompatiblePgSchema, PgSquasher, squashPgScheme, dryPg;
|
5835
|
+
var indexV2, columnV2, tableV2, enumSchemaV1, enumSchema, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, indexColumn, index2, indexV4, indexV5, indexV6, fk2, sequenceSchema, roleSchema, sequenceSquashed, columnV7, column2, checkConstraint2, columnSquashed, tableV32, compositePK2, uniqueConstraint2, policy, policySquashed, viewWithOption, matViewWithOption, mergedViewWithOption, view2, tableV42, tableV5, tableV6, tableV7, table2, schemaHash2, kitInternals2, pgSchemaInternalV3, pgSchemaInternalV4, pgSchemaInternalV5, pgSchemaInternalV6, pgSchemaExternal, pgSchemaInternalV7, pgSchemaInternal, tableSquashed2, tableSquashedV42, pgSchemaSquashedV4, pgSchemaSquashedV6, pgSchemaSquashed, pgSchemaV3, pgSchemaV4, pgSchemaV5, pgSchemaV6, pgSchemaV7, pgSchema, backwardCompatiblePgSchema, PgSquasher, squashPgScheme, dryPg;
|
5836
5836
|
var init_pgSchema = __esm({
|
5837
5837
|
"src/serializer/pgSchema.ts"() {
|
5838
5838
|
"use strict";
|
@@ -6043,7 +6043,12 @@ var init_pgSchema = __esm({
|
|
6043
6043
|
for: enumType(["ALL", "SELECT", "INSERT", "UPDATE", "DELETE"]).optional(),
|
6044
6044
|
to: stringType().array().optional(),
|
6045
6045
|
using: stringType().optional(),
|
6046
|
-
withCheck: stringType().optional()
|
6046
|
+
withCheck: stringType().optional(),
|
6047
|
+
on: stringType().optional()
|
6048
|
+
}).strict();
|
6049
|
+
policySquashed = objectType({
|
6050
|
+
name: stringType(),
|
6051
|
+
values: stringType()
|
6047
6052
|
}).strict();
|
6048
6053
|
viewWithOption = objectType({
|
6049
6054
|
checkOption: enumType(["local", "cascaded"]).optional(),
|
@@ -6223,6 +6228,7 @@ var init_pgSchema = __esm({
|
|
6223
6228
|
views: recordType(stringType(), view2).default({}),
|
6224
6229
|
sequences: recordType(stringType(), sequenceSchema).default({}),
|
6225
6230
|
roles: recordType(stringType(), roleSchema).default({}),
|
6231
|
+
policies: recordType(stringType(), policy).default({}),
|
6226
6232
|
_meta: objectType({
|
6227
6233
|
schemas: recordType(stringType(), stringType()),
|
6228
6234
|
tables: recordType(stringType(), stringType()),
|
@@ -6271,7 +6277,8 @@ var init_pgSchema = __esm({
|
|
6271
6277
|
schemas: recordType(stringType(), stringType()),
|
6272
6278
|
views: recordType(stringType(), view2),
|
6273
6279
|
sequences: recordType(stringType(), sequenceSquashed),
|
6274
|
-
roles: recordType(stringType(), roleSchema).default({})
|
6280
|
+
roles: recordType(stringType(), roleSchema).default({}),
|
6281
|
+
policies: recordType(stringType(), policy).default({})
|
6275
6282
|
}).strict();
|
6276
6283
|
pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
|
6277
6284
|
pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
|
@@ -6354,24 +6361,25 @@ var init_pgSchema = __esm({
|
|
6354
6361
|
squashFK: (fk4) => {
|
6355
6362
|
return `${fk4.name};${fk4.tableFrom};${fk4.columnsFrom.join(",")};${fk4.tableTo};${fk4.columnsTo.join(",")};${fk4.onUpdate ?? ""};${fk4.onDelete ?? ""};${fk4.schemaTo || "public"}`;
|
6356
6363
|
},
|
6357
|
-
squashPolicy: (
|
6364
|
+
squashPolicy: (policy4) => {
|
6358
6365
|
var _a;
|
6359
|
-
return `${
|
6366
|
+
return `${policy4.name}--${policy4.as}--${policy4.for}--${(_a = policy4.to) == null ? void 0 : _a.join(",")}--${policy4.using}--${policy4.withCheck}--${policy4.on}`;
|
6360
6367
|
},
|
6361
|
-
unsquashPolicy: (
|
6362
|
-
const splitted =
|
6368
|
+
unsquashPolicy: (policy4) => {
|
6369
|
+
const splitted = policy4.split("--");
|
6363
6370
|
return {
|
6364
6371
|
name: splitted[0],
|
6365
6372
|
as: splitted[1],
|
6366
6373
|
for: splitted[2],
|
6367
6374
|
to: splitted[3].split(","),
|
6368
6375
|
using: splitted[4] !== "undefined" ? splitted[4] : void 0,
|
6369
|
-
withCheck: splitted[5] !== "undefined" ? splitted[5] : void 0
|
6376
|
+
withCheck: splitted[5] !== "undefined" ? splitted[5] : void 0,
|
6377
|
+
on: splitted[6] !== "undefined" ? splitted[6] : void 0
|
6370
6378
|
};
|
6371
6379
|
},
|
6372
|
-
squashPolicyPush: (
|
6380
|
+
squashPolicyPush: (policy4) => {
|
6373
6381
|
var _a;
|
6374
|
-
return `${
|
6382
|
+
return `${policy4.name}--${policy4.as}--${policy4.for}--${(_a = policy4.to) == null ? void 0 : _a.join(",")}--${policy4.on}`;
|
6375
6383
|
},
|
6376
6384
|
squashPK: (pk) => {
|
6377
6385
|
return `${pk.columns.join(",")};${pk.name}`;
|
@@ -6485,8 +6493,8 @@ var init_pgSchema = __esm({
|
|
6485
6493
|
return PgSquasher.squashUnique(unq);
|
6486
6494
|
}
|
6487
6495
|
);
|
6488
|
-
const squashedPolicies = mapValues(it[1].policies, (
|
6489
|
-
return action === "push" ? PgSquasher.squashPolicyPush(
|
6496
|
+
const squashedPolicies = mapValues(it[1].policies, (policy4) => {
|
6497
|
+
return action === "push" ? PgSquasher.squashPolicyPush(policy4) : PgSquasher.squashPolicy(policy4);
|
6490
6498
|
});
|
6491
6499
|
const squashedChecksContraints = mapValues(
|
6492
6500
|
it[1].checkConstraints,
|
@@ -6523,6 +6531,17 @@ var init_pgSchema = __esm({
|
|
6523
6531
|
];
|
6524
6532
|
})
|
6525
6533
|
);
|
6534
|
+
const mappedPolicies = Object.fromEntries(
|
6535
|
+
Object.entries(json.policies).map((it) => {
|
6536
|
+
return [
|
6537
|
+
it[0],
|
6538
|
+
{
|
6539
|
+
name: it[1].name,
|
6540
|
+
values: action === "push" ? PgSquasher.squashPolicyPush(it[1]) : PgSquasher.squashPolicy(it[1])
|
6541
|
+
}
|
6542
|
+
];
|
6543
|
+
})
|
6544
|
+
);
|
6526
6545
|
return {
|
6527
6546
|
version: "7",
|
6528
6547
|
dialect: json.dialect,
|
@@ -6530,6 +6549,7 @@ var init_pgSchema = __esm({
|
|
6530
6549
|
enums: json.enums,
|
6531
6550
|
schemas: json.schemas,
|
6532
6551
|
views: json.views,
|
6552
|
+
policies: mappedPolicies,
|
6533
6553
|
sequences: mappedSequences,
|
6534
6554
|
roles: json.roles
|
6535
6555
|
};
|
@@ -6542,6 +6562,8 @@ var init_pgSchema = __esm({
|
|
6542
6562
|
tables: {},
|
6543
6563
|
enums: {},
|
6544
6564
|
schemas: {},
|
6565
|
+
policies: {},
|
6566
|
+
roles: {},
|
6545
6567
|
sequences: {},
|
6546
6568
|
_meta: {
|
6547
6569
|
schemas: {},
|
@@ -11681,7 +11703,14 @@ var init_cli = __esm({
|
|
11681
11703
|
schemaFilter: unionType([stringType(), stringType().array()]).optional().default(["public"]),
|
11682
11704
|
extensionsFilters: literalType("postgis").array().optional(),
|
11683
11705
|
verbose: booleanType().optional(),
|
11684
|
-
strict: booleanType().optional()
|
11706
|
+
strict: booleanType().optional(),
|
11707
|
+
entities: objectType({
|
11708
|
+
roles: booleanType().or(objectType({
|
11709
|
+
provider: stringType().optional(),
|
11710
|
+
include: stringType().array().optional(),
|
11711
|
+
exclude: stringType().array().optional()
|
11712
|
+
})).optional().default(false)
|
11713
|
+
}).optional()
|
11685
11714
|
}).passthrough();
|
11686
11715
|
pullParams = objectType({
|
11687
11716
|
config: stringType().optional(),
|
@@ -17791,7 +17820,8 @@ var init_utils4 = __esm({
|
|
17791
17820
|
credentials: parsed2.data,
|
17792
17821
|
casing: config.casing,
|
17793
17822
|
tablesFilter,
|
17794
|
-
schemasFilter
|
17823
|
+
schemasFilter,
|
17824
|
+
entities: config.entities
|
17795
17825
|
};
|
17796
17826
|
}
|
17797
17827
|
if (config.dialect === "mysql") {
|
@@ -17942,7 +17972,8 @@ var init_utils4 = __esm({
|
|
17942
17972
|
credentials: parsed2.data,
|
17943
17973
|
tablesFilter,
|
17944
17974
|
schemasFilter,
|
17945
|
-
prefix: ((_d = config.migrations) == null ? void 0 : _d.prefix) || "index"
|
17975
|
+
prefix: ((_d = config.migrations) == null ? void 0 : _d.prefix) || "index",
|
17976
|
+
entities: config.entities
|
17946
17977
|
};
|
17947
17978
|
}
|
17948
17979
|
assertUnreachable(dialect4);
|
@@ -18970,6 +19001,7 @@ var init_pgImports = __esm({
|
|
18970
19001
|
const schemas = [];
|
18971
19002
|
const sequences = [];
|
18972
19003
|
const roles = [];
|
19004
|
+
const policies = [];
|
18973
19005
|
const views = [];
|
18974
19006
|
const matViews = [];
|
18975
19007
|
const i0values = Object.values(exports2);
|
@@ -18996,8 +19028,11 @@ var init_pgImports = __esm({
|
|
18996
19028
|
if ((0, import_drizzle_orm4.is)(t2, import_pg_core.PgRole)) {
|
18997
19029
|
roles.push(t2);
|
18998
19030
|
}
|
19031
|
+
if ((0, import_drizzle_orm4.is)(t2, import_pg_core.PgPolicy)) {
|
19032
|
+
policies.push(t2);
|
19033
|
+
}
|
18999
19034
|
});
|
19000
|
-
return { tables, enums, schemas, sequences, views, matViews, roles };
|
19035
|
+
return { tables, enums, schemas, sequences, views, matViews, roles, policies };
|
19001
19036
|
};
|
19002
19037
|
prepareFromPgImports = async (imports) => {
|
19003
19038
|
const tables = [];
|
@@ -19005,7 +19040,8 @@ var init_pgImports = __esm({
|
|
19005
19040
|
const schemas = [];
|
19006
19041
|
const sequences = [];
|
19007
19042
|
const views = [];
|
19008
|
-
|
19043
|
+
const roles = [];
|
19044
|
+
const policies = [];
|
19009
19045
|
const matViews = [];
|
19010
19046
|
const { unregister } = await safeRegister();
|
19011
19047
|
for (let i2 = 0; i2 < imports.length; i2++) {
|
@@ -19019,9 +19055,10 @@ var init_pgImports = __esm({
|
|
19019
19055
|
views.push(...prepared.views);
|
19020
19056
|
matViews.push(...prepared.matViews);
|
19021
19057
|
roles.push(...prepared.roles);
|
19058
|
+
policies.push(...prepared.policies);
|
19022
19059
|
}
|
19023
19060
|
unregister();
|
19024
|
-
return { tables: Array.from(new Set(tables)), enums, schemas, sequences, views, matViews, roles };
|
19061
|
+
return { tables: Array.from(new Set(tables)), enums, schemas, sequences, views, matViews, roles, policies };
|
19025
19062
|
};
|
19026
19063
|
}
|
19027
19064
|
});
|
@@ -19119,13 +19156,14 @@ var init_pgSerializer = __esm({
|
|
19119
19156
|
indexName2 = (tableName, columns) => {
|
19120
19157
|
return `${tableName}_${columns.join("_")}_index`;
|
19121
19158
|
};
|
19122
|
-
generatePgSnapshot = (tables, enums, schemas, sequences, roles, views, matViews, casing2, schemaFilter) => {
|
19123
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
19159
|
+
generatePgSnapshot = (tables, enums, schemas, sequences, roles, policies, views, matViews, casing2, schemaFilter) => {
|
19160
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
19124
19161
|
const dialect4 = new import_pg_core2.PgDialect({ casing: casing2 });
|
19125
19162
|
const result = {};
|
19126
19163
|
const resultViews = {};
|
19127
19164
|
const sequencesToReturn = {};
|
19128
19165
|
const rolesToReturn = {};
|
19166
|
+
const policiesToReturn = {};
|
19129
19167
|
const indexesInSchema = {};
|
19130
19168
|
for (const table4 of tables) {
|
19131
19169
|
const checksInTable = {};
|
@@ -19138,7 +19176,7 @@ var init_pgSerializer = __esm({
|
|
19138
19176
|
schema: schema5,
|
19139
19177
|
primaryKeys,
|
19140
19178
|
uniqueConstraints,
|
19141
|
-
policies,
|
19179
|
+
policies: policies2,
|
19142
19180
|
enableRLS
|
19143
19181
|
} = (0, import_pg_core3.getTableConfig)(table4);
|
19144
19182
|
if (schemaFilter && !schemaFilter.includes(schema5 ?? "public")) {
|
@@ -19400,18 +19438,18 @@ ${withStyle.errorWarning(
|
|
19400
19438
|
with: value.config.with ?? {}
|
19401
19439
|
};
|
19402
19440
|
});
|
19403
|
-
|
19441
|
+
policies2.forEach((policy4) => {
|
19404
19442
|
var _a2, _b2;
|
19405
19443
|
const mappedTo = [];
|
19406
|
-
if (!
|
19444
|
+
if (!policy4.to) {
|
19407
19445
|
mappedTo.push("public");
|
19408
19446
|
} else {
|
19409
|
-
if (
|
19410
|
-
mappedTo.push(
|
19411
|
-
} else if (
|
19412
|
-
mappedTo.push(
|
19413
|
-
} else if (
|
19414
|
-
|
19447
|
+
if (policy4.to && typeof policy4.to === "string") {
|
19448
|
+
mappedTo.push(policy4.to);
|
19449
|
+
} else if (policy4.to && (0, import_drizzle_orm5.is)(policy4.to, import_pg_core2.PgRole)) {
|
19450
|
+
mappedTo.push(policy4.to.name);
|
19451
|
+
} else if (policy4.to && Array.isArray(policy4.to)) {
|
19452
|
+
policy4.to.forEach((it) => {
|
19415
19453
|
if (typeof it === "string") {
|
19416
19454
|
mappedTo.push(it);
|
19417
19455
|
} else if ((0, import_drizzle_orm5.is)(it, import_pg_core2.PgRole)) {
|
@@ -19420,13 +19458,24 @@ ${withStyle.errorWarning(
|
|
19420
19458
|
});
|
19421
19459
|
}
|
19422
19460
|
}
|
19423
|
-
policiesObject[
|
19424
|
-
|
19425
|
-
|
19426
|
-
|
19461
|
+
if (policiesObject[policy4.name] !== void 0) {
|
19462
|
+
console.log(
|
19463
|
+
`
|
19464
|
+
${withStyle.errorWarning(
|
19465
|
+
`We've found duplicated policy name across ${source_default.underline.blue(tableKey2)} table. Please rename one of the policies with ${source_default.underline.blue(
|
19466
|
+
policy4.name
|
19467
|
+
)} name`
|
19468
|
+
)}`
|
19469
|
+
);
|
19470
|
+
process.exit(1);
|
19471
|
+
}
|
19472
|
+
policiesObject[policy4.name] = {
|
19473
|
+
name: policy4.name,
|
19474
|
+
as: ((_a2 = policy4.as) == null ? void 0 : _a2.toUpperCase()) ?? "PERMISSIVE",
|
19475
|
+
for: ((_b2 = policy4.for) == null ? void 0 : _b2.toUpperCase()) ?? "ALL",
|
19427
19476
|
to: mappedTo.sort(),
|
19428
|
-
using: (0, import_drizzle_orm5.is)(
|
19429
|
-
withCheck: (0, import_drizzle_orm5.is)(
|
19477
|
+
using: (0, import_drizzle_orm5.is)(policy4.using, import_drizzle_orm5.SQL) ? dialect4.sqlToQuery(policy4.using).sql : void 0,
|
19478
|
+
withCheck: (0, import_drizzle_orm5.is)(policy4.withCheck, import_drizzle_orm5.SQL) ? dialect4.sqlToQuery(policy4.withCheck).sql : void 0
|
19430
19479
|
};
|
19431
19480
|
});
|
19432
19481
|
checks.forEach((check2) => {
|
@@ -19470,14 +19519,72 @@ ${withStyle.errorWarning(
|
|
19470
19519
|
isRLSEnabled: enableRLS
|
19471
19520
|
};
|
19472
19521
|
}
|
19522
|
+
for (const policy4 of policies) {
|
19523
|
+
if (!policy4._linkedTable) {
|
19524
|
+
console.log(
|
19525
|
+
`
|
19526
|
+
${withStyle.errorWarning(
|
19527
|
+
`"Policy ${policy4.name} was skipped because it was not linked to any table. You should either include the policy in a table or use .link() on the policy to link it to any table you have. For more information, please check:`
|
19528
|
+
)}`
|
19529
|
+
);
|
19530
|
+
continue;
|
19531
|
+
}
|
19532
|
+
const tableConfig = (0, import_pg_core3.getTableConfig)(policy4._linkedTable);
|
19533
|
+
const tableKey2 = `${tableConfig.schema ?? "public"}.${tableConfig.name}`;
|
19534
|
+
const mappedTo = [];
|
19535
|
+
if (!policy4.to) {
|
19536
|
+
mappedTo.push("public");
|
19537
|
+
} else {
|
19538
|
+
if (policy4.to && typeof policy4.to === "string") {
|
19539
|
+
mappedTo.push(policy4.to);
|
19540
|
+
} else if (policy4.to && (0, import_drizzle_orm5.is)(policy4.to, import_pg_core2.PgRole)) {
|
19541
|
+
mappedTo.push(policy4.to.name);
|
19542
|
+
} else if (policy4.to && Array.isArray(policy4.to)) {
|
19543
|
+
policy4.to.forEach((it) => {
|
19544
|
+
if (typeof it === "string") {
|
19545
|
+
mappedTo.push(it);
|
19546
|
+
} else if ((0, import_drizzle_orm5.is)(it, import_pg_core2.PgRole)) {
|
19547
|
+
mappedTo.push(it.name);
|
19548
|
+
}
|
19549
|
+
});
|
19550
|
+
}
|
19551
|
+
}
|
19552
|
+
if (((_a = result[tableKey2]) == null ? void 0 : _a.policies[policy4.name]) !== void 0 || policiesToReturn[policy4.name] !== void 0) {
|
19553
|
+
console.log(
|
19554
|
+
`
|
19555
|
+
${withStyle.errorWarning(
|
19556
|
+
`We've found duplicated policy name across ${source_default.underline.blue(tableKey2)} table. Please rename one of the policies with ${source_default.underline.blue(
|
19557
|
+
policy4.name
|
19558
|
+
)} name`
|
19559
|
+
)}`
|
19560
|
+
);
|
19561
|
+
process.exit(1);
|
19562
|
+
}
|
19563
|
+
const mappedPolicy = {
|
19564
|
+
name: policy4.name,
|
19565
|
+
as: ((_b = policy4.as) == null ? void 0 : _b.toUpperCase()) ?? "PERMISSIVE",
|
19566
|
+
for: ((_c = policy4.for) == null ? void 0 : _c.toUpperCase()) ?? "ALL",
|
19567
|
+
to: mappedTo.sort(),
|
19568
|
+
using: (0, import_drizzle_orm5.is)(policy4.using, import_drizzle_orm5.SQL) ? dialect4.sqlToQuery(policy4.using).sql : void 0,
|
19569
|
+
withCheck: (0, import_drizzle_orm5.is)(policy4.withCheck, import_drizzle_orm5.SQL) ? dialect4.sqlToQuery(policy4.withCheck).sql : void 0
|
19570
|
+
};
|
19571
|
+
if (result[tableKey2]) {
|
19572
|
+
result[tableKey2].policies[policy4.name] = mappedPolicy;
|
19573
|
+
} else {
|
19574
|
+
policiesToReturn[policy4.name] = {
|
19575
|
+
...mappedPolicy,
|
19576
|
+
on: `"${tableConfig.schema ?? "public"}"."${tableConfig.name}"`
|
19577
|
+
};
|
19578
|
+
}
|
19579
|
+
}
|
19473
19580
|
for (const sequence of sequences) {
|
19474
19581
|
const name = sequence.seqName;
|
19475
19582
|
if (typeof sequencesToReturn[`${sequence.schema ?? "public"}.${name}`] === "undefined") {
|
19476
|
-
const increment = stringFromIdentityProperty((
|
19477
|
-
const minValue = stringFromIdentityProperty((
|
19478
|
-
const maxValue = stringFromIdentityProperty((
|
19479
|
-
const startWith = stringFromIdentityProperty((
|
19480
|
-
const cache = stringFromIdentityProperty((
|
19583
|
+
const increment = stringFromIdentityProperty((_d = sequence == null ? void 0 : sequence.seqOptions) == null ? void 0 : _d.increment) ?? "1";
|
19584
|
+
const minValue = stringFromIdentityProperty((_e = sequence == null ? void 0 : sequence.seqOptions) == null ? void 0 : _e.minValue) ?? (parseFloat(increment) < 0 ? "-9223372036854775808" : "1");
|
19585
|
+
const maxValue = stringFromIdentityProperty((_f = sequence == null ? void 0 : sequence.seqOptions) == null ? void 0 : _f.maxValue) ?? (parseFloat(increment) < 0 ? "-1" : "9223372036854775807");
|
19586
|
+
const startWith = stringFromIdentityProperty((_g = sequence == null ? void 0 : sequence.seqOptions) == null ? void 0 : _g.startWith) ?? (parseFloat(increment) < 0 ? maxValue : minValue);
|
19587
|
+
const cache = stringFromIdentityProperty((_h = sequence == null ? void 0 : sequence.seqOptions) == null ? void 0 : _h.cache) ?? "1";
|
19481
19588
|
sequencesToReturn[`${sequence.schema ?? "public"}.${name}`] = {
|
19482
19589
|
name,
|
19483
19590
|
schema: sequence.schema ?? "public",
|
@@ -19486,7 +19593,7 @@ ${withStyle.errorWarning(
|
|
19486
19593
|
minValue,
|
19487
19594
|
maxValue,
|
19488
19595
|
cache,
|
19489
|
-
cycle: ((
|
19596
|
+
cycle: ((_i = sequence.seqOptions) == null ? void 0 : _i.cycle) ?? false
|
19490
19597
|
};
|
19491
19598
|
} else {
|
19492
19599
|
}
|
@@ -19542,11 +19649,11 @@ ${withStyle.errorWarning(
|
|
19542
19649
|
const typeSchema = (0, import_drizzle_orm5.is)(column7, import_pg_core2.PgEnumColumn) ? column7.enum.schema || "public" : void 0;
|
19543
19650
|
const generated = column7.generated;
|
19544
19651
|
const identity = column7.generatedIdentity;
|
19545
|
-
const increment = stringFromIdentityProperty((
|
19546
|
-
const minValue = stringFromIdentityProperty((
|
19547
|
-
const maxValue = stringFromIdentityProperty((
|
19548
|
-
const startWith = stringFromIdentityProperty((
|
19549
|
-
const cache = stringFromIdentityProperty((
|
19652
|
+
const increment = stringFromIdentityProperty((_j = identity == null ? void 0 : identity.sequenceOptions) == null ? void 0 : _j.increment) ?? "1";
|
19653
|
+
const minValue = stringFromIdentityProperty((_k = identity == null ? void 0 : identity.sequenceOptions) == null ? void 0 : _k.minValue) ?? (parseFloat(increment) < 0 ? minRangeForIdentityBasedOn(column7.columnType) : "1");
|
19654
|
+
const maxValue = stringFromIdentityProperty((_l = identity == null ? void 0 : identity.sequenceOptions) == null ? void 0 : _l.maxValue) ?? (parseFloat(increment) < 0 ? "-1" : maxRangeForIdentityBasedOn(column7.getSQLType()));
|
19655
|
+
const startWith = stringFromIdentityProperty((_m = identity == null ? void 0 : identity.sequenceOptions) == null ? void 0 : _m.startWith) ?? (parseFloat(increment) < 0 ? maxValue : minValue);
|
19656
|
+
const cache = stringFromIdentityProperty((_n = identity == null ? void 0 : identity.sequenceOptions) == null ? void 0 : _n.cache) ?? "1";
|
19550
19657
|
const columnToSet = {
|
19551
19658
|
name: column7.name,
|
19552
19659
|
type: column7.getSQLType(),
|
@@ -19566,7 +19673,7 @@ ${withStyle.errorWarning(
|
|
19566
19673
|
minValue,
|
19567
19674
|
maxValue,
|
19568
19675
|
cache,
|
19569
|
-
cycle: ((
|
19676
|
+
cycle: ((_o = identity == null ? void 0 : identity.sequenceOptions) == null ? void 0 : _o.cycle) ?? false
|
19570
19677
|
} : void 0
|
19571
19678
|
};
|
19572
19679
|
if (column7.isUnique) {
|
@@ -19658,6 +19765,7 @@ ${withStyle.errorWarning(
|
|
19658
19765
|
schemas: schemasObject,
|
19659
19766
|
sequences: sequencesToReturn,
|
19660
19767
|
roles: rolesToReturn,
|
19768
|
+
policies: policiesToReturn,
|
19661
19769
|
views: resultViews,
|
19662
19770
|
_meta: {
|
19663
19771
|
schemas: {},
|
@@ -20420,6 +20528,7 @@ WHERE
|
|
20420
20528
|
schemas: schemasObject,
|
20421
20529
|
sequences: sequencesToReturn,
|
20422
20530
|
roles: rolesToReturn,
|
20531
|
+
policies: {},
|
20423
20532
|
views,
|
20424
20533
|
_meta: {
|
20425
20534
|
schemas: {},
|
@@ -21329,10 +21438,10 @@ ${filenames.join("\n")}
|
|
21329
21438
|
const filenames = prepareFilenames(path5);
|
21330
21439
|
const { prepareFromPgImports: prepareFromPgImports2 } = await Promise.resolve().then(() => (init_pgImports(), pgImports_exports));
|
21331
21440
|
const { generatePgSnapshot: generatePgSnapshot2 } = await Promise.resolve().then(() => (init_pgSerializer(), pgSerializer_exports));
|
21332
|
-
const { tables, enums, schemas, sequences, views, matViews, roles } = await prepareFromPgImports2(
|
21441
|
+
const { tables, enums, schemas, sequences, views, matViews, roles, policies } = await prepareFromPgImports2(
|
21333
21442
|
filenames
|
21334
21443
|
);
|
21335
|
-
return generatePgSnapshot2(tables, enums, schemas, sequences, roles, views, matViews, casing2, schemaFilter);
|
21444
|
+
return generatePgSnapshot2(tables, enums, schemas, sequences, roles, policies, views, matViews, casing2, schemaFilter);
|
21336
21445
|
};
|
21337
21446
|
serializeSQLite = async (path5, casing2) => {
|
21338
21447
|
const filenames = prepareFilenames(path5);
|
@@ -23808,6 +23917,14 @@ function diffSchemasOrTables(left, right) {
|
|
23808
23917
|
const deleted = result.filter((it) => it[0].endsWith("__deleted")).map((it) => it[1]);
|
23809
23918
|
return { added, deleted };
|
23810
23919
|
}
|
23920
|
+
function diffIndPolicies(left, right) {
|
23921
|
+
left = JSON.parse(JSON.stringify(left));
|
23922
|
+
right = JSON.parse(JSON.stringify(right));
|
23923
|
+
const result = Object.entries((0, import_json_diff.diff)(left, right) ?? {});
|
23924
|
+
const added = result.filter((it) => it[0].endsWith("__added")).map((it) => it[1]);
|
23925
|
+
const deleted = result.filter((it) => it[0].endsWith("__deleted")).map((it) => it[1]);
|
23926
|
+
return { added, deleted };
|
23927
|
+
}
|
23811
23928
|
function diffColumns(left, right) {
|
23812
23929
|
left = JSON.parse(JSON.stringify(left));
|
23813
23930
|
right = JSON.parse(JSON.stringify(right));
|
@@ -23880,6 +23997,7 @@ function applyJsonDiff(json1, json2) {
|
|
23880
23997
|
difference.enums = difference.enums || {};
|
23881
23998
|
difference.sequences = difference.sequences || {};
|
23882
23999
|
difference.roles = difference.roles || {};
|
24000
|
+
difference.policies = difference.policies || {};
|
23883
24001
|
difference.views = difference.views || {};
|
23884
24002
|
const schemaKeys = Object.keys(difference.schemas);
|
23885
24003
|
for (let key of schemaKeys) {
|
@@ -23940,6 +24058,10 @@ function applyJsonDiff(json1, json2) {
|
|
23940
24058
|
const alteredRoles = rolesEntries.filter((it) => !(it[0].includes("__added") || it[0].includes("__deleted"))).map((it) => {
|
23941
24059
|
return json2.roles[it[0]];
|
23942
24060
|
});
|
24061
|
+
const policiesEntries = Object.entries(difference.policies);
|
24062
|
+
const alteredPolicies = policiesEntries.filter((it) => !(it[0].includes("__added") || it[0].includes("__deleted"))).map((it) => {
|
24063
|
+
return json2.policies[it[0]];
|
24064
|
+
});
|
23943
24065
|
const viewsEntries = Object.entries(difference.views);
|
23944
24066
|
const alteredViews = viewsEntries.filter((it) => !(it[0].includes("__added") || it[0].includes("__deleted"))).map(
|
23945
24067
|
([nameWithSchema, view4]) => {
|
@@ -24020,7 +24142,8 @@ function applyJsonDiff(json1, json2) {
|
|
24020
24142
|
alteredEnums,
|
24021
24143
|
alteredSequences,
|
24022
24144
|
alteredRoles,
|
24023
|
-
alteredViews
|
24145
|
+
alteredViews,
|
24146
|
+
alteredPolicies
|
24024
24147
|
};
|
24025
24148
|
}
|
24026
24149
|
var import_json_diff, mapArraysDiff, findAlternationsInTable, alternationsInColumn;
|
@@ -24477,7 +24600,7 @@ function fromJson(statements, dialect4, action, json2) {
|
|
24477
24600
|
}).filter((it) => it !== "");
|
24478
24601
|
return result;
|
24479
24602
|
}
|
24480
|
-
var pgNativeTypes, isPgNativeType, Convertor, PgCreateRoleConvertor, PgDropRoleConvertor, PgRenameRoleConvertor, PgAlterRoleConvertor, PgCreatePolicyConvertor, PgDropPolicyConvertor, PgRenamePolicyConvertor, PgAlterPolicyConvertor, PgEnableRlsConvertor, PgDisableRlsConvertor, PgCreateTableConvertor, MySqlCreateTableConvertor, SQLiteCreateTableConvertor, PgCreateViewConvertor, MySqlCreateViewConvertor, SqliteCreateViewConvertor, PgDropViewConvertor, MySqlDropViewConvertor, SqliteDropViewConvertor, MySqlAlterViewConvertor, PgRenameViewConvertor, MySqlRenameViewConvertor, PgAlterViewSchemaConvertor, PgAlterViewAddWithOptionConvertor, PgAlterViewDropWithOptionConvertor, PgAlterViewAlterTablespaceConvertor, PgAlterViewAlterUsingConvertor, PgAlterTableAlterColumnSetGenerated, PgAlterTableAlterColumnDropGenerated, PgAlterTableAlterColumnAlterGenerated, PgAlterTableAddUniqueConstraintConvertor, PgAlterTableDropUniqueConstraintConvertor, PgAlterTableAddCheckConstraintConvertor, PgAlterTableDeleteCheckConstraintConvertor, MySQLAlterTableAddUniqueConstraintConvertor, MySQLAlterTableDropUniqueConstraintConvertor, MySqlAlterTableAddCheckConstraintConvertor, MySqlAlterTableDeleteCheckConstraintConvertor, CreatePgSequenceConvertor, DropPgSequenceConvertor, RenamePgSequenceConvertor, MovePgSequenceConvertor, AlterPgSequenceConvertor, CreateTypeEnumConvertor, DropTypeEnumConvertor, AlterTypeAddValueConvertor, AlterTypeSetSchemaConvertor, AlterRenameTypeConvertor, AlterTypeDropValueConvertor, PgDropTableConvertor, MySQLDropTableConvertor, SQLiteDropTableConvertor, PgRenameTableConvertor, SqliteRenameTableConvertor, MySqlRenameTableConvertor, PgAlterTableRenameColumnConvertor, MySqlAlterTableRenameColumnConvertor, SQLiteAlterTableRenameColumnConvertor, PgAlterTableDropColumnConvertor, MySqlAlterTableDropColumnConvertor, SQLiteAlterTableDropColumnConvertor, PgAlterTableAddColumnConvertor, MySqlAlterTableAddColumnConvertor, SQLiteAlterTableAddColumnConvertor, PgAlterTableAlterColumnSetTypeConvertor, PgAlterTableAlterColumnSetDefaultConvertor, PgAlterTableAlterColumnDropDefaultConvertor, PgAlterTableAlterColumnDropGeneratedConvertor, PgAlterTableAlterColumnSetExpressionConvertor, PgAlterTableAlterColumnAlterrGeneratedConvertor, SqliteAlterTableAlterColumnDropGeneratedConvertor, SqliteAlterTableAlterColumnSetExpressionConvertor, SqliteAlterTableAlterColumnAlterGeneratedConvertor, MySqlAlterTableAlterColumnAlterrGeneratedConvertor, MySqlAlterTableAddPk, MySqlAlterTableDropPk, LibSQLModifyColumn, MySqlModifyColumn, PgAlterTableCreateCompositePrimaryKeyConvertor, PgAlterTableDeleteCompositePrimaryKeyConvertor, PgAlterTableAlterCompositePrimaryKeyConvertor, MySqlAlterTableCreateCompositePrimaryKeyConvertor, MySqlAlterTableDeleteCompositePrimaryKeyConvertor, MySqlAlterTableAlterCompositePrimaryKeyConvertor, PgAlterTableAlterColumnSetPrimaryKeyConvertor, PgAlterTableAlterColumnDropPrimaryKeyConvertor, PgAlterTableAlterColumnSetNotNullConvertor, PgAlterTableAlterColumnDropNotNullConvertor, PgCreateForeignKeyConvertor, LibSQLCreateForeignKeyConvertor, MySqlCreateForeignKeyConvertor, PgAlterForeignKeyConvertor, PgDeleteForeignKeyConvertor, MySqlDeleteForeignKeyConvertor, CreatePgIndexConvertor, CreateMySqlIndexConvertor, CreateSqliteIndexConvertor, PgDropIndexConvertor, PgCreateSchemaConvertor, PgRenameSchemaConvertor, PgDropSchemaConvertor, PgAlterTableSetSchemaConvertor, PgAlterTableSetNewSchemaConvertor, PgAlterTableRemoveFromSchemaConvertor, SqliteDropIndexConvertor, MySqlDropIndexConvertor, SQLiteRecreateTableConvertor, LibSQLRecreateTableConvertor, convertors;
|
24603
|
+
var pgNativeTypes, isPgNativeType, Convertor, PgCreateRoleConvertor, PgDropRoleConvertor, PgRenameRoleConvertor, PgAlterRoleConvertor, PgCreatePolicyConvertor, PgDropPolicyConvertor, PgRenamePolicyConvertor, PgAlterPolicyConvertor, PgCreateIndPolicyConvertor, PgDropIndPolicyConvertor, PgRenameIndPolicyConvertor, PgAlterIndPolicyConvertor, PgEnableRlsConvertor, PgDisableRlsConvertor, PgCreateTableConvertor, MySqlCreateTableConvertor, SQLiteCreateTableConvertor, PgCreateViewConvertor, MySqlCreateViewConvertor, SqliteCreateViewConvertor, PgDropViewConvertor, MySqlDropViewConvertor, SqliteDropViewConvertor, MySqlAlterViewConvertor, PgRenameViewConvertor, MySqlRenameViewConvertor, PgAlterViewSchemaConvertor, PgAlterViewAddWithOptionConvertor, PgAlterViewDropWithOptionConvertor, PgAlterViewAlterTablespaceConvertor, PgAlterViewAlterUsingConvertor, PgAlterTableAlterColumnSetGenerated, PgAlterTableAlterColumnDropGenerated, PgAlterTableAlterColumnAlterGenerated, PgAlterTableAddUniqueConstraintConvertor, PgAlterTableDropUniqueConstraintConvertor, PgAlterTableAddCheckConstraintConvertor, PgAlterTableDeleteCheckConstraintConvertor, MySQLAlterTableAddUniqueConstraintConvertor, MySQLAlterTableDropUniqueConstraintConvertor, MySqlAlterTableAddCheckConstraintConvertor, MySqlAlterTableDeleteCheckConstraintConvertor, CreatePgSequenceConvertor, DropPgSequenceConvertor, RenamePgSequenceConvertor, MovePgSequenceConvertor, AlterPgSequenceConvertor, CreateTypeEnumConvertor, DropTypeEnumConvertor, AlterTypeAddValueConvertor, AlterTypeSetSchemaConvertor, AlterRenameTypeConvertor, AlterTypeDropValueConvertor, PgDropTableConvertor, MySQLDropTableConvertor, SQLiteDropTableConvertor, PgRenameTableConvertor, SqliteRenameTableConvertor, MySqlRenameTableConvertor, PgAlterTableRenameColumnConvertor, MySqlAlterTableRenameColumnConvertor, SQLiteAlterTableRenameColumnConvertor, PgAlterTableDropColumnConvertor, MySqlAlterTableDropColumnConvertor, SQLiteAlterTableDropColumnConvertor, PgAlterTableAddColumnConvertor, MySqlAlterTableAddColumnConvertor, SQLiteAlterTableAddColumnConvertor, PgAlterTableAlterColumnSetTypeConvertor, PgAlterTableAlterColumnSetDefaultConvertor, PgAlterTableAlterColumnDropDefaultConvertor, PgAlterTableAlterColumnDropGeneratedConvertor, PgAlterTableAlterColumnSetExpressionConvertor, PgAlterTableAlterColumnAlterrGeneratedConvertor, SqliteAlterTableAlterColumnDropGeneratedConvertor, SqliteAlterTableAlterColumnSetExpressionConvertor, SqliteAlterTableAlterColumnAlterGeneratedConvertor, MySqlAlterTableAlterColumnAlterrGeneratedConvertor, MySqlAlterTableAddPk, MySqlAlterTableDropPk, LibSQLModifyColumn, MySqlModifyColumn, PgAlterTableCreateCompositePrimaryKeyConvertor, PgAlterTableDeleteCompositePrimaryKeyConvertor, PgAlterTableAlterCompositePrimaryKeyConvertor, MySqlAlterTableCreateCompositePrimaryKeyConvertor, MySqlAlterTableDeleteCompositePrimaryKeyConvertor, MySqlAlterTableAlterCompositePrimaryKeyConvertor, PgAlterTableAlterColumnSetPrimaryKeyConvertor, PgAlterTableAlterColumnDropPrimaryKeyConvertor, PgAlterTableAlterColumnSetNotNullConvertor, PgAlterTableAlterColumnDropNotNullConvertor, PgCreateForeignKeyConvertor, LibSQLCreateForeignKeyConvertor, MySqlCreateForeignKeyConvertor, PgAlterForeignKeyConvertor, PgDeleteForeignKeyConvertor, MySqlDeleteForeignKeyConvertor, CreatePgIndexConvertor, CreateMySqlIndexConvertor, CreateSqliteIndexConvertor, PgDropIndexConvertor, PgCreateSchemaConvertor, PgRenameSchemaConvertor, PgDropSchemaConvertor, PgAlterTableSetSchemaConvertor, PgAlterTableSetNewSchemaConvertor, PgAlterTableRemoveFromSchemaConvertor, SqliteDropIndexConvertor, MySqlDropIndexConvertor, SQLiteRecreateTableConvertor, LibSQLRecreateTableConvertor, convertors;
|
24481
24604
|
var init_sqlgenerator = __esm({
|
24482
24605
|
"src/sqlgenerator.ts"() {
|
24483
24606
|
"use strict";
|
@@ -24572,14 +24695,14 @@ var init_sqlgenerator = __esm({
|
|
24572
24695
|
}
|
24573
24696
|
convert(statement) {
|
24574
24697
|
var _a, _b, _c;
|
24575
|
-
const
|
24698
|
+
const policy4 = statement.data;
|
24576
24699
|
const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
|
24577
|
-
const usingPart =
|
24578
|
-
const withCheckPart =
|
24579
|
-
const policyToPart = (_a =
|
24700
|
+
const usingPart = policy4.using ? ` USING (${policy4.using})` : "";
|
24701
|
+
const withCheckPart = policy4.withCheck ? ` WITH CHECK (${policy4.withCheck})` : "";
|
24702
|
+
const policyToPart = (_a = policy4.to) == null ? void 0 : _a.map(
|
24580
24703
|
(v) => ["current_user", "current_role", "session_user", "public"].includes(v) ? v : `"${v}"`
|
24581
24704
|
).join(", ");
|
24582
|
-
return `CREATE POLICY "${
|
24705
|
+
return `CREATE POLICY "${policy4.name}" ON ${tableNameWithSchema} AS ${(_b = policy4.as) == null ? void 0 : _b.toUpperCase()} FOR ${(_c = policy4.for) == null ? void 0 : _c.toUpperCase()} TO ${policyToPart}${usingPart}${withCheckPart};`;
|
24583
24706
|
}
|
24584
24707
|
};
|
24585
24708
|
PgDropPolicyConvertor = class extends Convertor {
|
@@ -24587,9 +24710,9 @@ var init_sqlgenerator = __esm({
|
|
24587
24710
|
return statement.type === "drop_policy" && dialect4 === "postgresql";
|
24588
24711
|
}
|
24589
24712
|
convert(statement) {
|
24590
|
-
const
|
24713
|
+
const policy4 = statement.data;
|
24591
24714
|
const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
|
24592
|
-
return `DROP POLICY "${
|
24715
|
+
return `DROP POLICY "${policy4.name}" ON ${tableNameWithSchema} CASCADE;`;
|
24593
24716
|
}
|
24594
24717
|
};
|
24595
24718
|
PgRenamePolicyConvertor = class extends Convertor {
|
@@ -24614,6 +24737,50 @@ var init_sqlgenerator = __esm({
|
|
24614
24737
|
return `ALTER POLICY "${oldPolicy.name}" ON ${tableNameWithSchema} TO ${newPolicy.to}${usingPart}${withCheckPart};`;
|
24615
24738
|
}
|
24616
24739
|
};
|
24740
|
+
PgCreateIndPolicyConvertor = class extends Convertor {
|
24741
|
+
can(statement, dialect4) {
|
24742
|
+
return statement.type === "create_ind_policy" && dialect4 === "postgresql";
|
24743
|
+
}
|
24744
|
+
convert(statement) {
|
24745
|
+
var _a, _b, _c;
|
24746
|
+
const policy4 = statement.data;
|
24747
|
+
const usingPart = policy4.using ? ` USING (${policy4.using})` : "";
|
24748
|
+
const withCheckPart = policy4.withCheck ? ` WITH CHECK (${policy4.withCheck})` : "";
|
24749
|
+
const policyToPart = (_a = policy4.to) == null ? void 0 : _a.map(
|
24750
|
+
(v) => ["current_user", "current_role", "session_user", "public"].includes(v) ? v : `"${v}"`
|
24751
|
+
).join(", ");
|
24752
|
+
return `CREATE POLICY "${policy4.name}" ON ${policy4.on} AS ${(_b = policy4.as) == null ? void 0 : _b.toUpperCase()} FOR ${(_c = policy4.for) == null ? void 0 : _c.toUpperCase()} TO ${policyToPart}${usingPart}${withCheckPart};`;
|
24753
|
+
}
|
24754
|
+
};
|
24755
|
+
PgDropIndPolicyConvertor = class extends Convertor {
|
24756
|
+
can(statement, dialect4) {
|
24757
|
+
return statement.type === "drop_ind_policy" && dialect4 === "postgresql";
|
24758
|
+
}
|
24759
|
+
convert(statement) {
|
24760
|
+
const policy4 = statement.data;
|
24761
|
+
return `DROP POLICY "${policy4.name}" ON ${policy4.on} CASCADE;`;
|
24762
|
+
}
|
24763
|
+
};
|
24764
|
+
PgRenameIndPolicyConvertor = class extends Convertor {
|
24765
|
+
can(statement, dialect4) {
|
24766
|
+
return statement.type === "rename_ind_policy" && dialect4 === "postgresql";
|
24767
|
+
}
|
24768
|
+
convert(statement) {
|
24769
|
+
return `ALTER POLICY "${statement.oldName}" ON ${statement.tableKey} RENAME TO "${statement.newName}";`;
|
24770
|
+
}
|
24771
|
+
};
|
24772
|
+
PgAlterIndPolicyConvertor = class extends Convertor {
|
24773
|
+
can(statement, dialect4) {
|
24774
|
+
return statement.type === "alter_ind_policy" && dialect4 === "postgresql";
|
24775
|
+
}
|
24776
|
+
convert(statement) {
|
24777
|
+
const newPolicy = statement.newData;
|
24778
|
+
const oldPolicy = statement.oldData;
|
24779
|
+
const usingPart = newPolicy.using ? ` USING (${newPolicy.using})` : oldPolicy.using ? ` USING (${oldPolicy.using})` : "";
|
24780
|
+
const withCheckPart = newPolicy.withCheck ? ` WITH CHECK (${newPolicy.withCheck})` : oldPolicy.withCheck ? ` WITH CHECK (${oldPolicy.withCheck})` : "";
|
24781
|
+
return `ALTER POLICY "${oldPolicy.name}" ON ${oldPolicy.on} TO ${newPolicy.to}${usingPart}${withCheckPart};`;
|
24782
|
+
}
|
24783
|
+
};
|
24617
24784
|
PgEnableRlsConvertor = class extends Convertor {
|
24618
24785
|
can(statement, dialect4) {
|
24619
24786
|
return statement.type === "enable_rls" && dialect4 === "postgresql";
|
@@ -26514,6 +26681,10 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
26514
26681
|
convertors.push(new PgCreatePolicyConvertor());
|
26515
26682
|
convertors.push(new PgDropPolicyConvertor());
|
26516
26683
|
convertors.push(new PgRenamePolicyConvertor());
|
26684
|
+
convertors.push(new PgAlterIndPolicyConvertor());
|
26685
|
+
convertors.push(new PgCreateIndPolicyConvertor());
|
26686
|
+
convertors.push(new PgDropIndPolicyConvertor());
|
26687
|
+
convertors.push(new PgRenameIndPolicyConvertor());
|
26517
26688
|
convertors.push(new PgEnableRlsConvertor());
|
26518
26689
|
convertors.push(new PgDisableRlsConvertor());
|
26519
26690
|
convertors.push(new PgDropRoleConvertor());
|
@@ -26820,7 +26991,7 @@ var init_sqlitePushUtils = __esm({
|
|
26820
26991
|
});
|
26821
26992
|
|
26822
26993
|
// src/jsonStatements.ts
|
26823
|
-
var preparePgCreateTableJson, prepareMySqlCreateTableJson, prepareSQLiteCreateTable, prepareDropTableJson, prepareRenameTableJson, prepareCreateEnumJson, prepareAddValuesToEnumJson, prepareDropEnumValues, prepareDropEnumJson, prepareMoveEnumJson, prepareRenameEnumJson, prepareCreateSequenceJson, prepareAlterSequenceJson, prepareDropSequenceJson, prepareMoveSequenceJson, prepareRenameSequenceJson, prepareCreateRoleJson, prepareAlterRoleJson, prepareDropRoleJson, prepareRenameRoleJson, prepareCreateSchemasJson, prepareRenameSchemasJson, prepareDeleteSchemasJson, prepareRenameColumns, _prepareDropColumns, _prepareAddColumns, _prepareSqliteAddColumns, prepareAlterColumnsMysql, preparePgAlterColumns, prepareSqliteAlterColumns, prepareRenamePolicyJsons, prepareCreatePolicyJsons, prepareDropPolicyJsons, prepareAlterPolicyJson, preparePgCreateIndexesJson, prepareCreateIndexesJson, prepareCreateReferencesJson, prepareLibSQLCreateReferencesJson, prepareDropReferencesJson, prepareLibSQLDropReferencesJson, prepareAlterReferencesJson, prepareDropIndexesJson, prepareAddCompositePrimaryKeySqlite, prepareDeleteCompositePrimaryKeySqlite, prepareAlterCompositePrimaryKeySqlite, prepareAddCompositePrimaryKeyPg, prepareDeleteCompositePrimaryKeyPg, prepareAlterCompositePrimaryKeyPg, prepareAddUniqueConstraintPg, prepareDeleteUniqueConstraintPg, prepareAddCheckConstraint, prepareDeleteCheckConstraint, prepareAddCompositePrimaryKeyMySql, prepareDeleteCompositePrimaryKeyMySql, prepareAlterCompositePrimaryKeyMySql, preparePgCreateViewJson, prepareMySqlCreateViewJson, prepareSqliteCreateViewJson, prepareDropViewJson, prepareRenameViewJson, preparePgAlterViewAlterSchemaJson, preparePgAlterViewAddWithOptionJson, preparePgAlterViewDropWithOptionJson, preparePgAlterViewAlterTablespaceJson, preparePgAlterViewAlterUsingJson, prepareMySqlAlterView;
|
26994
|
+
var preparePgCreateTableJson, prepareMySqlCreateTableJson, prepareSQLiteCreateTable, prepareDropTableJson, prepareRenameTableJson, prepareCreateEnumJson, prepareAddValuesToEnumJson, prepareDropEnumValues, prepareDropEnumJson, prepareMoveEnumJson, prepareRenameEnumJson, prepareCreateSequenceJson, prepareAlterSequenceJson, prepareDropSequenceJson, prepareMoveSequenceJson, prepareRenameSequenceJson, prepareCreateRoleJson, prepareAlterRoleJson, prepareDropRoleJson, prepareRenameRoleJson, prepareCreateSchemasJson, prepareRenameSchemasJson, prepareDeleteSchemasJson, prepareRenameColumns, _prepareDropColumns, _prepareAddColumns, _prepareSqliteAddColumns, prepareAlterColumnsMysql, preparePgAlterColumns, prepareSqliteAlterColumns, prepareRenamePolicyJsons, prepareRenameIndPolicyJsons, prepareCreatePolicyJsons, prepareCreateIndPolicyJsons, prepareDropPolicyJsons, prepareDropIndPolicyJsons, prepareAlterPolicyJson, prepareAlterIndPolicyJson, preparePgCreateIndexesJson, prepareCreateIndexesJson, prepareCreateReferencesJson, prepareLibSQLCreateReferencesJson, prepareDropReferencesJson, prepareLibSQLDropReferencesJson, prepareAlterReferencesJson, prepareDropIndexesJson, prepareAddCompositePrimaryKeySqlite, prepareDeleteCompositePrimaryKeySqlite, prepareAlterCompositePrimaryKeySqlite, prepareAddCompositePrimaryKeyPg, prepareDeleteCompositePrimaryKeyPg, prepareAlterCompositePrimaryKeyPg, prepareAddUniqueConstraintPg, prepareDeleteUniqueConstraintPg, prepareAddCheckConstraint, prepareDeleteCheckConstraint, prepareAddCompositePrimaryKeyMySql, prepareDeleteCompositePrimaryKeyMySql, prepareAlterCompositePrimaryKeyMySql, preparePgCreateViewJson, prepareMySqlCreateViewJson, prepareSqliteCreateViewJson, prepareDropViewJson, prepareRenameViewJson, preparePgAlterViewAlterSchemaJson, preparePgAlterViewAddWithOptionJson, preparePgAlterViewDropWithOptionJson, preparePgAlterViewAlterTablespaceJson, preparePgAlterViewAlterUsingJson, prepareMySqlAlterView;
|
26824
26995
|
var init_jsonStatements = __esm({
|
26825
26996
|
"src/jsonStatements.ts"() {
|
26826
26997
|
"use strict";
|
@@ -27950,6 +28121,16 @@ var init_jsonStatements = __esm({
|
|
27950
28121
|
};
|
27951
28122
|
});
|
27952
28123
|
};
|
28124
|
+
prepareRenameIndPolicyJsons = (renames) => {
|
28125
|
+
return renames.map((it) => {
|
28126
|
+
return {
|
28127
|
+
type: "rename_ind_policy",
|
28128
|
+
tableKey: it.from.on,
|
28129
|
+
oldName: it.from.name,
|
28130
|
+
newName: it.to.name
|
28131
|
+
};
|
28132
|
+
});
|
28133
|
+
};
|
27953
28134
|
prepareCreatePolicyJsons = (tableName, schema5, policies) => {
|
27954
28135
|
return policies.map((it) => {
|
27955
28136
|
return {
|
@@ -27960,6 +28141,15 @@ var init_jsonStatements = __esm({
|
|
27960
28141
|
};
|
27961
28142
|
});
|
27962
28143
|
};
|
28144
|
+
prepareCreateIndPolicyJsons = (policies) => {
|
28145
|
+
return policies.map((it) => {
|
28146
|
+
return {
|
28147
|
+
type: "create_ind_policy",
|
28148
|
+
tableName: it.on,
|
28149
|
+
data: it
|
28150
|
+
};
|
28151
|
+
});
|
28152
|
+
};
|
27963
28153
|
prepareDropPolicyJsons = (tableName, schema5, policies) => {
|
27964
28154
|
return policies.map((it) => {
|
27965
28155
|
return {
|
@@ -27970,6 +28160,15 @@ var init_jsonStatements = __esm({
|
|
27970
28160
|
};
|
27971
28161
|
});
|
27972
28162
|
};
|
28163
|
+
prepareDropIndPolicyJsons = (policies) => {
|
28164
|
+
return policies.map((it) => {
|
28165
|
+
return {
|
28166
|
+
type: "drop_ind_policy",
|
28167
|
+
tableName: it.on,
|
28168
|
+
data: it
|
28169
|
+
};
|
28170
|
+
});
|
28171
|
+
};
|
27973
28172
|
prepareAlterPolicyJson = (tableName, schema5, oldPolicy, newPolicy) => {
|
27974
28173
|
return {
|
27975
28174
|
type: "alter_policy",
|
@@ -27979,6 +28178,13 @@ var init_jsonStatements = __esm({
|
|
27979
28178
|
schema: schema5
|
27980
28179
|
};
|
27981
28180
|
};
|
28181
|
+
prepareAlterIndPolicyJson = (oldPolicy, newPolicy) => {
|
28182
|
+
return {
|
28183
|
+
type: "alter_ind_policy",
|
28184
|
+
oldData: oldPolicy,
|
28185
|
+
newData: newPolicy
|
28186
|
+
};
|
28187
|
+
};
|
27982
28188
|
preparePgCreateIndexesJson = (tableName, schema5, indexes, fullSchema, action) => {
|
27983
28189
|
if (action === "push") {
|
27984
28190
|
return Object.values(indexes).map((indexData) => {
|
@@ -28892,6 +29098,7 @@ var init_snapshotsDiffer = __esm({
|
|
28892
29098
|
alteredEnums: changedEnumSchema.array(),
|
28893
29099
|
alteredSequences: sequenceSquashed.array(),
|
28894
29100
|
alteredRoles: roleSchema.array(),
|
29101
|
+
alteredPolicies: policySquashed.array(),
|
28895
29102
|
alteredViews: alteredPgViewSchema.array()
|
28896
29103
|
}).strict();
|
28897
29104
|
diffResultSchemeMysql = objectType({
|
@@ -28949,7 +29156,7 @@ var init_snapshotsDiffer = __esm({
|
|
28949
29156
|
}
|
28950
29157
|
return column7;
|
28951
29158
|
};
|
28952
|
-
applyPgSnapshotsDiff = async (json1, json2, schemasResolver2, enumsResolver2, sequencesResolver2, policyResolver2, roleResolver2, tablesResolver2, columnsResolver2, viewsResolver2, prevFull, curFull, action) => {
|
29159
|
+
applyPgSnapshotsDiff = async (json1, json2, schemasResolver2, enumsResolver2, sequencesResolver2, policyResolver2, indPolicyResolver2, roleResolver2, tablesResolver2, columnsResolver2, viewsResolver2, prevFull, curFull, action) => {
|
28953
29160
|
const schemasDiff = diffSchemasOrTables(json1.schemas, json2.schemas);
|
28954
29161
|
const {
|
28955
29162
|
created: createdSchemas,
|
@@ -29166,24 +29373,24 @@ var init_snapshotsDiffer = __esm({
|
|
29166
29373
|
const columnCreates = [];
|
29167
29374
|
const columnDeletes = [];
|
29168
29375
|
for (let entry of Object.values(res)) {
|
29169
|
-
const { renamed, created, deleted } = await columnsResolver2({
|
29376
|
+
const { renamed, created: created2, deleted: deleted2 } = await columnsResolver2({
|
29170
29377
|
tableName: entry.name,
|
29171
29378
|
schema: entry.schema,
|
29172
29379
|
deleted: entry.columns.deleted,
|
29173
29380
|
created: entry.columns.added
|
29174
29381
|
});
|
29175
|
-
if (
|
29382
|
+
if (created2.length > 0) {
|
29176
29383
|
columnCreates.push({
|
29177
29384
|
table: entry.name,
|
29178
29385
|
schema: entry.schema,
|
29179
|
-
columns:
|
29386
|
+
columns: created2
|
29180
29387
|
});
|
29181
29388
|
}
|
29182
|
-
if (
|
29389
|
+
if (deleted2.length > 0) {
|
29183
29390
|
columnDeletes.push({
|
29184
29391
|
table: entry.name,
|
29185
29392
|
schema: entry.schema,
|
29186
|
-
columns:
|
29393
|
+
columns: deleted2
|
29187
29394
|
});
|
29188
29395
|
}
|
29189
29396
|
if (renamed.length > 0) {
|
@@ -29223,24 +29430,24 @@ var init_snapshotsDiffer = __esm({
|
|
29223
29430
|
const policyCreates = [];
|
29224
29431
|
const policyDeletes = [];
|
29225
29432
|
for (let entry of Object.values(policyRes)) {
|
29226
|
-
const { renamed, created, deleted } = await policyResolver2({
|
29433
|
+
const { renamed, created: created2, deleted: deleted2 } = await policyResolver2({
|
29227
29434
|
tableName: entry.name,
|
29228
29435
|
schema: entry.schema,
|
29229
29436
|
deleted: entry.policies.deleted.map(PgSquasher.unsquashPolicy),
|
29230
29437
|
created: entry.policies.added.map(PgSquasher.unsquashPolicy)
|
29231
29438
|
});
|
29232
|
-
if (
|
29439
|
+
if (created2.length > 0) {
|
29233
29440
|
policyCreates.push({
|
29234
29441
|
table: entry.name,
|
29235
29442
|
schema: entry.schema,
|
29236
|
-
columns:
|
29443
|
+
columns: created2
|
29237
29444
|
});
|
29238
29445
|
}
|
29239
|
-
if (
|
29446
|
+
if (deleted2.length > 0) {
|
29240
29447
|
policyDeletes.push({
|
29241
29448
|
table: entry.name,
|
29242
29449
|
schema: entry.schema,
|
29243
|
-
columns:
|
29450
|
+
columns: deleted2
|
29244
29451
|
});
|
29245
29452
|
}
|
29246
29453
|
if (renamed.length > 0) {
|
@@ -29264,12 +29471,12 @@ var init_snapshotsDiffer = __esm({
|
|
29264
29471
|
(tableKey2, tableValue) => {
|
29265
29472
|
const patchedPolicies = mapKeys(
|
29266
29473
|
tableValue.policies,
|
29267
|
-
(policyKey,
|
29474
|
+
(policyKey, policy4) => {
|
29268
29475
|
const rens = policyRenamesDict[`${tableValue.schema || "public"}.${tableValue.name}`] || [];
|
29269
29476
|
const newName = columnChangeFor(policyKey, rens);
|
29270
|
-
const unsquashedPolicy = PgSquasher.unsquashPolicy(
|
29477
|
+
const unsquashedPolicy = PgSquasher.unsquashPolicy(policy4);
|
29271
29478
|
unsquashedPolicy.name = newName;
|
29272
|
-
|
29479
|
+
policy4 = PgSquasher.squashPolicy(unsquashedPolicy);
|
29273
29480
|
return newName;
|
29274
29481
|
}
|
29275
29482
|
);
|
@@ -29277,7 +29484,46 @@ var init_snapshotsDiffer = __esm({
|
|
29277
29484
|
return [tableKey2, tableValue];
|
29278
29485
|
}
|
29279
29486
|
);
|
29280
|
-
const
|
29487
|
+
const indPolicyRes = diffIndPolicies(policyPatchedSnap1.policies, json2.policies);
|
29488
|
+
const indPolicyCreates = [];
|
29489
|
+
const indPolicyDeletes = [];
|
29490
|
+
const { renamed: indPolicyRenames, created, deleted } = await indPolicyResolver2({
|
29491
|
+
deleted: indPolicyRes.deleted.map((t2) => PgSquasher.unsquashPolicy(t2.values)),
|
29492
|
+
created: indPolicyRes.added.map((t2) => PgSquasher.unsquashPolicy(t2.values))
|
29493
|
+
});
|
29494
|
+
if (created.length > 0) {
|
29495
|
+
indPolicyCreates.push({
|
29496
|
+
policies: created
|
29497
|
+
});
|
29498
|
+
}
|
29499
|
+
if (deleted.length > 0) {
|
29500
|
+
indPolicyDeletes.push({
|
29501
|
+
policies: deleted
|
29502
|
+
});
|
29503
|
+
}
|
29504
|
+
const indPolicyRenamesDict = indPolicyRenames.reduce(
|
29505
|
+
(acc, it) => {
|
29506
|
+
acc[it.from.name] = {
|
29507
|
+
nameFrom: it.from.name,
|
29508
|
+
nameTo: it.to.name
|
29509
|
+
};
|
29510
|
+
return acc;
|
29511
|
+
},
|
29512
|
+
{}
|
29513
|
+
);
|
29514
|
+
const indPolicyPatchedSnap1 = copy(policyPatchedSnap1);
|
29515
|
+
indPolicyPatchedSnap1.policies = mapEntries(
|
29516
|
+
indPolicyPatchedSnap1.policies,
|
29517
|
+
(policyKey, policyValue) => {
|
29518
|
+
const key = policyKey;
|
29519
|
+
const change = indPolicyRenamesDict[key];
|
29520
|
+
if (change) {
|
29521
|
+
policyValue.name = change.nameTo;
|
29522
|
+
}
|
29523
|
+
return [policyKey, policyValue];
|
29524
|
+
}
|
29525
|
+
);
|
29526
|
+
const viewsDiff = diffSchemasOrTables(indPolicyPatchedSnap1.views, json2.views);
|
29281
29527
|
const {
|
29282
29528
|
created: createdViews,
|
29283
29529
|
deleted: deletedViews,
|
@@ -29419,16 +29665,16 @@ var init_snapshotsDiffer = __esm({
|
|
29419
29665
|
);
|
29420
29666
|
if (it.alteredUniqueConstraints) {
|
29421
29667
|
const added = {};
|
29422
|
-
const
|
29668
|
+
const deleted2 = {};
|
29423
29669
|
for (const k of Object.keys(it.alteredUniqueConstraints)) {
|
29424
29670
|
added[k] = it.alteredUniqueConstraints[k].__new;
|
29425
|
-
|
29671
|
+
deleted2[k] = it.alteredUniqueConstraints[k].__old;
|
29426
29672
|
}
|
29427
29673
|
addedUniqueConstraints.push(
|
29428
29674
|
...prepareAddUniqueConstraintPg(it.name, it.schema, added)
|
29429
29675
|
);
|
29430
29676
|
deletedUniqueConstraints.push(
|
29431
|
-
...prepareDeleteUniqueConstraintPg(it.name, it.schema,
|
29677
|
+
...prepareDeleteUniqueConstraintPg(it.name, it.schema, deleted2)
|
29432
29678
|
);
|
29433
29679
|
}
|
29434
29680
|
createCheckConstraints = prepareAddCheckConstraint(it.name, it.schema, it.addedCheckConstraints);
|
@@ -29439,13 +29685,13 @@ var init_snapshotsDiffer = __esm({
|
|
29439
29685
|
);
|
29440
29686
|
if (it.alteredCheckConstraints && action !== "push") {
|
29441
29687
|
const added = {};
|
29442
|
-
const
|
29688
|
+
const deleted2 = {};
|
29443
29689
|
for (const k of Object.keys(it.alteredCheckConstraints)) {
|
29444
29690
|
added[k] = it.alteredCheckConstraints[k].__new;
|
29445
|
-
|
29691
|
+
deleted2[k] = it.alteredCheckConstraints[k].__old;
|
29446
29692
|
}
|
29447
29693
|
createCheckConstraints.push(...prepareAddCheckConstraint(it.name, it.schema, added));
|
29448
|
-
deleteCheckConstraints.push(...prepareDeleteCheckConstraint(it.name, it.schema,
|
29694
|
+
deleteCheckConstraints.push(...prepareDeleteCheckConstraint(it.name, it.schema, deleted2));
|
29449
29695
|
}
|
29450
29696
|
jsonCreatedCheckConstraints.push(...createCheckConstraints);
|
29451
29697
|
jsonDeletedCheckConstraints.push(...deleteCheckConstraints);
|
@@ -29493,8 +29739,68 @@ var init_snapshotsDiffer = __esm({
|
|
29493
29739
|
const jsonDropPoliciesStatements = [];
|
29494
29740
|
const jsonAlterPoliciesStatements = [];
|
29495
29741
|
const jsonRenamePoliciesStatements = [];
|
29742
|
+
const jsonRenameIndPoliciesStatements = [];
|
29743
|
+
const jsonCreateIndPoliciesStatements = [];
|
29744
|
+
const jsonDropIndPoliciesStatements = [];
|
29745
|
+
const jsonAlterIndPoliciesStatements = [];
|
29496
29746
|
const jsonEnableRLSStatements = [];
|
29497
29747
|
const jsonDisableRLSStatements = [];
|
29748
|
+
for (let it of indPolicyRenames) {
|
29749
|
+
jsonRenameIndPoliciesStatements.push(
|
29750
|
+
...prepareRenameIndPolicyJsons([it])
|
29751
|
+
);
|
29752
|
+
}
|
29753
|
+
for (const it of indPolicyCreates) {
|
29754
|
+
jsonCreateIndPoliciesStatements.push(
|
29755
|
+
...prepareCreateIndPolicyJsons(
|
29756
|
+
it.policies
|
29757
|
+
)
|
29758
|
+
);
|
29759
|
+
}
|
29760
|
+
for (const it of indPolicyDeletes) {
|
29761
|
+
jsonDropIndPoliciesStatements.push(
|
29762
|
+
...prepareDropIndPolicyJsons(
|
29763
|
+
it.policies
|
29764
|
+
)
|
29765
|
+
);
|
29766
|
+
}
|
29767
|
+
typedResult.alteredPolicies.forEach(({ values }) => {
|
29768
|
+
const policy4 = PgSquasher.unsquashPolicy(values);
|
29769
|
+
const newPolicy = json1.policies[policy4.name];
|
29770
|
+
const oldPolicy = json2.policies[policy4.name];
|
29771
|
+
if (newPolicy.as !== oldPolicy.as) {
|
29772
|
+
jsonDropIndPoliciesStatements.push(
|
29773
|
+
...prepareDropIndPolicyJsons(
|
29774
|
+
[oldPolicy]
|
29775
|
+
)
|
29776
|
+
);
|
29777
|
+
jsonCreateIndPoliciesStatements.push(
|
29778
|
+
...prepareCreateIndPolicyJsons(
|
29779
|
+
[newPolicy]
|
29780
|
+
)
|
29781
|
+
);
|
29782
|
+
return;
|
29783
|
+
}
|
29784
|
+
if (newPolicy.for !== oldPolicy.for) {
|
29785
|
+
jsonDropIndPoliciesStatements.push(
|
29786
|
+
...prepareDropIndPolicyJsons(
|
29787
|
+
[oldPolicy]
|
29788
|
+
)
|
29789
|
+
);
|
29790
|
+
jsonCreateIndPoliciesStatements.push(
|
29791
|
+
...prepareCreateIndPolicyJsons(
|
29792
|
+
[newPolicy]
|
29793
|
+
)
|
29794
|
+
);
|
29795
|
+
return;
|
29796
|
+
}
|
29797
|
+
jsonAlterIndPoliciesStatements.push(
|
29798
|
+
prepareAlterIndPolicyJson(
|
29799
|
+
oldPolicy,
|
29800
|
+
newPolicy
|
29801
|
+
)
|
29802
|
+
);
|
29803
|
+
});
|
29498
29804
|
for (let it of policyRenames) {
|
29499
29805
|
jsonRenamePoliciesStatements.push(
|
29500
29806
|
...prepareRenamePolicyJsons(it.table, it.schema, it.renames)
|
@@ -29882,6 +30188,10 @@ var init_snapshotsDiffer = __esm({
|
|
29882
30188
|
jsonStatements.push(...jsonDropPoliciesStatements);
|
29883
30189
|
jsonStatements.push(...jsonCreatePoliciesStatements);
|
29884
30190
|
jsonStatements.push(...jsonAlterPoliciesStatements);
|
30191
|
+
jsonStatements.push(...jsonRenameIndPoliciesStatements);
|
30192
|
+
jsonStatements.push(...jsonDropIndPoliciesStatements);
|
30193
|
+
jsonStatements.push(...jsonCreateIndPoliciesStatements);
|
30194
|
+
jsonStatements.push(...jsonAlterIndPoliciesStatements);
|
29885
30195
|
jsonStatements.push(...createViews);
|
29886
30196
|
jsonStatements.push(...dropEnums);
|
29887
30197
|
jsonStatements.push(...dropSequences);
|
@@ -32466,6 +32776,7 @@ __export(migrate_exports, {
|
|
32466
32776
|
columnsResolver: () => columnsResolver,
|
32467
32777
|
embeddedMigrations: () => embeddedMigrations,
|
32468
32778
|
enumsResolver: () => enumsResolver,
|
32779
|
+
indPolicyResolver: () => indPolicyResolver,
|
32469
32780
|
mySqlViewsResolver: () => mySqlViewsResolver,
|
32470
32781
|
policyResolver: () => policyResolver,
|
32471
32782
|
prepareAndMigrateLibSQL: () => prepareAndMigrateLibSQL,
|
@@ -32489,7 +32800,7 @@ __export(migrate_exports, {
|
|
32489
32800
|
viewsResolver: () => viewsResolver,
|
32490
32801
|
writeResult: () => writeResult
|
32491
32802
|
});
|
32492
|
-
var import_fs5, import_hanji3, import_path4, schemasResolver, tablesResolver, viewsResolver, mySqlViewsResolver, sqliteViewsResolver, sequencesResolver, roleResolver, policyResolver, enumsResolver, columnsResolver, prepareAndMigratePg, preparePgPush, prepareMySQLPush, prepareAndMigrateMysql, prepareAndMigrateSqlite, prepareAndMigrateLibSQL, prepareSQLitePush, prepareLibSQLPush, promptColumnsConflicts, promptNamedConflict, promptNamedWithSchemasConflict, promptSchemasConflict, BREAKPOINT, writeResult, embeddedMigrations, prepareSnapshotFolderName, two;
|
32803
|
+
var import_fs5, import_hanji3, import_path4, schemasResolver, tablesResolver, viewsResolver, mySqlViewsResolver, sqliteViewsResolver, sequencesResolver, roleResolver, policyResolver, indPolicyResolver, enumsResolver, columnsResolver, prepareAndMigratePg, preparePgPush, prepareMySQLPush, prepareAndMigrateMysql, prepareAndMigrateSqlite, prepareAndMigrateLibSQL, prepareSQLitePush, prepareLibSQLPush, promptColumnsConflicts, promptNamedConflict, promptNamedWithSchemasConflict, promptSchemasConflict, BREAKPOINT, writeResult, embeddedMigrations, prepareSnapshotFolderName, two;
|
32493
32804
|
var init_migrate = __esm({
|
32494
32805
|
"src/cli/commands/migrate.ts"() {
|
32495
32806
|
"use strict";
|
@@ -32634,6 +32945,18 @@ var init_migrate = __esm({
|
|
32634
32945
|
renamed: result.renamed
|
32635
32946
|
};
|
32636
32947
|
};
|
32948
|
+
indPolicyResolver = async (input) => {
|
32949
|
+
const result = await promptNamedConflict(
|
32950
|
+
input.created,
|
32951
|
+
input.deleted,
|
32952
|
+
"policy"
|
32953
|
+
);
|
32954
|
+
return {
|
32955
|
+
created: result.created,
|
32956
|
+
deleted: result.deleted,
|
32957
|
+
renamed: result.renamed
|
32958
|
+
};
|
32959
|
+
};
|
32637
32960
|
enumsResolver = async (input) => {
|
32638
32961
|
try {
|
32639
32962
|
const { created, deleted, moved, renamed } = await promptNamedWithSchemasConflict(
|
@@ -32705,6 +33028,7 @@ var init_migrate = __esm({
|
|
32705
33028
|
enumsResolver,
|
32706
33029
|
sequencesResolver,
|
32707
33030
|
policyResolver,
|
33031
|
+
indPolicyResolver,
|
32708
33032
|
roleResolver,
|
32709
33033
|
tablesResolver,
|
32710
33034
|
columnsResolver,
|
@@ -32743,6 +33067,7 @@ var init_migrate = __esm({
|
|
32743
33067
|
enumsResolver,
|
32744
33068
|
sequencesResolver,
|
32745
33069
|
policyResolver,
|
33070
|
+
indPolicyResolver,
|
32746
33071
|
roleResolver,
|
32747
33072
|
tablesResolver,
|
32748
33073
|
columnsResolver,
|
@@ -42316,7 +42641,7 @@ function determineRequestsReferrer(request, { referrerURLCallback, referrerOrigi
|
|
42316
42641
|
if (request.referrer === "no-referrer" || request.referrerPolicy === "") {
|
42317
42642
|
return null;
|
42318
42643
|
}
|
42319
|
-
const
|
42644
|
+
const policy4 = request.referrerPolicy;
|
42320
42645
|
if (request.referrer === "about:client") {
|
42321
42646
|
return "no-referrer";
|
42322
42647
|
}
|
@@ -42333,7 +42658,7 @@ function determineRequestsReferrer(request, { referrerURLCallback, referrerOrigi
|
|
42333
42658
|
referrerOrigin = referrerOriginCallback(referrerOrigin);
|
42334
42659
|
}
|
42335
42660
|
const currentURL = new URL(request.url);
|
42336
|
-
switch (
|
42661
|
+
switch (policy4) {
|
42337
42662
|
case "no-referrer":
|
42338
42663
|
return "no-referrer";
|
42339
42664
|
case "origin":
|
@@ -42369,18 +42694,18 @@ function determineRequestsReferrer(request, { referrerURLCallback, referrerOrigi
|
|
42369
42694
|
}
|
42370
42695
|
return referrerURL;
|
42371
42696
|
default:
|
42372
|
-
throw new TypeError(`Invalid referrerPolicy: ${
|
42697
|
+
throw new TypeError(`Invalid referrerPolicy: ${policy4}`);
|
42373
42698
|
}
|
42374
42699
|
}
|
42375
42700
|
function parseReferrerPolicyFromHeader(headers) {
|
42376
42701
|
const policyTokens = (headers.get("referrer-policy") || "").split(/[,\s]+/);
|
42377
|
-
let
|
42702
|
+
let policy4 = "";
|
42378
42703
|
for (const token of policyTokens) {
|
42379
42704
|
if (token && ReferrerPolicy.has(token)) {
|
42380
|
-
|
42705
|
+
policy4 = token;
|
42381
42706
|
}
|
42382
42707
|
}
|
42383
|
-
return
|
42708
|
+
return policy4;
|
42384
42709
|
}
|
42385
42710
|
var import_node_net, ReferrerPolicy, DEFAULT_REFERRER_POLICY;
|
42386
42711
|
var init_referrer = __esm({
|
@@ -63027,7 +63352,7 @@ var require_fromWebToken = __commonJS({
|
|
63027
63352
|
var fromWebToken2 = (init2) => async () => {
|
63028
63353
|
var _a;
|
63029
63354
|
(_a = init2.logger) == null ? void 0 : _a.debug("@aws-sdk/credential-provider-web-identity", "fromWebToken");
|
63030
|
-
const { roleArn, roleSessionName, webIdentityToken, providerId, policyArns, policy:
|
63355
|
+
const { roleArn, roleSessionName, webIdentityToken, providerId, policyArns, policy: policy4, durationSeconds } = init2;
|
63031
63356
|
let { roleAssumerWithWebIdentity } = init2;
|
63032
63357
|
if (!roleAssumerWithWebIdentity) {
|
63033
63358
|
const { getDefaultRoleAssumerWithWebIdentity } = await Promise.resolve().then(() => __importStar2(require_dist_cjs50()));
|
@@ -63043,7 +63368,7 @@ var require_fromWebToken = __commonJS({
|
|
63043
63368
|
WebIdentityToken: webIdentityToken,
|
63044
63369
|
ProviderId: providerId,
|
63045
63370
|
PolicyArns: policyArns,
|
63046
|
-
Policy:
|
63371
|
+
Policy: policy4,
|
63047
63372
|
DurationSeconds: durationSeconds
|
63048
63373
|
});
|
63049
63374
|
};
|
@@ -84775,6 +85100,8 @@ var init_introspect = __esm({
|
|
84775
85100
|
enumsResolver,
|
84776
85101
|
sequencesResolver,
|
84777
85102
|
policyResolver,
|
85103
|
+
indPolicyResolver,
|
85104
|
+
roleResolver,
|
84778
85105
|
tablesResolver,
|
84779
85106
|
columnsResolver,
|
84780
85107
|
viewsResolver,
|
@@ -88131,7 +88458,8 @@ var push = command({
|
|
88131
88458
|
tablesFilter,
|
88132
88459
|
schemasFilter,
|
88133
88460
|
force,
|
88134
|
-
casing: casing2
|
88461
|
+
casing: casing2,
|
88462
|
+
entities
|
88135
88463
|
} = config;
|
88136
88464
|
try {
|
88137
88465
|
if (dialect4 === "mysql") {
|
@@ -88174,6 +88502,7 @@ var push = command({
|
|
88174
88502
|
credentials2,
|
88175
88503
|
tablesFilter,
|
88176
88504
|
schemasFilter,
|
88505
|
+
entities,
|
88177
88506
|
force,
|
88178
88507
|
casing2
|
88179
88508
|
);
|
@@ -88513,7 +88842,7 @@ init_utils2();
|
|
88513
88842
|
var version2 = async () => {
|
88514
88843
|
const { npmVersion } = await ormCoreVersions();
|
88515
88844
|
const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
|
88516
|
-
const envVersion = "0.26.2-
|
88845
|
+
const envVersion = "0.26.2-53e089b";
|
88517
88846
|
const kitVersion = envVersion ? `v${envVersion}` : "--";
|
88518
88847
|
const versions = `drizzle-kit: ${kitVersion}
|
88519
88848
|
${ormVersion}`;
|