drizzle-kit 0.23.2-6234cbf → 0.23.2-6f27447
Sign up to get free protection for your applications and to get access to all the features.
- package/api.js +33 -0
- package/api.mjs +33 -0
- package/bin.cjs +34 -1
- package/package.json +1 -1
- package/utils.js +5 -0
- package/utils.mjs +4 -0
package/api.js
CHANGED
@@ -8338,6 +8338,9 @@ var init_sqliteSchema = __esm({
|
|
8338
8338
|
});
|
8339
8339
|
|
8340
8340
|
// src/utils.ts
|
8341
|
+
function isPgArrayType(sqlType) {
|
8342
|
+
return sqlType.match(/.*\[\d*\].*|.*\[\].*/g) !== null;
|
8343
|
+
}
|
8341
8344
|
var copy, prepareMigrationMeta, schemaRenameKey, tableRenameKey, columnRenameKey;
|
8342
8345
|
var init_utils = __esm({
|
8343
8346
|
"src/utils.ts"() {
|
@@ -24636,6 +24639,30 @@ function minRangeForIdentityBasedOn(columnType) {
|
|
24636
24639
|
function stringFromDatabaseIdentityProperty(field) {
|
24637
24640
|
return typeof field === "string" ? field : typeof field === "undefined" ? void 0 : typeof field === "bigint" ? field.toString() : String(field);
|
24638
24641
|
}
|
24642
|
+
function buildArrayString(array, sqlType) {
|
24643
|
+
sqlType = sqlType.split("[")[0];
|
24644
|
+
const values = array.map((value) => {
|
24645
|
+
if (typeof value === "number" || typeof value === "bigint") {
|
24646
|
+
return value.toString();
|
24647
|
+
} else if (typeof value === "boolean") {
|
24648
|
+
return value ? "true" : "false";
|
24649
|
+
} else if (Array.isArray(value)) {
|
24650
|
+
return buildArrayString(value, sqlType);
|
24651
|
+
} else if (value instanceof Date) {
|
24652
|
+
if (sqlType === "date") {
|
24653
|
+
return `"${value.toISOString().split("T")[0]}"`;
|
24654
|
+
} else if (sqlType === "timestamp") {
|
24655
|
+
return `"${value.toISOString().replace("T", " ").slice(0, 23)}"`;
|
24656
|
+
} else {
|
24657
|
+
return `"${value.toISOString()}"`;
|
24658
|
+
}
|
24659
|
+
} else if (typeof value === "object") {
|
24660
|
+
return `"${JSON.stringify(value).replaceAll('"', '\\"')}"`;
|
24661
|
+
}
|
24662
|
+
return `"${value}"`;
|
24663
|
+
}).join(",");
|
24664
|
+
return `{${values}}`;
|
24665
|
+
}
|
24639
24666
|
var dialect4, indexName, generatePgSnapshot, trimChar, fromDatabase, columnToDefault, defaultForColumn;
|
24640
24667
|
var init_pgSerializer = __esm({
|
24641
24668
|
"src/serializer/pgSerializer.ts"() {
|
@@ -24646,6 +24673,7 @@ var init_pgSerializer = __esm({
|
|
24646
24673
|
init_pg_core();
|
24647
24674
|
init_vector3();
|
24648
24675
|
init_outputs();
|
24676
|
+
init_utils();
|
24649
24677
|
init_serializer();
|
24650
24678
|
dialect4 = new PgDialect();
|
24651
24679
|
indexName = (tableName, columns) => {
|
@@ -24752,6 +24780,11 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
24752
24780
|
} else {
|
24753
24781
|
columnToSet.default = `'${column4.default.toISOString()}'`;
|
24754
24782
|
}
|
24783
|
+
} else if (isPgArrayType(sqlTypeLowered) && Array.isArray(column4.default)) {
|
24784
|
+
columnToSet.default = `'${buildArrayString(
|
24785
|
+
column4.default,
|
24786
|
+
sqlTypeLowered
|
24787
|
+
)}'::${sqlTypeLowered}`;
|
24755
24788
|
} else {
|
24756
24789
|
columnToSet.default = column4.default;
|
24757
24790
|
}
|
package/api.mjs
CHANGED
@@ -8343,6 +8343,9 @@ var init_sqliteSchema = __esm({
|
|
8343
8343
|
});
|
8344
8344
|
|
8345
8345
|
// src/utils.ts
|
8346
|
+
function isPgArrayType(sqlType) {
|
8347
|
+
return sqlType.match(/.*\[\d*\].*|.*\[\].*/g) !== null;
|
8348
|
+
}
|
8346
8349
|
var copy, prepareMigrationMeta, schemaRenameKey, tableRenameKey, columnRenameKey;
|
8347
8350
|
var init_utils = __esm({
|
8348
8351
|
"src/utils.ts"() {
|
@@ -24641,6 +24644,30 @@ function minRangeForIdentityBasedOn(columnType) {
|
|
24641
24644
|
function stringFromDatabaseIdentityProperty(field) {
|
24642
24645
|
return typeof field === "string" ? field : typeof field === "undefined" ? void 0 : typeof field === "bigint" ? field.toString() : String(field);
|
24643
24646
|
}
|
24647
|
+
function buildArrayString(array, sqlType) {
|
24648
|
+
sqlType = sqlType.split("[")[0];
|
24649
|
+
const values = array.map((value) => {
|
24650
|
+
if (typeof value === "number" || typeof value === "bigint") {
|
24651
|
+
return value.toString();
|
24652
|
+
} else if (typeof value === "boolean") {
|
24653
|
+
return value ? "true" : "false";
|
24654
|
+
} else if (Array.isArray(value)) {
|
24655
|
+
return buildArrayString(value, sqlType);
|
24656
|
+
} else if (value instanceof Date) {
|
24657
|
+
if (sqlType === "date") {
|
24658
|
+
return `"${value.toISOString().split("T")[0]}"`;
|
24659
|
+
} else if (sqlType === "timestamp") {
|
24660
|
+
return `"${value.toISOString().replace("T", " ").slice(0, 23)}"`;
|
24661
|
+
} else {
|
24662
|
+
return `"${value.toISOString()}"`;
|
24663
|
+
}
|
24664
|
+
} else if (typeof value === "object") {
|
24665
|
+
return `"${JSON.stringify(value).replaceAll('"', '\\"')}"`;
|
24666
|
+
}
|
24667
|
+
return `"${value}"`;
|
24668
|
+
}).join(",");
|
24669
|
+
return `{${values}}`;
|
24670
|
+
}
|
24644
24671
|
var dialect4, indexName, generatePgSnapshot, trimChar, fromDatabase, columnToDefault, defaultForColumn;
|
24645
24672
|
var init_pgSerializer = __esm({
|
24646
24673
|
"src/serializer/pgSerializer.ts"() {
|
@@ -24651,6 +24678,7 @@ var init_pgSerializer = __esm({
|
|
24651
24678
|
init_pg_core();
|
24652
24679
|
init_vector3();
|
24653
24680
|
init_outputs();
|
24681
|
+
init_utils();
|
24654
24682
|
init_serializer();
|
24655
24683
|
dialect4 = new PgDialect();
|
24656
24684
|
indexName = (tableName, columns) => {
|
@@ -24757,6 +24785,11 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
24757
24785
|
} else {
|
24758
24786
|
columnToSet.default = `'${column4.default.toISOString()}'`;
|
24759
24787
|
}
|
24788
|
+
} else if (isPgArrayType(sqlTypeLowered) && Array.isArray(column4.default)) {
|
24789
|
+
columnToSet.default = `'${buildArrayString(
|
24790
|
+
column4.default,
|
24791
|
+
sqlTypeLowered
|
24792
|
+
)}'::${sqlTypeLowered}`;
|
24760
24793
|
} else {
|
24761
24794
|
columnToSet.default = column4.default;
|
24762
24795
|
}
|
package/bin.cjs
CHANGED
@@ -6561,6 +6561,9 @@ var init_sqliteSchema = __esm({
|
|
6561
6561
|
});
|
6562
6562
|
|
6563
6563
|
// src/utils.ts
|
6564
|
+
function isPgArrayType(sqlType) {
|
6565
|
+
return sqlType.match(/.*\[\d*\].*|.*\[\].*/g) !== null;
|
6566
|
+
}
|
6564
6567
|
var import_fs, import_path, import_url, copy, objectValues, assertV1OutFolder, dryJournal, prepareOutFolder, validatorForDialect, validateWithReport, prepareMigrationFolder, prepareMigrationMeta, schemaRenameKey, tableRenameKey, columnRenameKey, normaliseSQLiteUrl;
|
6565
6568
|
var init_utils = __esm({
|
6566
6569
|
"src/utils.ts"() {
|
@@ -18406,6 +18409,30 @@ function minRangeForIdentityBasedOn(columnType) {
|
|
18406
18409
|
function stringFromDatabaseIdentityProperty(field) {
|
18407
18410
|
return typeof field === "string" ? field : typeof field === "undefined" ? void 0 : typeof field === "bigint" ? field.toString() : String(field);
|
18408
18411
|
}
|
18412
|
+
function buildArrayString(array, sqlType) {
|
18413
|
+
sqlType = sqlType.split("[")[0];
|
18414
|
+
const values = array.map((value) => {
|
18415
|
+
if (typeof value === "number" || typeof value === "bigint") {
|
18416
|
+
return value.toString();
|
18417
|
+
} else if (typeof value === "boolean") {
|
18418
|
+
return value ? "true" : "false";
|
18419
|
+
} else if (Array.isArray(value)) {
|
18420
|
+
return buildArrayString(value, sqlType);
|
18421
|
+
} else if (value instanceof Date) {
|
18422
|
+
if (sqlType === "date") {
|
18423
|
+
return `"${value.toISOString().split("T")[0]}"`;
|
18424
|
+
} else if (sqlType === "timestamp") {
|
18425
|
+
return `"${value.toISOString().replace("T", " ").slice(0, 23)}"`;
|
18426
|
+
} else {
|
18427
|
+
return `"${value.toISOString()}"`;
|
18428
|
+
}
|
18429
|
+
} else if (typeof value === "object") {
|
18430
|
+
return `"${JSON.stringify(value).replaceAll('"', '\\"')}"`;
|
18431
|
+
}
|
18432
|
+
return `"${value}"`;
|
18433
|
+
}).join(",");
|
18434
|
+
return `{${values}}`;
|
18435
|
+
}
|
18409
18436
|
var import_drizzle_orm5, import_pg_core2, import_pg_core3, dialect5, indexName2, generatePgSnapshot, trimChar, fromDatabase2, columnToDefault, defaultForColumn;
|
18410
18437
|
var init_pgSerializer = __esm({
|
18411
18438
|
"src/serializer/pgSerializer.ts"() {
|
@@ -18416,6 +18443,7 @@ var init_pgSerializer = __esm({
|
|
18416
18443
|
import_pg_core3 = require("drizzle-orm/pg-core");
|
18417
18444
|
init_vector();
|
18418
18445
|
init_outputs();
|
18446
|
+
init_utils();
|
18419
18447
|
init_serializer();
|
18420
18448
|
dialect5 = new import_pg_core2.PgDialect();
|
18421
18449
|
indexName2 = (tableName, columns) => {
|
@@ -18524,6 +18552,11 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
18524
18552
|
} else {
|
18525
18553
|
columnToSet.default = `'${column7.default.toISOString()}'`;
|
18526
18554
|
}
|
18555
|
+
} else if (isPgArrayType(sqlTypeLowered) && Array.isArray(column7.default)) {
|
18556
|
+
columnToSet.default = `'${buildArrayString(
|
18557
|
+
column7.default,
|
18558
|
+
sqlTypeLowered
|
18559
|
+
)}'::${sqlTypeLowered}`;
|
18527
18560
|
} else {
|
18528
18561
|
columnToSet.default = column7.default;
|
18529
18562
|
}
|
@@ -83369,7 +83402,7 @@ init_utils2();
|
|
83369
83402
|
var version2 = async () => {
|
83370
83403
|
const { npmVersion } = await ormCoreVersions();
|
83371
83404
|
const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
|
83372
|
-
const envVersion = "0.23.2-
|
83405
|
+
const envVersion = "0.23.2-6f27447";
|
83373
83406
|
const kitVersion = envVersion ? `v${envVersion}` : "--";
|
83374
83407
|
const versions = `drizzle-kit: ${kitVersion}
|
83375
83408
|
${ormVersion}`;
|
package/package.json
CHANGED
package/utils.js
CHANGED
@@ -568,6 +568,7 @@ __export(utils_exports, {
|
|
568
568
|
columnRenameKey: () => columnRenameKey,
|
569
569
|
copy: () => copy,
|
570
570
|
dryJournal: () => dryJournal,
|
571
|
+
isPgArrayType: () => isPgArrayType,
|
571
572
|
kloudMeta: () => kloudMeta,
|
572
573
|
normaliseSQLiteUrl: () => normaliseSQLiteUrl,
|
573
574
|
objectValues: () => objectValues,
|
@@ -5738,12 +5739,16 @@ var normaliseSQLiteUrl = (it, type) => {
|
|
5738
5739
|
}
|
5739
5740
|
assertUnreachable(type);
|
5740
5741
|
};
|
5742
|
+
function isPgArrayType(sqlType) {
|
5743
|
+
return sqlType.match(/.*\[\d*\].*|.*\[\].*/g) !== null;
|
5744
|
+
}
|
5741
5745
|
// Annotate the CommonJS export names for ESM import in node:
|
5742
5746
|
0 && (module.exports = {
|
5743
5747
|
assertV1OutFolder,
|
5744
5748
|
columnRenameKey,
|
5745
5749
|
copy,
|
5746
5750
|
dryJournal,
|
5751
|
+
isPgArrayType,
|
5747
5752
|
kloudMeta,
|
5748
5753
|
normaliseSQLiteUrl,
|
5749
5754
|
objectValues,
|
package/utils.mjs
CHANGED
@@ -5720,11 +5720,15 @@ var normaliseSQLiteUrl = (it, type) => {
|
|
5720
5720
|
}
|
5721
5721
|
assertUnreachable(type);
|
5722
5722
|
};
|
5723
|
+
function isPgArrayType(sqlType) {
|
5724
|
+
return sqlType.match(/.*\[\d*\].*|.*\[\].*/g) !== null;
|
5725
|
+
}
|
5723
5726
|
export {
|
5724
5727
|
assertV1OutFolder,
|
5725
5728
|
columnRenameKey,
|
5726
5729
|
copy,
|
5727
5730
|
dryJournal,
|
5731
|
+
isPgArrayType,
|
5728
5732
|
kloudMeta,
|
5729
5733
|
normaliseSQLiteUrl,
|
5730
5734
|
objectValues,
|