drizzle-kit 0.22.0-72736ba → 0.22.0-a8a3158
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/bin.cjs +406 -220
- package/index.d.mts +2 -8
- package/index.d.ts +2 -8
- package/package.json +2 -2
- package/payload.js +1577 -1127
- package/payload.mjs +1604 -1145
- package/utils-studio.js +100 -7
- package/utils-studio.mjs +100 -7
package/bin.cjs
CHANGED
|
@@ -1092,7 +1092,7 @@ var init_views = __esm({
|
|
|
1092
1092
|
return source_default.grey(msg);
|
|
1093
1093
|
};
|
|
1094
1094
|
error = (error2, greyMsg = "") => {
|
|
1095
|
-
return `${source_default.
|
|
1095
|
+
return `${source_default.bgRed.bold(" Error ")} ${error2} ${greyMsg ? source_default.grey(greyMsg) : ""}`.trim();
|
|
1096
1096
|
};
|
|
1097
1097
|
schema = (schema5) => {
|
|
1098
1098
|
const tables = Object.values(schema5.tables);
|
|
@@ -1451,6 +1451,9 @@ Is ${source_default.bold.blue(
|
|
|
1451
1451
|
function assertUnreachable(x3) {
|
|
1452
1452
|
throw new Error("Didn't expect to get here");
|
|
1453
1453
|
}
|
|
1454
|
+
function softAssertUnreachable(x3) {
|
|
1455
|
+
return null;
|
|
1456
|
+
}
|
|
1454
1457
|
var originUUID, snapshotVersion, mapValues, mapKeys, mapEntries;
|
|
1455
1458
|
var init_global = __esm({
|
|
1456
1459
|
"src/global.ts"() {
|
|
@@ -7281,7 +7284,7 @@ var require_coerce = __commonJS({
|
|
|
7281
7284
|
var SemVer = require_semver();
|
|
7282
7285
|
var parse7 = require_parse();
|
|
7283
7286
|
var { safeRe: re2, t: t2 } = require_re();
|
|
7284
|
-
var
|
|
7287
|
+
var coerce2 = (version2, options) => {
|
|
7285
7288
|
if (version2 instanceof SemVer) {
|
|
7286
7289
|
return version2;
|
|
7287
7290
|
}
|
|
@@ -7316,7 +7319,7 @@ var require_coerce = __commonJS({
|
|
|
7316
7319
|
const build = options.includePrerelease && match2[6] ? `+${match2[6]}` : "";
|
|
7317
7320
|
return parse7(`${major}.${minor}.${patch}${prerelease}${build}`, options);
|
|
7318
7321
|
};
|
|
7319
|
-
module2.exports =
|
|
7322
|
+
module2.exports = coerce2;
|
|
7320
7323
|
}
|
|
7321
7324
|
});
|
|
7322
7325
|
|
|
@@ -8317,7 +8320,7 @@ var require_semver2 = __commonJS({
|
|
|
8317
8320
|
var gte = require_gte();
|
|
8318
8321
|
var lte = require_lte();
|
|
8319
8322
|
var cmp = require_cmp();
|
|
8320
|
-
var
|
|
8323
|
+
var coerce2 = require_coerce();
|
|
8321
8324
|
var Comparator = require_comparator();
|
|
8322
8325
|
var Range = require_range();
|
|
8323
8326
|
var satisfies = require_satisfies();
|
|
@@ -8355,7 +8358,7 @@ var require_semver2 = __commonJS({
|
|
|
8355
8358
|
gte,
|
|
8356
8359
|
lte,
|
|
8357
8360
|
cmp,
|
|
8358
|
-
coerce:
|
|
8361
|
+
coerce: coerce2,
|
|
8359
8362
|
Comparator,
|
|
8360
8363
|
Range,
|
|
8361
8364
|
satisfies,
|
|
@@ -8575,12 +8578,137 @@ var init_utils3 = __esm({
|
|
|
8575
8578
|
}
|
|
8576
8579
|
});
|
|
8577
8580
|
|
|
8581
|
+
// src/schemaValidator.ts
|
|
8582
|
+
var dialect3, commonSquashedSchema, commonSchema;
|
|
8583
|
+
var init_schemaValidator = __esm({
|
|
8584
|
+
"src/schemaValidator.ts"() {
|
|
8585
|
+
"use strict";
|
|
8586
|
+
init_lib();
|
|
8587
|
+
init_mysqlSchema();
|
|
8588
|
+
init_pgSchema();
|
|
8589
|
+
init_sqliteSchema();
|
|
8590
|
+
dialect3 = enumType(["postgresql", "mysql", "sqlite"]);
|
|
8591
|
+
commonSquashedSchema = unionType([
|
|
8592
|
+
pgSchemaSquashed,
|
|
8593
|
+
mysqlSchemaSquashed,
|
|
8594
|
+
SQLiteSchemaSquashed
|
|
8595
|
+
]);
|
|
8596
|
+
commonSchema = unionType([
|
|
8597
|
+
pgSchema,
|
|
8598
|
+
mysqlSchema,
|
|
8599
|
+
sqliteSchema
|
|
8600
|
+
]);
|
|
8601
|
+
}
|
|
8602
|
+
});
|
|
8603
|
+
|
|
8604
|
+
// src/cli/validations/common.ts
|
|
8605
|
+
var assertCollisions, sqliteDriversLiterals, sqliteDriver, postgresDriver, mysqlDriver, driver, configCommonSchema, casing, introspectParams, configIntrospectCliSchema, configGenerateSchema, configPushSchema, wrapParam;
|
|
8606
|
+
var init_common = __esm({
|
|
8607
|
+
"src/cli/validations/common.ts"() {
|
|
8608
|
+
"use strict";
|
|
8609
|
+
init_outputs();
|
|
8610
|
+
init_lib();
|
|
8611
|
+
init_schemaValidator();
|
|
8612
|
+
init_source();
|
|
8613
|
+
assertCollisions = (options, command, inputWhitelist = []) => {
|
|
8614
|
+
const { config, ...rest } = options;
|
|
8615
|
+
let atLeastOneParam = false;
|
|
8616
|
+
for (const key of Object.keys(rest)) {
|
|
8617
|
+
if (inputWhitelist.includes(key))
|
|
8618
|
+
continue;
|
|
8619
|
+
atLeastOneParam = true;
|
|
8620
|
+
}
|
|
8621
|
+
if (!atLeastOneParam && typeof config !== "undefined") {
|
|
8622
|
+
return "config";
|
|
8623
|
+
}
|
|
8624
|
+
if (typeof config === "undefined" && atLeastOneParam) {
|
|
8625
|
+
return "cli";
|
|
8626
|
+
}
|
|
8627
|
+
if (typeof config === "undefined" && !atLeastOneParam) {
|
|
8628
|
+
return "config";
|
|
8629
|
+
}
|
|
8630
|
+
console.log(outputs.common.ambiguousParams(command));
|
|
8631
|
+
process.exit(1);
|
|
8632
|
+
};
|
|
8633
|
+
sqliteDriversLiterals = [
|
|
8634
|
+
literalType("turso"),
|
|
8635
|
+
literalType("d1-http"),
|
|
8636
|
+
literalType("expo")
|
|
8637
|
+
];
|
|
8638
|
+
sqliteDriver = unionType(sqliteDriversLiterals);
|
|
8639
|
+
postgresDriver = literalType("aws-data-api");
|
|
8640
|
+
mysqlDriver = literalType("mysql2");
|
|
8641
|
+
driver = unionType([sqliteDriver, postgresDriver, mysqlDriver]);
|
|
8642
|
+
configCommonSchema = objectType({
|
|
8643
|
+
dialect: dialect3,
|
|
8644
|
+
schema: unionType([stringType(), stringType().array()]).optional(),
|
|
8645
|
+
out: stringType().optional(),
|
|
8646
|
+
breakpoints: booleanType().optional().default(true),
|
|
8647
|
+
driver: driver.optional(),
|
|
8648
|
+
tablesFilter: unionType([stringType(), stringType().array()]).optional(),
|
|
8649
|
+
schemaFilter: unionType([stringType(), stringType().array()]).default(["public"])
|
|
8650
|
+
});
|
|
8651
|
+
casing = unionType([literalType("camel"), literalType("preserve")]).default(
|
|
8652
|
+
"preserve"
|
|
8653
|
+
);
|
|
8654
|
+
introspectParams = objectType({
|
|
8655
|
+
schema: unionType([stringType(), stringType().array()]).optional(),
|
|
8656
|
+
out: stringType().optional().default("./drizzle"),
|
|
8657
|
+
breakpoints: booleanType().default(true),
|
|
8658
|
+
tablesFilter: unionType([stringType(), stringType().array()]).optional(),
|
|
8659
|
+
schemaFilter: unionType([stringType(), stringType().array()]).default(["public"]),
|
|
8660
|
+
introspect: objectType({
|
|
8661
|
+
casing
|
|
8662
|
+
}).default({ casing: "camel" })
|
|
8663
|
+
});
|
|
8664
|
+
configIntrospectCliSchema = objectType({
|
|
8665
|
+
schema: unionType([stringType(), stringType().array()]).optional(),
|
|
8666
|
+
out: stringType().optional().default("./drizzle"),
|
|
8667
|
+
breakpoints: booleanType().default(true),
|
|
8668
|
+
tablesFilter: unionType([stringType(), stringType().array()]).optional(),
|
|
8669
|
+
schemaFilter: unionType([stringType(), stringType().array()]).default(["public"]),
|
|
8670
|
+
introspectCasing: unionType([literalType("camel"), literalType("preserve")]).default(
|
|
8671
|
+
"camel"
|
|
8672
|
+
)
|
|
8673
|
+
});
|
|
8674
|
+
configGenerateSchema = objectType({
|
|
8675
|
+
schema: unionType([stringType(), stringType().array()]),
|
|
8676
|
+
out: stringType().optional().default("./drizzle"),
|
|
8677
|
+
breakpoints: booleanType().default(true)
|
|
8678
|
+
});
|
|
8679
|
+
configPushSchema = objectType({
|
|
8680
|
+
dialect: dialect3,
|
|
8681
|
+
schema: unionType([stringType(), stringType().array()]),
|
|
8682
|
+
tablesFilter: unionType([stringType(), stringType().array()]).optional(),
|
|
8683
|
+
schemaFilter: unionType([stringType(), stringType().array()]).default(["public"]),
|
|
8684
|
+
verbose: booleanType().default(false),
|
|
8685
|
+
strict: booleanType().default(false),
|
|
8686
|
+
out: stringType().optional()
|
|
8687
|
+
});
|
|
8688
|
+
wrapParam = (name, param, optional = false) => {
|
|
8689
|
+
const check = `[${source_default.green("\u2713")}]`;
|
|
8690
|
+
const cross = `[${source_default.red("x")}]`;
|
|
8691
|
+
if (typeof param === "string") {
|
|
8692
|
+
if (param.length === 0) {
|
|
8693
|
+
return ` ${cross} ${name}: ''`;
|
|
8694
|
+
}
|
|
8695
|
+
return ` ${check} ${name}: '${param}'`;
|
|
8696
|
+
}
|
|
8697
|
+
if (optional) {
|
|
8698
|
+
return source_default.gray(` ${name}?: `);
|
|
8699
|
+
}
|
|
8700
|
+
return ` ${cross} ${name}: ${source_default.gray("undefined")}`;
|
|
8701
|
+
};
|
|
8702
|
+
}
|
|
8703
|
+
});
|
|
8704
|
+
|
|
8578
8705
|
// src/cli/validations/outputs.ts
|
|
8579
8706
|
var withStyle, outputs;
|
|
8580
8707
|
var init_outputs = __esm({
|
|
8581
8708
|
"src/cli/validations/outputs.ts"() {
|
|
8582
8709
|
"use strict";
|
|
8583
8710
|
init_source();
|
|
8711
|
+
init_common();
|
|
8584
8712
|
withStyle = {
|
|
8585
8713
|
error: (str) => `${source_default.red(`${source_default.white.bgRed(" Invalid input ")} ${str}`)}`,
|
|
8586
8714
|
warning: (str) => `${source_default.white.bgGray(" Warning ")} ${str}`,
|
|
@@ -8630,14 +8758,17 @@ var init_outputs = __esm({
|
|
|
8630
8758
|
},
|
|
8631
8759
|
sqlite: {
|
|
8632
8760
|
connection: {
|
|
8633
|
-
driver: () =>
|
|
8634
|
-
|
|
8635
|
-
|
|
8636
|
-
|
|
8637
|
-
|
|
8761
|
+
driver: () => {
|
|
8762
|
+
const listOfDrivers = sqliteDriversLiterals.map((it) => `'${it.value}'`).join(", ");
|
|
8763
|
+
return withStyle.error(
|
|
8764
|
+
`Either ${listOfDrivers} are available options for 'driver' param`
|
|
8765
|
+
);
|
|
8766
|
+
},
|
|
8767
|
+
url: (driver3) => withStyle.error(
|
|
8768
|
+
`"url" is a required option for driver "${driver3}". You can read more about drizzle.config: https://orm.drizzle.team/kit-docs/config-reference`
|
|
8638
8769
|
),
|
|
8639
|
-
authToken: (
|
|
8640
|
-
`"authToken" is a required option for driver "${
|
|
8770
|
+
authToken: (driver3) => withStyle.error(
|
|
8771
|
+
`"authToken" is a required option for driver "${driver3}". You can read more about drizzle.config: https://orm.drizzle.team/kit-docs/config-reference`
|
|
8641
8772
|
)
|
|
8642
8773
|
},
|
|
8643
8774
|
introspect: {},
|
|
@@ -8654,13 +8785,15 @@ var init_mysql = __esm({
|
|
|
8654
8785
|
"use strict";
|
|
8655
8786
|
init_lib();
|
|
8656
8787
|
init_outputs();
|
|
8788
|
+
init_common();
|
|
8789
|
+
init_views();
|
|
8657
8790
|
mysqlCredentials = unionType([
|
|
8658
8791
|
objectType({
|
|
8659
|
-
host: stringType(),
|
|
8660
|
-
port: coerce.number().optional(),
|
|
8661
|
-
user: stringType().
|
|
8662
|
-
password: stringType().optional(),
|
|
8663
|
-
database: stringType(),
|
|
8792
|
+
host: stringType().min(1),
|
|
8793
|
+
port: coerce.number().min(1).optional(),
|
|
8794
|
+
user: stringType().min(1).optional(),
|
|
8795
|
+
password: stringType().min(1).optional(),
|
|
8796
|
+
database: stringType().min(1),
|
|
8664
8797
|
ssl: unionType([
|
|
8665
8798
|
stringType(),
|
|
8666
8799
|
objectType({
|
|
@@ -8676,35 +8809,47 @@ var init_mysql = __esm({
|
|
|
8676
8809
|
]).optional()
|
|
8677
8810
|
}),
|
|
8678
8811
|
objectType({
|
|
8679
|
-
url: stringType()
|
|
8812
|
+
url: stringType().min(1)
|
|
8680
8813
|
})
|
|
8681
8814
|
]);
|
|
8682
8815
|
printConfigConnectionIssues = (options) => {
|
|
8683
|
-
if (
|
|
8684
|
-
|
|
8685
|
-
|
|
8686
|
-
|
|
8687
|
-
|
|
8688
|
-
|
|
8816
|
+
if ("url" in options) {
|
|
8817
|
+
let text2 = `Please provide required params for MySQL driver:
|
|
8818
|
+
`;
|
|
8819
|
+
console.log(error(text2));
|
|
8820
|
+
console.log(wrapParam("url", options.url));
|
|
8821
|
+
process.exit(1);
|
|
8689
8822
|
}
|
|
8823
|
+
let text = `Please provide required params for MySQL driver:
|
|
8824
|
+
`;
|
|
8825
|
+
console.log(error(text));
|
|
8826
|
+
console.log(wrapParam("host", options.host));
|
|
8827
|
+
console.log(wrapParam("port", options.port, true));
|
|
8828
|
+
console.log(wrapParam("user", options.user, true));
|
|
8829
|
+
console.log(wrapParam("password", options.password, true));
|
|
8830
|
+
console.log(wrapParam("database", options.database));
|
|
8831
|
+
console.log(wrapParam("ssl", options.ssl, true));
|
|
8832
|
+
process.exit(1);
|
|
8690
8833
|
};
|
|
8691
8834
|
}
|
|
8692
8835
|
});
|
|
8693
8836
|
|
|
8694
|
-
// src/cli/validations/
|
|
8837
|
+
// src/cli/validations/postgres.ts
|
|
8695
8838
|
var postgresCredentials, printConfigConnectionIssues2;
|
|
8696
|
-
var
|
|
8697
|
-
"src/cli/validations/
|
|
8839
|
+
var init_postgres = __esm({
|
|
8840
|
+
"src/cli/validations/postgres.ts"() {
|
|
8698
8841
|
"use strict";
|
|
8699
8842
|
init_lib();
|
|
8700
|
-
|
|
8843
|
+
init_common();
|
|
8844
|
+
init_views();
|
|
8701
8845
|
postgresCredentials = unionType([
|
|
8702
8846
|
objectType({
|
|
8703
|
-
|
|
8704
|
-
|
|
8705
|
-
|
|
8706
|
-
|
|
8707
|
-
|
|
8847
|
+
driver: undefinedType(),
|
|
8848
|
+
host: stringType().min(1),
|
|
8849
|
+
port: coerce.number().min(1).optional(),
|
|
8850
|
+
user: stringType().min(1).optional(),
|
|
8851
|
+
password: stringType().min(1).optional(),
|
|
8852
|
+
database: stringType().min(1),
|
|
8708
8853
|
ssl: unionType([
|
|
8709
8854
|
literalType("require"),
|
|
8710
8855
|
literalType("allow"),
|
|
@@ -8712,26 +8857,60 @@ var init_pg = __esm({
|
|
|
8712
8857
|
literalType("verify-full"),
|
|
8713
8858
|
booleanType(),
|
|
8714
8859
|
objectType({}).passthrough()
|
|
8715
|
-
])
|
|
8860
|
+
]).optional()
|
|
8861
|
+
}).transform((o) => {
|
|
8862
|
+
delete o.driver;
|
|
8863
|
+
return o;
|
|
8716
8864
|
}),
|
|
8717
8865
|
objectType({
|
|
8718
|
-
|
|
8866
|
+
driver: undefinedType(),
|
|
8867
|
+
url: stringType().min(1)
|
|
8868
|
+
}).transform((o) => {
|
|
8869
|
+
delete o.driver;
|
|
8870
|
+
return o;
|
|
8719
8871
|
}),
|
|
8720
8872
|
objectType({
|
|
8721
8873
|
driver: literalType("aws-data-api"),
|
|
8722
|
-
database: stringType(),
|
|
8723
|
-
secretArn: stringType(),
|
|
8724
|
-
resourceArn: stringType()
|
|
8874
|
+
database: stringType().min(1),
|
|
8875
|
+
secretArn: stringType().min(1),
|
|
8876
|
+
resourceArn: stringType().min(1)
|
|
8725
8877
|
})
|
|
8726
8878
|
]);
|
|
8727
8879
|
printConfigConnectionIssues2 = (options) => {
|
|
8728
8880
|
if (options.driver === "aws-data-api") {
|
|
8729
|
-
|
|
8730
|
-
|
|
8881
|
+
let text = `Please provide required params for AWS Data API driver:
|
|
8882
|
+
`;
|
|
8883
|
+
console.log(error(text));
|
|
8884
|
+
console.log(wrapParam("database", options.database));
|
|
8885
|
+
console.log(wrapParam("secretArn", options.secretArn));
|
|
8886
|
+
console.log(wrapParam("resourceArn", options.resourceArn));
|
|
8887
|
+
process.exit(1);
|
|
8888
|
+
}
|
|
8889
|
+
if ("url" in options) {
|
|
8890
|
+
let text = `Please provide required params for Postgres driver:
|
|
8891
|
+
`;
|
|
8892
|
+
console.log(error(text));
|
|
8893
|
+
console.log(wrapParam("url", options.url));
|
|
8894
|
+
process.exit(1);
|
|
8731
8895
|
}
|
|
8732
|
-
if (
|
|
8733
|
-
|
|
8896
|
+
if ("host" in options || "database" in options) {
|
|
8897
|
+
let text = `Please provide required params for Postgres driver:
|
|
8898
|
+
`;
|
|
8899
|
+
console.log(error(text));
|
|
8900
|
+
console.log(wrapParam("host", options.host));
|
|
8901
|
+
console.log(wrapParam("port", options.port, true));
|
|
8902
|
+
console.log(wrapParam("user", options.user, true));
|
|
8903
|
+
console.log(wrapParam("password", options.password, true));
|
|
8904
|
+
console.log(wrapParam("database", options.database));
|
|
8905
|
+
console.log(wrapParam("ssl", options.ssl, true));
|
|
8906
|
+
process.exit(1);
|
|
8734
8907
|
}
|
|
8908
|
+
console.log(
|
|
8909
|
+
error(
|
|
8910
|
+
`Either connection "url" or "host", "database" are required for database connection`
|
|
8911
|
+
)
|
|
8912
|
+
);
|
|
8913
|
+
process.exit(1);
|
|
8735
8914
|
};
|
|
8736
8915
|
}
|
|
8737
8916
|
});
|
|
@@ -8742,154 +8921,77 @@ var init_sqlite = __esm({
|
|
|
8742
8921
|
"src/cli/validations/sqlite.ts"() {
|
|
8743
8922
|
"use strict";
|
|
8744
8923
|
init_lib();
|
|
8745
|
-
|
|
8924
|
+
init_common();
|
|
8925
|
+
init_views();
|
|
8926
|
+
init_global();
|
|
8746
8927
|
sqliteCredentials = unionType([
|
|
8747
8928
|
objectType({
|
|
8748
8929
|
driver: literalType("turso"),
|
|
8749
|
-
url: stringType(),
|
|
8750
|
-
authToken: stringType()
|
|
8930
|
+
url: stringType().min(1),
|
|
8931
|
+
authToken: stringType().min(1).optional()
|
|
8751
8932
|
}),
|
|
8752
8933
|
objectType({
|
|
8753
8934
|
driver: literalType("d1-http"),
|
|
8754
|
-
accountId: stringType(),
|
|
8755
|
-
databaseId: stringType(),
|
|
8756
|
-
token: stringType()
|
|
8935
|
+
accountId: stringType().min(1),
|
|
8936
|
+
databaseId: stringType().min(1),
|
|
8937
|
+
token: stringType().min(1)
|
|
8757
8938
|
}),
|
|
8758
8939
|
objectType({
|
|
8759
|
-
|
|
8940
|
+
driver: undefinedType(),
|
|
8941
|
+
url: stringType().min(1)
|
|
8942
|
+
}).transform((o) => {
|
|
8943
|
+
delete o.driver;
|
|
8944
|
+
return o;
|
|
8760
8945
|
})
|
|
8761
8946
|
]);
|
|
8762
|
-
printConfigConnectionIssues3 = (options) => {
|
|
8763
|
-
|
|
8764
|
-
|
|
8765
|
-
|
|
8766
|
-
|
|
8767
|
-
|
|
8768
|
-
|
|
8769
|
-
|
|
8770
|
-
|
|
8771
|
-
|
|
8772
|
-
|
|
8773
|
-
|
|
8774
|
-
|
|
8775
|
-
|
|
8776
|
-
|
|
8947
|
+
printConfigConnectionIssues3 = (options, command) => {
|
|
8948
|
+
const parsedDriver = sqliteDriver.safeParse(options.driver);
|
|
8949
|
+
const driver3 = parsedDriver.success ? parsedDriver.data : "";
|
|
8950
|
+
if (driver3 === "expo") {
|
|
8951
|
+
if (command === "migrate") {
|
|
8952
|
+
console.log(
|
|
8953
|
+
error(
|
|
8954
|
+
`You can't use 'migrate' command with Expo SQLite, please follow migration instructions in our docs - https://orm.drizzle.team/docs/get-started-sqlite#expo-sqlite`
|
|
8955
|
+
)
|
|
8956
|
+
);
|
|
8957
|
+
} else if (command === "studio") {
|
|
8958
|
+
console.log(
|
|
8959
|
+
error(
|
|
8960
|
+
`You can't use 'studio' command with Expo SQLite, please use Expo Plugin https://www.npmjs.com/package/expo-drizzle-studio-plugin`
|
|
8961
|
+
)
|
|
8962
|
+
);
|
|
8963
|
+
} else if (command === "pull") {
|
|
8964
|
+
console.log(error("You can't use 'pull' command with Expo SQLite"));
|
|
8965
|
+
} else if (command === "push") {
|
|
8966
|
+
console.log(error("You can't use 'push' command with Expo SQLite"));
|
|
8967
|
+
} else {
|
|
8968
|
+
console.log(error("Unexpected error with expo driver \u{1F914}"));
|
|
8777
8969
|
}
|
|
8970
|
+
process.exit(1);
|
|
8971
|
+
} else if (driver3 === "d1-http") {
|
|
8972
|
+
let text2 = `Please provide required params for D1 HTTP driver:
|
|
8973
|
+
`;
|
|
8974
|
+
console.log(error(text2));
|
|
8975
|
+
console.log(wrapParam("accountId", options.accountId));
|
|
8976
|
+
console.log(wrapParam("databaseId", options.databaseId));
|
|
8977
|
+
console.log(wrapParam("token", options.token));
|
|
8978
|
+
process.exit(1);
|
|
8979
|
+
} else if (driver3 === "turso") {
|
|
8980
|
+
let text2 = `Please provide required params for Turso driver:
|
|
8981
|
+
`;
|
|
8982
|
+
console.log(error(text2));
|
|
8983
|
+
console.log(wrapParam("url", options.url));
|
|
8984
|
+
console.log(wrapParam("authToken", options.authToken));
|
|
8985
|
+
return;
|
|
8778
8986
|
} else {
|
|
8779
|
-
|
|
8987
|
+
softAssertUnreachable(driver3);
|
|
8780
8988
|
}
|
|
8781
|
-
|
|
8782
|
-
|
|
8783
|
-
|
|
8784
|
-
|
|
8785
|
-
// src/schemaValidator.ts
|
|
8786
|
-
var dialect3, commonSquashedSchema, commonSchema;
|
|
8787
|
-
var init_schemaValidator = __esm({
|
|
8788
|
-
"src/schemaValidator.ts"() {
|
|
8789
|
-
"use strict";
|
|
8790
|
-
init_lib();
|
|
8791
|
-
init_mysqlSchema();
|
|
8792
|
-
init_pgSchema();
|
|
8793
|
-
init_sqliteSchema();
|
|
8794
|
-
dialect3 = enumType(["postgresql", "mysql", "sqlite"]);
|
|
8795
|
-
commonSquashedSchema = unionType([
|
|
8796
|
-
pgSchemaSquashed,
|
|
8797
|
-
mysqlSchemaSquashed,
|
|
8798
|
-
SQLiteSchemaSquashed
|
|
8799
|
-
]);
|
|
8800
|
-
commonSchema = unionType([
|
|
8801
|
-
pgSchema,
|
|
8802
|
-
mysqlSchema,
|
|
8803
|
-
sqliteSchema
|
|
8804
|
-
]);
|
|
8805
|
-
}
|
|
8806
|
-
});
|
|
8807
|
-
|
|
8808
|
-
// src/cli/validations/common.ts
|
|
8809
|
-
var assertCollisions, sqliteDriver, postgresDriver, mysqlDriver, driver, configCommonSchema, casing, introspectParams, configIntrospectCliSchema, configGenerateSchema, configPushSchema;
|
|
8810
|
-
var init_common = __esm({
|
|
8811
|
-
"src/cli/validations/common.ts"() {
|
|
8812
|
-
"use strict";
|
|
8813
|
-
init_outputs();
|
|
8814
|
-
init_lib();
|
|
8815
|
-
init_schemaValidator();
|
|
8816
|
-
assertCollisions = (options, command, inputWhitelist = []) => {
|
|
8817
|
-
const { config, ...rest } = options;
|
|
8818
|
-
let atLeastOneParam = false;
|
|
8819
|
-
for (const key of Object.keys(rest)) {
|
|
8820
|
-
if (inputWhitelist.includes(key))
|
|
8821
|
-
continue;
|
|
8822
|
-
atLeastOneParam = true;
|
|
8823
|
-
}
|
|
8824
|
-
if (!atLeastOneParam && typeof config !== "undefined") {
|
|
8825
|
-
return "config";
|
|
8826
|
-
}
|
|
8827
|
-
if (typeof config === "undefined" && atLeastOneParam) {
|
|
8828
|
-
return "cli";
|
|
8829
|
-
}
|
|
8830
|
-
if (typeof config === "undefined" && !atLeastOneParam) {
|
|
8831
|
-
return "config";
|
|
8832
|
-
}
|
|
8833
|
-
console.log(outputs.common.ambiguousParams(command));
|
|
8989
|
+
let text = `Please provide required params:
|
|
8990
|
+
`;
|
|
8991
|
+
console.log(error(text));
|
|
8992
|
+
console.log(wrapParam("url", options.url));
|
|
8834
8993
|
process.exit(1);
|
|
8835
8994
|
};
|
|
8836
|
-
sqliteDriver = unionType([
|
|
8837
|
-
literalType("better-sqlite"),
|
|
8838
|
-
literalType("turso"),
|
|
8839
|
-
literalType("libsql"),
|
|
8840
|
-
literalType("d1"),
|
|
8841
|
-
literalType("d1-http"),
|
|
8842
|
-
literalType("expo")
|
|
8843
|
-
]);
|
|
8844
|
-
postgresDriver = literalType("aws-data-api");
|
|
8845
|
-
mysqlDriver = literalType("mysql2");
|
|
8846
|
-
driver = unionType([sqliteDriver, postgresDriver, mysqlDriver]);
|
|
8847
|
-
configCommonSchema = objectType({
|
|
8848
|
-
dialect: dialect3,
|
|
8849
|
-
schema: unionType([stringType(), stringType().array()]).optional(),
|
|
8850
|
-
out: stringType().optional(),
|
|
8851
|
-
breakpoints: booleanType().optional().default(true),
|
|
8852
|
-
driver: driver.optional(),
|
|
8853
|
-
tablesFilter: unionType([stringType(), stringType().array()]).optional(),
|
|
8854
|
-
schemaFilter: unionType([stringType(), stringType().array()]).default(["public"])
|
|
8855
|
-
});
|
|
8856
|
-
casing = unionType([literalType("camel"), literalType("preserve")]).default(
|
|
8857
|
-
"preserve"
|
|
8858
|
-
);
|
|
8859
|
-
introspectParams = objectType({
|
|
8860
|
-
schema: unionType([stringType(), stringType().array()]).optional(),
|
|
8861
|
-
out: stringType().optional().default("./drizzle"),
|
|
8862
|
-
breakpoints: booleanType().default(true),
|
|
8863
|
-
tablesFilter: unionType([stringType(), stringType().array()]).optional(),
|
|
8864
|
-
schemaFilter: unionType([stringType(), stringType().array()]).default(["public"]),
|
|
8865
|
-
introspect: objectType({
|
|
8866
|
-
casing
|
|
8867
|
-
}).default({ casing: "camel" })
|
|
8868
|
-
});
|
|
8869
|
-
configIntrospectCliSchema = objectType({
|
|
8870
|
-
schema: unionType([stringType(), stringType().array()]).optional(),
|
|
8871
|
-
out: stringType().optional().default("./drizzle"),
|
|
8872
|
-
breakpoints: booleanType().default(true),
|
|
8873
|
-
tablesFilter: unionType([stringType(), stringType().array()]).optional(),
|
|
8874
|
-
schemaFilter: unionType([stringType(), stringType().array()]).default(["public"]),
|
|
8875
|
-
introspectCasing: unionType([literalType("camel"), literalType("preserve")]).default(
|
|
8876
|
-
"camel"
|
|
8877
|
-
)
|
|
8878
|
-
});
|
|
8879
|
-
configGenerateSchema = objectType({
|
|
8880
|
-
schema: unionType([stringType(), stringType().array()]),
|
|
8881
|
-
out: stringType().optional().default("./drizzle"),
|
|
8882
|
-
breakpoints: booleanType().default(true)
|
|
8883
|
-
});
|
|
8884
|
-
configPushSchema = objectType({
|
|
8885
|
-
dialect: dialect3,
|
|
8886
|
-
schema: unionType([stringType(), stringType().array()]),
|
|
8887
|
-
tablesFilter: unionType([stringType(), stringType().array()]).optional(),
|
|
8888
|
-
schemaFilter: unionType([stringType(), stringType().array()]).default(["public"]),
|
|
8889
|
-
verbose: booleanType().default(false),
|
|
8890
|
-
strict: booleanType().default(false),
|
|
8891
|
-
out: stringType().optional()
|
|
8892
|
-
});
|
|
8893
8995
|
}
|
|
8894
8996
|
});
|
|
8895
8997
|
|
|
@@ -8915,6 +9017,7 @@ var init_cli = __esm({
|
|
|
8915
9017
|
schema: unionType([stringType(), stringType().array()]).optional(),
|
|
8916
9018
|
tablesFilter: unionType([stringType(), stringType().array()]).optional(),
|
|
8917
9019
|
schemaFilter: unionType([stringType(), stringType().array()]).optional().default(["public"]),
|
|
9020
|
+
extensionsFilters: literalType("postgis").array().optional(),
|
|
8918
9021
|
verbose: booleanType().optional(),
|
|
8919
9022
|
strict: booleanType().optional()
|
|
8920
9023
|
}).passthrough();
|
|
@@ -8924,6 +9027,7 @@ var init_cli = __esm({
|
|
|
8924
9027
|
out: stringType().optional().default("drizzle"),
|
|
8925
9028
|
tablesFilter: unionType([stringType(), stringType().array()]).optional(),
|
|
8926
9029
|
schemaFilter: unionType([stringType(), stringType().array()]).optional().default(["public"]),
|
|
9030
|
+
extensionsFilters: literalType("postgis").array().optional(),
|
|
8927
9031
|
introspectCasing: casing,
|
|
8928
9032
|
breakpoints: booleanType().optional().default(true)
|
|
8929
9033
|
}).passthrough();
|
|
@@ -8949,7 +9053,7 @@ var init_studio = __esm({
|
|
|
8949
9053
|
init_mysql();
|
|
8950
9054
|
init_sqlite();
|
|
8951
9055
|
init_schemaValidator();
|
|
8952
|
-
|
|
9056
|
+
init_postgres();
|
|
8953
9057
|
credentials = intersectionType(
|
|
8954
9058
|
postgresCredentials,
|
|
8955
9059
|
mysqlCredentials,
|
|
@@ -9103,7 +9207,7 @@ var require_common = __commonJS({
|
|
|
9103
9207
|
function setup(env3) {
|
|
9104
9208
|
createDebug.debug = createDebug;
|
|
9105
9209
|
createDebug.default = createDebug;
|
|
9106
|
-
createDebug.coerce =
|
|
9210
|
+
createDebug.coerce = coerce2;
|
|
9107
9211
|
createDebug.disable = disable;
|
|
9108
9212
|
createDebug.enable = enable;
|
|
9109
9213
|
createDebug.enabled = enabled;
|
|
@@ -9244,7 +9348,7 @@ var require_common = __commonJS({
|
|
|
9244
9348
|
function toNamespace(regexp) {
|
|
9245
9349
|
return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, "*");
|
|
9246
9350
|
}
|
|
9247
|
-
function
|
|
9351
|
+
function coerce2(val2) {
|
|
9248
9352
|
if (val2 instanceof Error) {
|
|
9249
9353
|
return val2.stack || val2.message;
|
|
9250
9354
|
}
|
|
@@ -14599,7 +14703,7 @@ var init_utils4 = __esm({
|
|
|
14599
14703
|
import_hanji2 = __toESM(require_hanji());
|
|
14600
14704
|
init_global();
|
|
14601
14705
|
init_mysql();
|
|
14602
|
-
|
|
14706
|
+
init_postgres();
|
|
14603
14707
|
init_sqlite();
|
|
14604
14708
|
init_common();
|
|
14605
14709
|
init_schemaValidator();
|
|
@@ -14733,6 +14837,13 @@ var init_utils4 = __esm({
|
|
|
14733
14837
|
const tablesFilter = tablesFilterConfig ? typeof tablesFilterConfig === "string" ? [tablesFilterConfig] : tablesFilterConfig : [];
|
|
14734
14838
|
const schemasFilterConfig = config.schemaFilter;
|
|
14735
14839
|
const schemasFilter = schemasFilterConfig ? typeof schemasFilterConfig === "string" ? [schemasFilterConfig] : schemasFilterConfig : [];
|
|
14840
|
+
if (config.extensionsFilters) {
|
|
14841
|
+
if (config.extensionsFilters.includes("postgis") && dialect7 === "postgresql") {
|
|
14842
|
+
tablesFilter.push(
|
|
14843
|
+
...["!geography_columns", "!geometry_columns", "!spatial_ref_sys"]
|
|
14844
|
+
);
|
|
14845
|
+
}
|
|
14846
|
+
}
|
|
14736
14847
|
if (dialect7 === "postgresql") {
|
|
14737
14848
|
const parsed = postgresCredentials.safeParse(config);
|
|
14738
14849
|
if (!parsed.success) {
|
|
@@ -14768,7 +14879,7 @@ var init_utils4 = __esm({
|
|
|
14768
14879
|
if (dialect7 === "sqlite") {
|
|
14769
14880
|
const parsed = sqliteCredentials.safeParse(config);
|
|
14770
14881
|
if (!parsed.success) {
|
|
14771
|
-
printConfigConnectionIssues3(config);
|
|
14882
|
+
printConfigConnectionIssues3(config, "pull");
|
|
14772
14883
|
process.exit(1);
|
|
14773
14884
|
}
|
|
14774
14885
|
return {
|
|
@@ -14799,6 +14910,13 @@ var init_utils4 = __esm({
|
|
|
14799
14910
|
}
|
|
14800
14911
|
const tablesFilterConfig = config.tablesFilter;
|
|
14801
14912
|
const tablesFilter = tablesFilterConfig ? typeof tablesFilterConfig === "string" ? [tablesFilterConfig] : tablesFilterConfig : [];
|
|
14913
|
+
if (config.extensionsFilters) {
|
|
14914
|
+
if (config.extensionsFilters.includes("postgis") && dialect7 === "postgresql") {
|
|
14915
|
+
tablesFilter.push(
|
|
14916
|
+
...["!geography_columns", "!geometry_columns", "!spatial_ref_sys"]
|
|
14917
|
+
);
|
|
14918
|
+
}
|
|
14919
|
+
}
|
|
14802
14920
|
const schemasFilterConfig = config.schemaFilter;
|
|
14803
14921
|
const schemasFilter = schemasFilterConfig ? typeof schemasFilterConfig === "string" ? [schemasFilterConfig] : schemasFilterConfig : [];
|
|
14804
14922
|
if (dialect7 === "postgresql") {
|
|
@@ -14836,7 +14954,7 @@ var init_utils4 = __esm({
|
|
|
14836
14954
|
if (dialect7 === "sqlite") {
|
|
14837
14955
|
const parsed = sqliteCredentials.safeParse(config);
|
|
14838
14956
|
if (!parsed.success) {
|
|
14839
|
-
printConfigConnectionIssues3(config);
|
|
14957
|
+
printConfigConnectionIssues3(config, "pull");
|
|
14840
14958
|
process.exit(1);
|
|
14841
14959
|
}
|
|
14842
14960
|
return {
|
|
@@ -14901,7 +15019,7 @@ var init_utils4 = __esm({
|
|
|
14901
15019
|
if (dialect7 === "sqlite") {
|
|
14902
15020
|
const parsed = sqliteCredentials.safeParse(flattened);
|
|
14903
15021
|
if (!parsed.success) {
|
|
14904
|
-
printConfigConnectionIssues3(flattened);
|
|
15022
|
+
printConfigConnectionIssues3(flattened, "studio");
|
|
14905
15023
|
process.exit(1);
|
|
14906
15024
|
}
|
|
14907
15025
|
const credentials2 = parsed.data;
|
|
@@ -14976,7 +15094,7 @@ var init_utils4 = __esm({
|
|
|
14976
15094
|
if (dialect7 === "sqlite") {
|
|
14977
15095
|
const parsed = sqliteCredentials.safeParse(flattened);
|
|
14978
15096
|
if (!parsed.success) {
|
|
14979
|
-
printConfigConnectionIssues3(flattened);
|
|
15097
|
+
printConfigConnectionIssues3(flattened, "migrate");
|
|
14980
15098
|
process.exit(1);
|
|
14981
15099
|
}
|
|
14982
15100
|
const credentials2 = parsed.data;
|
|
@@ -15037,8 +15155,9 @@ var init_utils4 = __esm({
|
|
|
15037
15155
|
unregister();
|
|
15038
15156
|
const res = configCommonSchema.safeParse(content);
|
|
15039
15157
|
if (!res.success) {
|
|
15040
|
-
|
|
15041
|
-
|
|
15158
|
+
if (!("dialect" in content)) {
|
|
15159
|
+
console.log(error("Please specify 'dialect' param"));
|
|
15160
|
+
}
|
|
15042
15161
|
process.exit(1);
|
|
15043
15162
|
}
|
|
15044
15163
|
return res.data;
|
|
@@ -15300,7 +15419,7 @@ The unique constraint ${source_default.underline.blue(
|
|
|
15300
15419
|
const name = value.config.name;
|
|
15301
15420
|
let indexColumns = columns2.map((it) => {
|
|
15302
15421
|
if ((0, import_drizzle_orm2.is)(it, import_drizzle_orm3.SQL)) {
|
|
15303
|
-
return dialect4.sqlToQuery(it).sql;
|
|
15422
|
+
return dialect4.sqlToQuery(it, "indexes").sql;
|
|
15304
15423
|
} else {
|
|
15305
15424
|
return it.name;
|
|
15306
15425
|
}
|
|
@@ -16275,7 +16394,7 @@ ${withStyle.errorWarning(
|
|
|
16275
16394
|
name: columnName,
|
|
16276
16395
|
type: (
|
|
16277
16396
|
// filter vectors, but in future we should filter any extension that was installed by user
|
|
16278
|
-
columnAdditionalDT === "USER-DEFINED" &&
|
|
16397
|
+
columnAdditionalDT === "USER-DEFINED" && !["vector", "geometry"].includes(enumType3) ? enumType3 : columnTypeMapped
|
|
16279
16398
|
),
|
|
16280
16399
|
typeSchema: enumsToReturn[`${tableSchema}.${enumType3}`] !== void 0 ? enumsToReturn[`${tableSchema}.${enumType3}`].schema : void 0,
|
|
16281
16400
|
primaryKey: primaryKey.length === 1 && cprimaryKey.length < 2,
|
|
@@ -16675,7 +16794,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
|
16675
16794
|
const name = value.config.name;
|
|
16676
16795
|
let indexColumns = columns2.map((it) => {
|
|
16677
16796
|
if ((0, import_drizzle_orm7.is)(it, import_drizzle_orm7.SQL)) {
|
|
16678
|
-
return dialect6.sqlToQuery(it).sql;
|
|
16797
|
+
return dialect6.sqlToQuery(it, "indexes").sql;
|
|
16679
16798
|
} else {
|
|
16680
16799
|
return it.name;
|
|
16681
16800
|
}
|
|
@@ -24912,14 +25031,14 @@ var require_to_regex_range = __commonJS({
|
|
|
24912
25031
|
}
|
|
24913
25032
|
return tokens;
|
|
24914
25033
|
}
|
|
24915
|
-
function filterPatterns(arr, comparison, prefix,
|
|
25034
|
+
function filterPatterns(arr, comparison, prefix, intersection, options) {
|
|
24916
25035
|
let result = [];
|
|
24917
25036
|
for (let ele of arr) {
|
|
24918
25037
|
let { string } = ele;
|
|
24919
|
-
if (!
|
|
25038
|
+
if (!intersection && !contains(comparison, "string", string)) {
|
|
24920
25039
|
result.push(prefix + string);
|
|
24921
25040
|
}
|
|
24922
|
-
if (
|
|
25041
|
+
if (intersection && contains(comparison, "string", string)) {
|
|
24923
25042
|
result.push(prefix + string);
|
|
24924
25043
|
}
|
|
24925
25044
|
}
|
|
@@ -111918,11 +112037,11 @@ var init_connections = __esm({
|
|
|
111918
112037
|
);
|
|
111919
112038
|
process.exit(1);
|
|
111920
112039
|
};
|
|
111921
|
-
prepareSqliteParams = (params,
|
|
112040
|
+
prepareSqliteParams = (params, driver3) => {
|
|
111922
112041
|
return params.map((param) => {
|
|
111923
112042
|
if (param && typeof param === "object" && "type" in param && "value" in param && param.type === "binary") {
|
|
111924
112043
|
const value = typeof param.value === "object" ? JSON.stringify(param.value) : param.value;
|
|
111925
|
-
if (
|
|
112044
|
+
if (driver3 === "d1-http") {
|
|
111926
112045
|
return value;
|
|
111927
112046
|
}
|
|
111928
112047
|
return Buffer.from(value);
|
|
@@ -111932,8 +112051,8 @@ var init_connections = __esm({
|
|
|
111932
112051
|
};
|
|
111933
112052
|
connectToSQLite = async (credentials2) => {
|
|
111934
112053
|
if ("driver" in credentials2) {
|
|
111935
|
-
const { driver:
|
|
111936
|
-
if (
|
|
112054
|
+
const { driver: driver3 } = credentials2;
|
|
112055
|
+
if (driver3 === "turso") {
|
|
111937
112056
|
assertPackages("@libsql/client");
|
|
111938
112057
|
const { createClient: createClient2 } = await import("@libsql/client");
|
|
111939
112058
|
const { drizzle } = await import("drizzle-orm/libsql");
|
|
@@ -111970,12 +112089,12 @@ var init_connections = __esm({
|
|
|
111970
112089
|
}
|
|
111971
112090
|
};
|
|
111972
112091
|
return { ...db2, ...proxy, migrate: migrateFn };
|
|
111973
|
-
} else if (
|
|
112092
|
+
} else if (driver3 === "d1-http") {
|
|
111974
112093
|
const { drizzle } = await import("drizzle-orm/sqlite-proxy");
|
|
111975
112094
|
const { migrate } = await import("drizzle-orm/sqlite-proxy/migrator");
|
|
111976
112095
|
const remoteCallback = async (sql2, params, method) => {
|
|
111977
112096
|
const res = await fetch2(
|
|
111978
|
-
`https://api.cloudflare.com/client/v4/accounts/${credentials2.accountId}/d1/database/${credentials2.databaseId}
|
|
112097
|
+
`https://api.cloudflare.com/client/v4/accounts/${credentials2.accountId}/d1/database/${credentials2.databaseId}/${method === "values" ? "raw" : "query"}`,
|
|
111979
112098
|
{
|
|
111980
112099
|
method: "POST",
|
|
111981
112100
|
body: JSON.stringify({ sql: sql2, params }),
|
|
@@ -111991,9 +112110,10 @@ var init_connections = __esm({
|
|
|
111991
112110
|
data.errors.map((it) => `${it.code}: ${it.message}`).join("\n")
|
|
111992
112111
|
);
|
|
111993
112112
|
}
|
|
111994
|
-
const
|
|
112113
|
+
const result = data.result[0].results;
|
|
112114
|
+
const rows = Array.isArray(result) ? result : result.rows;
|
|
111995
112115
|
return {
|
|
111996
|
-
rows
|
|
112116
|
+
rows
|
|
111997
112117
|
};
|
|
111998
112118
|
};
|
|
111999
112119
|
const drzl = drizzle(remoteCallback);
|
|
@@ -112030,7 +112150,7 @@ var init_connections = __esm({
|
|
|
112030
112150
|
};
|
|
112031
112151
|
return { ...db2, ...proxy, migrate: migrateFn };
|
|
112032
112152
|
} else {
|
|
112033
|
-
assertUnreachable(
|
|
112153
|
+
assertUnreachable(driver3);
|
|
112034
112154
|
}
|
|
112035
112155
|
}
|
|
112036
112156
|
if (await checkPackage("@libsql/client")) {
|
|
@@ -115560,7 +115680,10 @@ var init_introspect_pg = __esm({
|
|
|
115560
115680
|
"bigint",
|
|
115561
115681
|
"doublePrecision",
|
|
115562
115682
|
"uuid",
|
|
115563
|
-
"vector"
|
|
115683
|
+
"vector",
|
|
115684
|
+
"point",
|
|
115685
|
+
"line",
|
|
115686
|
+
"geometry"
|
|
115564
115687
|
]);
|
|
115565
115688
|
objToStatement23 = (json) => {
|
|
115566
115689
|
json = Object.fromEntries(Object.entries(json).filter((it) => it[1]));
|
|
@@ -115698,6 +115821,7 @@ var init_introspect_pg = __esm({
|
|
|
115698
115821
|
patched = patched.startsWith("time(") ? "time" : patched;
|
|
115699
115822
|
patched = patched.startsWith("timestamp(") ? "timestamp" : patched;
|
|
115700
115823
|
patched = patched.startsWith("vector(") ? "vector" : patched;
|
|
115824
|
+
patched = patched.startsWith("geometry(") ? "geometry" : patched;
|
|
115701
115825
|
return patched;
|
|
115702
115826
|
}).filter((type) => {
|
|
115703
115827
|
return pgImportsList.has(type);
|
|
@@ -115948,6 +116072,41 @@ var init_introspect_pg = __esm({
|
|
|
115948
116072
|
out += typeof defaultValue !== "undefined" ? `.default(${defaultValue})` : "";
|
|
115949
116073
|
return out;
|
|
115950
116074
|
}
|
|
116075
|
+
if (lowered.startsWith("point")) {
|
|
116076
|
+
let out = `${withCasing2(name, casing2)}: point("${name}")`;
|
|
116077
|
+
out += typeof defaultValue !== "undefined" ? `.default(${defaultValue})` : "";
|
|
116078
|
+
return out;
|
|
116079
|
+
}
|
|
116080
|
+
if (lowered.startsWith("line")) {
|
|
116081
|
+
let out = `${withCasing2(name, casing2)}: point("${name}")`;
|
|
116082
|
+
out += typeof defaultValue !== "undefined" ? `.default(${defaultValue})` : "";
|
|
116083
|
+
return out;
|
|
116084
|
+
}
|
|
116085
|
+
if (lowered.startsWith("geometry")) {
|
|
116086
|
+
let out = "";
|
|
116087
|
+
let isGeoUnknown = false;
|
|
116088
|
+
if (lowered.length !== 8) {
|
|
116089
|
+
const geometryOptions = lowered.slice(9, -1).split(",");
|
|
116090
|
+
if (geometryOptions.length === 1 && geometryOptions[0] !== "") {
|
|
116091
|
+
out = `${withCasing2(name, casing2)}: geometry("${name}", { type: "${geometryOptions[0]}" })`;
|
|
116092
|
+
} else if (geometryOptions.length === 2) {
|
|
116093
|
+
out = `${withCasing2(name, casing2)}: geometry("${name}", { type: "${geometryOptions[0]}", srid: ${geometryOptions[1]} })`;
|
|
116094
|
+
} else {
|
|
116095
|
+
isGeoUnknown = true;
|
|
116096
|
+
}
|
|
116097
|
+
} else {
|
|
116098
|
+
out = `${withCasing2(name, casing2)}: geometry("${name}")`;
|
|
116099
|
+
}
|
|
116100
|
+
out += typeof defaultValue !== "undefined" ? `.default(${defaultValue})` : "";
|
|
116101
|
+
if (isGeoUnknown) {
|
|
116102
|
+
let unknown2 = `// TODO: failed to parse geometry type because found more than 2 options inside geometry function '${type}'
|
|
116103
|
+
// Introspect is currently supporting only type and srid options
|
|
116104
|
+
`;
|
|
116105
|
+
unknown2 += ` ${withCasing2(name, casing2)}: unknown("${name}")`;
|
|
116106
|
+
return unknown2;
|
|
116107
|
+
}
|
|
116108
|
+
return out;
|
|
116109
|
+
}
|
|
115951
116110
|
if (lowered.startsWith("vector")) {
|
|
115952
116111
|
const split = lowered.split(" ");
|
|
115953
116112
|
let out;
|
|
@@ -116564,10 +116723,19 @@ var init_introspect = __esm({
|
|
|
116564
116723
|
const filter2 = (tableName) => {
|
|
116565
116724
|
if (matchers.length === 0)
|
|
116566
116725
|
return true;
|
|
116567
|
-
|
|
116568
|
-
|
|
116569
|
-
if (matcher.
|
|
116570
|
-
|
|
116726
|
+
let flags = [];
|
|
116727
|
+
for (let matcher of matchers) {
|
|
116728
|
+
if (matcher.negate) {
|
|
116729
|
+
if (!matcher.match(tableName)) {
|
|
116730
|
+
flags.push(false);
|
|
116731
|
+
}
|
|
116732
|
+
}
|
|
116733
|
+
if (matcher.match(tableName)) {
|
|
116734
|
+
flags.push(true);
|
|
116735
|
+
}
|
|
116736
|
+
}
|
|
116737
|
+
if (flags.length > 0) {
|
|
116738
|
+
return flags.every(Boolean);
|
|
116571
116739
|
}
|
|
116572
116740
|
return false;
|
|
116573
116741
|
};
|
|
@@ -116638,10 +116806,19 @@ var init_introspect = __esm({
|
|
|
116638
116806
|
const filter2 = (tableName) => {
|
|
116639
116807
|
if (matchers.length === 0)
|
|
116640
116808
|
return true;
|
|
116641
|
-
|
|
116642
|
-
|
|
116643
|
-
if (matcher.
|
|
116644
|
-
|
|
116809
|
+
let flags = [];
|
|
116810
|
+
for (let matcher of matchers) {
|
|
116811
|
+
if (matcher.negate) {
|
|
116812
|
+
if (!matcher.match(tableName)) {
|
|
116813
|
+
flags.push(false);
|
|
116814
|
+
}
|
|
116815
|
+
}
|
|
116816
|
+
if (matcher.match(tableName)) {
|
|
116817
|
+
flags.push(true);
|
|
116818
|
+
}
|
|
116819
|
+
}
|
|
116820
|
+
if (flags.length > 0) {
|
|
116821
|
+
return flags.every(Boolean);
|
|
116645
116822
|
}
|
|
116646
116823
|
return false;
|
|
116647
116824
|
};
|
|
@@ -116710,10 +116887,19 @@ var init_introspect = __esm({
|
|
|
116710
116887
|
const filter2 = (tableName) => {
|
|
116711
116888
|
if (matchers.length === 0)
|
|
116712
116889
|
return true;
|
|
116713
|
-
|
|
116714
|
-
|
|
116715
|
-
if (matcher.
|
|
116716
|
-
|
|
116890
|
+
let flags = [];
|
|
116891
|
+
for (let matcher of matchers) {
|
|
116892
|
+
if (matcher.negate) {
|
|
116893
|
+
if (!matcher.match(tableName)) {
|
|
116894
|
+
flags.push(false);
|
|
116895
|
+
}
|
|
116896
|
+
}
|
|
116897
|
+
if (matcher.match(tableName)) {
|
|
116898
|
+
flags.push(true);
|
|
116899
|
+
}
|
|
116900
|
+
}
|
|
116901
|
+
if (flags.length > 0) {
|
|
116902
|
+
return flags.every(Boolean);
|
|
116717
116903
|
}
|
|
116718
116904
|
return false;
|
|
116719
116905
|
};
|
|
@@ -120265,13 +120451,13 @@ var init_studio2 = __esm({
|
|
|
120265
120451
|
const customDefaults = getCustomDefaults(sqliteSchema2);
|
|
120266
120452
|
let dbUrl;
|
|
120267
120453
|
if ("driver" in credentials2) {
|
|
120268
|
-
const { driver:
|
|
120269
|
-
if (
|
|
120454
|
+
const { driver: driver3 } = credentials2;
|
|
120455
|
+
if (driver3 === "d1-http") {
|
|
120270
120456
|
dbUrl = `d1-http://${credentials2.accountId}/${credentials2.databaseId}/${credentials2.token}`;
|
|
120271
|
-
} else if (
|
|
120457
|
+
} else if (driver3 === "turso") {
|
|
120272
120458
|
dbUrl = `turso://${credentials2.url}/${credentials2.authToken}`;
|
|
120273
120459
|
} else {
|
|
120274
|
-
assertUnreachable(
|
|
120460
|
+
assertUnreachable(driver3);
|
|
120275
120461
|
}
|
|
120276
120462
|
} else {
|
|
120277
120463
|
dbUrl = credentials2.url;
|
|
@@ -120383,7 +120569,7 @@ var init_studio2 = __esm({
|
|
|
120383
120569
|
};
|
|
120384
120570
|
prepareServer = async ({
|
|
120385
120571
|
dialect: dialect7,
|
|
120386
|
-
driver:
|
|
120572
|
+
driver: driver3,
|
|
120387
120573
|
proxy,
|
|
120388
120574
|
customDefaults,
|
|
120389
120575
|
schema: drizzleSchema,
|
|
@@ -120433,7 +120619,7 @@ var init_studio2 = __esm({
|
|
|
120433
120619
|
return c.json({
|
|
120434
120620
|
version: "6",
|
|
120435
120621
|
dialect: dialect7,
|
|
120436
|
-
driver:
|
|
120622
|
+
driver: driver3,
|
|
120437
120623
|
schemaFiles,
|
|
120438
120624
|
customDefaults: preparedDefaults,
|
|
120439
120625
|
relations: extractRelations(relationsConfig),
|
|
@@ -121970,7 +122156,7 @@ var upCommand = new import_commander.Command("up").option("--config <config>", `
|
|
|
121970
122156
|
var pullCommand = new import_commander.Command("introspect").option("--config <config>", `Config path [default=drizzle.config.ts]`).option("--out <out>", `Migrations folder`).option("--dialect <dialect>", "Database dialect").option("--breakpoints", `Prepare SQL statements with breakpoints`).option(
|
|
121971
122157
|
"--introspect-casing <introspectCasing>",
|
|
121972
122158
|
"Column object keys naming strategy"
|
|
121973
|
-
).option("--tablesFilter", `Table name filters`).option("--schemaFilter", `Schema name filters`).option("--url <url>", "Database connection URL").option("--host <host>", "Database host").option("--port <port>", "Database port").option("--user <user>", "Database user").option("--password <password>", "Database password").option("--database <database>", "Database database name").option("--ssl <ssl>", "Database ssl").option("--auth-token <authToken>", "Database auth token [Turso]").option("--driver <driver>", "Driver used for querying the database").action(async (options) => {
|
|
122159
|
+
).option("--tablesFilter", `Table name filters`).option("--extensionsFilters", `Table name filters`).option("--schemaFilter", `Schema name filters`).option("--url <url>", "Database connection URL").option("--host <host>", "Database host").option("--port <port>", "Database port").option("--user <user>", "Database user").option("--password <password>", "Database password").option("--database <database>", "Database database name").option("--ssl <ssl>", "Database ssl").option("--auth-token <authToken>", "Database auth token [Turso]").option("--driver <driver>", "Driver used for querying the database").action(async (options) => {
|
|
121974
122160
|
await printVersions();
|
|
121975
122161
|
await assertPackages("drizzle-orm");
|
|
121976
122162
|
await assertOrmCoreVersion();
|