drizzle-kit 0.20.7-72b0933 → 0.20.7-8d149c2
Sign up to get free protection for your applications and to get access to all the features.
- package/bin.cjs +208 -131
- package/cli/commands/migrate.d.ts +11 -1
- package/cli/commands/utils.d.ts +9 -0
- package/cli/validations/mysql.d.ts +6 -6
- package/cli/validations/pg.d.ts +12 -12
- package/index.d.mts +2 -0
- package/index.d.ts +2 -0
- package/package.json +1 -1
- package/utils.js +98 -49
package/bin.cjs
CHANGED
@@ -11261,7 +11261,7 @@ var require_node2 = __commonJS({
|
|
11261
11261
|
});
|
11262
11262
|
|
11263
11263
|
// src/cli/commands/utils.ts
|
11264
|
-
var import_path, import_fs, import_hanji2, assertES5, safeRegister, prepareGenerateConfig, assertOutFolder, configCommonSchema, introspectCasing, configIntrospectSchema, configIntrospectCliSchema, configGenerateSchema, configPushSchema, mysqlConnectionSchema, mySqlCliConfigSchema, mySqlIntrospectConfigSchema, drizzleConfigFromFile, readDrizzleConfig;
|
11264
|
+
var import_path, import_fs, import_hanji2, assertES5, safeRegister, prepareGenerateConfig, assertOutFolder, driver, configCommonSchema, introspectCasing, configIntrospectSchema, configIntrospectCliSchema, configGenerateSchema, configPushSchema, mysqlConnectionSchema, mySqlCliConfigSchema, mySqlIntrospectConfigSchema, drizzleConfigFromFile, readDrizzleConfig;
|
11265
11265
|
var init_utils = __esm({
|
11266
11266
|
"src/cli/commands/utils.ts"() {
|
11267
11267
|
init_serializer();
|
@@ -11324,7 +11324,8 @@ var init_utils = __esm({
|
|
11324
11324
|
custom,
|
11325
11325
|
breakpoints: drizzleConfig.breakpoints ?? false,
|
11326
11326
|
schema: drizzleConfig.schema,
|
11327
|
-
out: drizzleConfig.out
|
11327
|
+
out: drizzleConfig.out,
|
11328
|
+
bundle: drizzleConfig.driver === "expo"
|
11328
11329
|
};
|
11329
11330
|
}
|
11330
11331
|
if (!schema4) {
|
@@ -11340,7 +11341,7 @@ var init_utils = __esm({
|
|
11340
11341
|
console.error(`'out' param must be set`);
|
11341
11342
|
process.exit(1);
|
11342
11343
|
}
|
11343
|
-
return { schema: schema4, out, breakpoints, custom };
|
11344
|
+
return { schema: schema4, out, breakpoints, custom, bundle: false };
|
11344
11345
|
};
|
11345
11346
|
assertOutFolder = async (it) => {
|
11346
11347
|
if ("out" in it)
|
@@ -11356,10 +11357,20 @@ var init_utils = __esm({
|
|
11356
11357
|
}
|
11357
11358
|
return cliConfig.out;
|
11358
11359
|
};
|
11360
|
+
driver = unionType([
|
11361
|
+
literalType("better-sqlite"),
|
11362
|
+
literalType("turso"),
|
11363
|
+
literalType("libsql"),
|
11364
|
+
literalType("d1"),
|
11365
|
+
literalType("expo"),
|
11366
|
+
literalType("pg"),
|
11367
|
+
literalType("mysql2")
|
11368
|
+
]);
|
11359
11369
|
configCommonSchema = objectType({
|
11360
11370
|
schema: unionType([stringType(), stringType().array()]),
|
11361
11371
|
out: stringType().optional(),
|
11362
11372
|
breakpoints: booleanType().default(true),
|
11373
|
+
driver: driver.optional(),
|
11363
11374
|
tablesFilter: unionType([stringType(), stringType().array()]).optional(),
|
11364
11375
|
schemaFilter: unionType([stringType(), stringType().array()]).default(["public"])
|
11365
11376
|
});
|
@@ -11566,9 +11577,9 @@ var init_outputs = __esm({
|
|
11566
11577
|
driver: () => withStyle.error(
|
11567
11578
|
`Either "turso", "libsql", "better-sqlite" are available options for "--driver"`
|
11568
11579
|
),
|
11569
|
-
url: (
|
11570
|
-
authToken: (
|
11571
|
-
`"authToken" is a required option for driver "${
|
11580
|
+
url: (driver2) => withStyle.error(`"url" is a required option for driver "${driver2}". You can read more about drizzle.config: https://orm.drizzle.team/kit-docs/config-reference`),
|
11581
|
+
authToken: (driver2) => withStyle.error(
|
11582
|
+
`"authToken" is a required option for driver "${driver2}". You can read more about drizzle.config: https://orm.drizzle.team/kit-docs/config-reference`
|
11572
11583
|
)
|
11573
11584
|
},
|
11574
11585
|
introspect: {},
|
@@ -12180,6 +12191,7 @@ var init_pgSerializer = __esm({
|
|
12180
12191
|
};
|
12181
12192
|
generatePgSnapshot = (tables, enums, schemas, schemaFilter) => {
|
12182
12193
|
const result = {};
|
12194
|
+
const indexesInSchema = {};
|
12183
12195
|
for (const table4 of tables) {
|
12184
12196
|
const {
|
12185
12197
|
name: tableName,
|
@@ -12331,6 +12343,24 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
12331
12343
|
return it.name;
|
12332
12344
|
}
|
12333
12345
|
});
|
12346
|
+
if (typeof indexesInSchema[schema4 ?? "public"] !== "undefined") {
|
12347
|
+
if (indexesInSchema[schema4 ?? "public"].includes(name)) {
|
12348
|
+
console.log(
|
12349
|
+
`
|
12350
|
+
${withStyle.errorWarning(
|
12351
|
+
`We've found duplicated index name across ${source_default.underline.blue(
|
12352
|
+
schema4 ?? "public"
|
12353
|
+
)} schema. Please rename your index in either the ${source_default.underline.blue(
|
12354
|
+
tableName
|
12355
|
+
)} table or the table with the duplicated index name`
|
12356
|
+
)}`
|
12357
|
+
);
|
12358
|
+
process.exit(1);
|
12359
|
+
}
|
12360
|
+
indexesInSchema[schema4 ?? "public"].push(name);
|
12361
|
+
} else {
|
12362
|
+
indexesInSchema[schema4 ?? "public"] = [name];
|
12363
|
+
}
|
12334
12364
|
indexesObject[name] = {
|
12335
12365
|
name,
|
12336
12366
|
columns: indexColumns,
|
@@ -14885,6 +14915,7 @@ var init_words = __esm({
|
|
14885
14915
|
var migrate_exports = {};
|
14886
14916
|
__export(migrate_exports, {
|
14887
14917
|
BREAKPOINT: () => BREAKPOINT,
|
14918
|
+
embeddedMigrations: () => embeddedMigrations,
|
14888
14919
|
prepareAndMigrateMySql: () => prepareAndMigrateMySql,
|
14889
14920
|
prepareAndMigratePg: () => prepareAndMigratePg,
|
14890
14921
|
prepareAndMigrateSqlite: () => prepareAndMigrateSqlite,
|
@@ -14895,7 +14926,7 @@ __export(migrate_exports, {
|
|
14895
14926
|
prepareSnapshotFolderName: () => prepareSnapshotFolderName,
|
14896
14927
|
writeResult: () => writeResult
|
14897
14928
|
});
|
14898
|
-
var import_fs4, import_path3, import_hanji3, prepareAndMigratePg, prepareMySQLPush, prepareSQLitePush, preparePgPush, prepareAndMigrateMySql, prepareAndMigrateSqlite, prepareSQL, promptColumnsConflicts, promptTablesConflict, promptSchemasConflict, BREAKPOINT, writeResult, prepareSnapshotFolderName, two;
|
14929
|
+
var import_fs4, import_path3, import_hanji3, prepareAndMigratePg, prepareMySQLPush, prepareSQLitePush, preparePgPush, prepareAndMigrateMySql, prepareAndMigrateSqlite, prepareSQL, promptColumnsConflicts, promptTablesConflict, promptSchemasConflict, BREAKPOINT, writeResult, embeddedMigrations, prepareSnapshotFolderName, two;
|
14899
14930
|
var init_migrate = __esm({
|
14900
14931
|
"src/cli/commands/migrate.ts"() {
|
14901
14932
|
import_fs4 = __toESM(require("fs"));
|
@@ -14924,19 +14955,14 @@ var init_migrate = __esm({
|
|
14924
14955
|
const validatedPrev = pgSchema.parse(prev);
|
14925
14956
|
const validatedCur = pgSchema.parse(cur);
|
14926
14957
|
if (config.custom) {
|
14927
|
-
writeResult(
|
14928
|
-
custom,
|
14929
|
-
[],
|
14958
|
+
writeResult({
|
14959
|
+
cur: custom,
|
14960
|
+
sqlStatements: [],
|
14930
14961
|
journal,
|
14931
|
-
{
|
14932
|
-
columns: {},
|
14933
|
-
schemas: {},
|
14934
|
-
tables: {}
|
14935
|
-
},
|
14936
14962
|
outFolder,
|
14937
|
-
config.breakpoints,
|
14938
|
-
"custom"
|
14939
|
-
);
|
14963
|
+
breakpoints: config.breakpoints,
|
14964
|
+
type: "custom"
|
14965
|
+
});
|
14940
14966
|
return;
|
14941
14967
|
}
|
14942
14968
|
const squashedPrev = squashPgScheme(validatedPrev);
|
@@ -14948,14 +14974,13 @@ var init_migrate = __esm({
|
|
14948
14974
|
validatedPrev,
|
14949
14975
|
validatedCur
|
14950
14976
|
);
|
14951
|
-
writeResult(
|
14977
|
+
writeResult({
|
14952
14978
|
cur,
|
14953
14979
|
sqlStatements,
|
14954
14980
|
journal,
|
14955
|
-
_meta,
|
14956
14981
|
outFolder,
|
14957
|
-
config.breakpoints
|
14958
|
-
);
|
14982
|
+
breakpoints: config.breakpoints
|
14983
|
+
});
|
14959
14984
|
} catch (e) {
|
14960
14985
|
console.error(e);
|
14961
14986
|
}
|
@@ -15049,19 +15074,14 @@ var init_migrate = __esm({
|
|
15049
15074
|
const validatedPrev = mysqlSchema.parse(prev);
|
15050
15075
|
const validatedCur = mysqlSchema.parse(cur);
|
15051
15076
|
if (config.custom) {
|
15052
|
-
writeResult(
|
15053
|
-
custom,
|
15054
|
-
[],
|
15077
|
+
writeResult({
|
15078
|
+
cur: custom,
|
15079
|
+
sqlStatements: [],
|
15055
15080
|
journal,
|
15056
|
-
{
|
15057
|
-
columns: {},
|
15058
|
-
schemas: {},
|
15059
|
-
tables: {}
|
15060
|
-
},
|
15061
15081
|
outFolder,
|
15062
|
-
config.breakpoints,
|
15063
|
-
"custom"
|
15064
|
-
);
|
15082
|
+
breakpoints: config.breakpoints,
|
15083
|
+
type: "custom"
|
15084
|
+
});
|
15065
15085
|
return;
|
15066
15086
|
}
|
15067
15087
|
const squashedPrev = squashMysqlScheme(validatedPrev);
|
@@ -15073,14 +15093,14 @@ var init_migrate = __esm({
|
|
15073
15093
|
validatedPrev,
|
15074
15094
|
validatedCur
|
15075
15095
|
);
|
15076
|
-
writeResult(
|
15096
|
+
writeResult({
|
15077
15097
|
cur,
|
15078
15098
|
sqlStatements,
|
15079
15099
|
journal,
|
15080
15100
|
_meta,
|
15081
15101
|
outFolder,
|
15082
|
-
config.breakpoints
|
15083
|
-
);
|
15102
|
+
breakpoints: config.breakpoints
|
15103
|
+
});
|
15084
15104
|
} catch (e) {
|
15085
15105
|
console.error(e);
|
15086
15106
|
}
|
@@ -15098,19 +15118,15 @@ var init_migrate = __esm({
|
|
15098
15118
|
const validatedPrev = sqliteSchema.parse(prev);
|
15099
15119
|
const validatedCur = sqliteSchema.parse(cur);
|
15100
15120
|
if (config.custom) {
|
15101
|
-
writeResult(
|
15102
|
-
custom,
|
15103
|
-
[],
|
15121
|
+
writeResult({
|
15122
|
+
cur: custom,
|
15123
|
+
sqlStatements: [],
|
15104
15124
|
journal,
|
15105
|
-
{
|
15106
|
-
columns: {},
|
15107
|
-
schemas: {},
|
15108
|
-
tables: {}
|
15109
|
-
},
|
15110
15125
|
outFolder,
|
15111
|
-
config.breakpoints,
|
15112
|
-
|
15113
|
-
|
15126
|
+
breakpoints: config.breakpoints,
|
15127
|
+
bundle: config.bundle,
|
15128
|
+
type: "custom"
|
15129
|
+
});
|
15114
15130
|
return;
|
15115
15131
|
}
|
15116
15132
|
const squashedPrev = squashSqliteScheme(validatedPrev);
|
@@ -15120,14 +15136,15 @@ var init_migrate = __esm({
|
|
15120
15136
|
squashedCur,
|
15121
15137
|
"sqlite"
|
15122
15138
|
);
|
15123
|
-
writeResult(
|
15139
|
+
writeResult({
|
15124
15140
|
cur,
|
15125
15141
|
sqlStatements,
|
15126
15142
|
journal,
|
15127
15143
|
_meta,
|
15128
15144
|
outFolder,
|
15129
|
-
config.breakpoints
|
15130
|
-
|
15145
|
+
breakpoints: config.breakpoints,
|
15146
|
+
bundle: config.bundle
|
15147
|
+
});
|
15131
15148
|
} catch (e) {
|
15132
15149
|
console.error(e);
|
15133
15150
|
}
|
@@ -15315,7 +15332,20 @@ var init_migrate = __esm({
|
|
15315
15332
|
return result;
|
15316
15333
|
};
|
15317
15334
|
BREAKPOINT = "--> statement-breakpoint\n";
|
15318
|
-
writeResult = (
|
15335
|
+
writeResult = ({
|
15336
|
+
cur,
|
15337
|
+
sqlStatements,
|
15338
|
+
journal,
|
15339
|
+
_meta = {
|
15340
|
+
columns: {},
|
15341
|
+
schemas: {},
|
15342
|
+
tables: {}
|
15343
|
+
},
|
15344
|
+
outFolder,
|
15345
|
+
breakpoints,
|
15346
|
+
bundle = false,
|
15347
|
+
type = "none"
|
15348
|
+
}) => {
|
15319
15349
|
if (type === "none") {
|
15320
15350
|
console.log(schema(cur));
|
15321
15351
|
if (sqlStatements.length === 0) {
|
@@ -15356,6 +15386,10 @@ ${sql2}
|
|
15356
15386
|
});
|
15357
15387
|
import_fs4.default.writeFileSync(metaJournal, JSON.stringify(journal, null, 2));
|
15358
15388
|
import_fs4.default.writeFileSync(`${outFolder}/${tag}.sql`, sql2);
|
15389
|
+
if (bundle) {
|
15390
|
+
const js = embeddedMigrations(journal);
|
15391
|
+
import_fs4.default.writeFileSync(`${outFolder}/migrations.js`, js);
|
15392
|
+
}
|
15359
15393
|
(0, import_hanji3.render)(
|
15360
15394
|
`[${source_default.green(
|
15361
15395
|
"\u2713"
|
@@ -15364,6 +15398,22 @@ ${sql2}
|
|
15364
15398
|
)} \u{1F680}`
|
15365
15399
|
);
|
15366
15400
|
};
|
15401
|
+
embeddedMigrations = (journal) => {
|
15402
|
+
let content = "import journal from './meta/_journal.json';\n";
|
15403
|
+
journal.entries.forEach((entry) => {
|
15404
|
+
content += `import m${entry.idx.toString().padStart(4, "0")} from './${entry.tag}.sql';
|
15405
|
+
`;
|
15406
|
+
});
|
15407
|
+
content += `
|
15408
|
+
export default {
|
15409
|
+
journal,
|
15410
|
+
migrations: {
|
15411
|
+
${journal.entries.map((it) => `m${it.idx.toString().padStart(4, "0")}`).join(",\n")}
|
15412
|
+
}
|
15413
|
+
}
|
15414
|
+
`;
|
15415
|
+
return content;
|
15416
|
+
};
|
15367
15417
|
prepareSnapshotFolderName = () => {
|
15368
15418
|
const now = /* @__PURE__ */ new Date();
|
15369
15419
|
return `${now.getFullYear()}${two(now.getUTCMonth() + 1)}${two(
|
@@ -15458,7 +15508,7 @@ var init_sqlgenerator = __esm({
|
|
15458
15508
|
if (typeof compositePKs !== "undefined" && compositePKs.length > 0) {
|
15459
15509
|
statement += ",\n";
|
15460
15510
|
const compositePK4 = PgSquasher.unsquashPK(compositePKs[0]);
|
15461
|
-
statement += ` CONSTRAINT ${st.compositePkName} PRIMARY KEY("${compositePK4.columns.join(`","`)}")`;
|
15511
|
+
statement += ` CONSTRAINT "${st.compositePkName}" PRIMARY KEY("${compositePK4.columns.join(`","`)}")`;
|
15462
15512
|
}
|
15463
15513
|
if (typeof uniqueConstraints !== "undefined" && uniqueConstraints.length > 0) {
|
15464
15514
|
for (const uniqueConstraint4 of uniqueConstraints) {
|
@@ -17850,13 +17900,14 @@ var init_snapshotsDiffer = __esm({
|
|
17850
17900
|
jsonStatements.push(...jsonDropTables);
|
17851
17901
|
jsonStatements.push(...jsonRenameTables);
|
17852
17902
|
jsonStatements.push(...jsonRenameColumnsStatements);
|
17853
|
-
jsonStatements.push(...jsonDeletedCompositePKs);
|
17854
17903
|
if (dialect6 !== "mysql") {
|
17855
17904
|
jsonStatements.push(...jsonDeletedUniqueConstraints);
|
17856
17905
|
}
|
17857
17906
|
jsonStatements.push(...jsonDroppedReferencesForAlteredTables);
|
17858
17907
|
jsonStatements.push(...jsonDropIndexesForAllAlteredTables);
|
17908
|
+
jsonStatements.push(...jsonDeletedCompositePKs);
|
17859
17909
|
jsonStatements.push(...jsonTableAlternations.alterColumns);
|
17910
|
+
jsonStatements.push(...jsonAddedCompositePKs);
|
17860
17911
|
if (dialect6 === "mysql") {
|
17861
17912
|
jsonStatements.push(...jsonAddedUniqueConstraints);
|
17862
17913
|
jsonStatements.push(...jsonDeletedUniqueConstraints);
|
@@ -17868,7 +17919,6 @@ var init_snapshotsDiffer = __esm({
|
|
17868
17919
|
jsonStatements.push(...jsonTableAlternations.dropColumns);
|
17869
17920
|
if (dialect6 !== "sqlite")
|
17870
17921
|
jsonStatements.push(...jsonCreateReferences);
|
17871
|
-
jsonStatements.push(...jsonAddedCompositePKs);
|
17872
17922
|
jsonStatements.push(...jsonAlteredCompositePKs);
|
17873
17923
|
if (dialect6 !== "mysql") {
|
17874
17924
|
jsonStatements.push(...jsonAddedUniqueConstraints);
|
@@ -22307,15 +22357,15 @@ var require_pg_connection_string = __commonJS({
|
|
22307
22357
|
if (config.sslcert || config.sslkey || config.sslrootcert || config.sslmode) {
|
22308
22358
|
config.ssl = {};
|
22309
22359
|
}
|
22310
|
-
const
|
22360
|
+
const fs9 = config.sslcert || config.sslkey || config.sslrootcert ? require("fs") : null;
|
22311
22361
|
if (config.sslcert) {
|
22312
|
-
config.ssl.cert =
|
22362
|
+
config.ssl.cert = fs9.readFileSync(config.sslcert).toString();
|
22313
22363
|
}
|
22314
22364
|
if (config.sslkey) {
|
22315
|
-
config.ssl.key =
|
22365
|
+
config.ssl.key = fs9.readFileSync(config.sslkey).toString();
|
22316
22366
|
}
|
22317
22367
|
if (config.sslrootcert) {
|
22318
|
-
config.ssl.ca =
|
22368
|
+
config.ssl.ca = fs9.readFileSync(config.sslrootcert).toString();
|
22319
22369
|
}
|
22320
22370
|
switch (config.sslmode) {
|
22321
22371
|
case "disable": {
|
@@ -24099,15 +24149,15 @@ var require_lib = __commonJS({
|
|
24099
24149
|
"node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/index.js"(exports, module2) {
|
24100
24150
|
"use strict";
|
24101
24151
|
var path4 = require("path");
|
24102
|
-
var
|
24152
|
+
var fs9 = require("fs");
|
24103
24153
|
var helper = require_helper();
|
24104
24154
|
module2.exports = function(connInfo, cb) {
|
24105
24155
|
var file = helper.getFileName();
|
24106
|
-
|
24156
|
+
fs9.stat(file, function(err2, stat) {
|
24107
24157
|
if (err2 || !helper.usePgPass(stat, file)) {
|
24108
24158
|
return cb(void 0);
|
24109
24159
|
}
|
24110
|
-
var st =
|
24160
|
+
var st = fs9.createReadStream(file);
|
24111
24161
|
helper.getPassword(connInfo, st, cb);
|
24112
24162
|
});
|
24113
24163
|
};
|
@@ -44852,7 +44902,7 @@ var require_windows = __commonJS({
|
|
44852
44902
|
"node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports, module2) {
|
44853
44903
|
module2.exports = isexe;
|
44854
44904
|
isexe.sync = sync2;
|
44855
|
-
var
|
44905
|
+
var fs9 = require("fs");
|
44856
44906
|
function checkPathExt(path4, options) {
|
44857
44907
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
44858
44908
|
if (!pathext) {
|
@@ -44877,12 +44927,12 @@ var require_windows = __commonJS({
|
|
44877
44927
|
return checkPathExt(path4, options);
|
44878
44928
|
}
|
44879
44929
|
function isexe(path4, options, cb) {
|
44880
|
-
|
44930
|
+
fs9.stat(path4, function(er, stat) {
|
44881
44931
|
cb(er, er ? false : checkStat(stat, path4, options));
|
44882
44932
|
});
|
44883
44933
|
}
|
44884
44934
|
function sync2(path4, options) {
|
44885
|
-
return checkStat(
|
44935
|
+
return checkStat(fs9.statSync(path4), path4, options);
|
44886
44936
|
}
|
44887
44937
|
}
|
44888
44938
|
});
|
@@ -44892,14 +44942,14 @@ var require_mode = __commonJS({
|
|
44892
44942
|
"node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports, module2) {
|
44893
44943
|
module2.exports = isexe;
|
44894
44944
|
isexe.sync = sync2;
|
44895
|
-
var
|
44945
|
+
var fs9 = require("fs");
|
44896
44946
|
function isexe(path4, options, cb) {
|
44897
|
-
|
44947
|
+
fs9.stat(path4, function(er, stat) {
|
44898
44948
|
cb(er, er ? false : checkStat(stat, options));
|
44899
44949
|
});
|
44900
44950
|
}
|
44901
44951
|
function sync2(path4, options) {
|
44902
|
-
return checkStat(
|
44952
|
+
return checkStat(fs9.statSync(path4), options);
|
44903
44953
|
}
|
44904
44954
|
function checkStat(stat, options) {
|
44905
44955
|
return stat.isFile() && checkMode(stat, options);
|
@@ -44923,7 +44973,7 @@ var require_mode = __commonJS({
|
|
44923
44973
|
// node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
|
44924
44974
|
var require_isexe = __commonJS({
|
44925
44975
|
"node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module2) {
|
44926
|
-
var
|
44976
|
+
var fs9 = require("fs");
|
44927
44977
|
var core;
|
44928
44978
|
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
44929
44979
|
core = require_windows();
|
@@ -49866,8 +49916,8 @@ var require_utils6 = __commonJS({
|
|
49866
49916
|
exports.array = array;
|
49867
49917
|
var errno = require_errno();
|
49868
49918
|
exports.errno = errno;
|
49869
|
-
var
|
49870
|
-
exports.fs =
|
49919
|
+
var fs9 = require_fs();
|
49920
|
+
exports.fs = fs9;
|
49871
49921
|
var path4 = require_path();
|
49872
49922
|
exports.path = path4;
|
49873
49923
|
var pattern = require_pattern();
|
@@ -50051,12 +50101,12 @@ var require_fs2 = __commonJS({
|
|
50051
50101
|
"use strict";
|
50052
50102
|
Object.defineProperty(exports, "__esModule", { value: true });
|
50053
50103
|
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
|
50054
|
-
var
|
50104
|
+
var fs9 = require("fs");
|
50055
50105
|
exports.FILE_SYSTEM_ADAPTER = {
|
50056
|
-
lstat:
|
50057
|
-
stat:
|
50058
|
-
lstatSync:
|
50059
|
-
statSync:
|
50106
|
+
lstat: fs9.lstat,
|
50107
|
+
stat: fs9.stat,
|
50108
|
+
lstatSync: fs9.lstatSync,
|
50109
|
+
statSync: fs9.statSync
|
50060
50110
|
};
|
50061
50111
|
function createFileSystemAdapter(fsMethods) {
|
50062
50112
|
if (fsMethods === void 0) {
|
@@ -50073,12 +50123,12 @@ var require_settings = __commonJS({
|
|
50073
50123
|
"node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/settings.js"(exports) {
|
50074
50124
|
"use strict";
|
50075
50125
|
Object.defineProperty(exports, "__esModule", { value: true });
|
50076
|
-
var
|
50126
|
+
var fs9 = require_fs2();
|
50077
50127
|
var Settings = class {
|
50078
50128
|
constructor(_options = {}) {
|
50079
50129
|
this._options = _options;
|
50080
50130
|
this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
|
50081
|
-
this.fs =
|
50131
|
+
this.fs = fs9.createFileSystemAdapter(this._options.fs);
|
50082
50132
|
this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
|
50083
50133
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
50084
50134
|
}
|
@@ -50236,8 +50286,8 @@ var require_utils7 = __commonJS({
|
|
50236
50286
|
"use strict";
|
50237
50287
|
Object.defineProperty(exports, "__esModule", { value: true });
|
50238
50288
|
exports.fs = void 0;
|
50239
|
-
var
|
50240
|
-
exports.fs =
|
50289
|
+
var fs9 = require_fs3();
|
50290
|
+
exports.fs = fs9;
|
50241
50291
|
}
|
50242
50292
|
});
|
50243
50293
|
|
@@ -50432,14 +50482,14 @@ var require_fs4 = __commonJS({
|
|
50432
50482
|
"use strict";
|
50433
50483
|
Object.defineProperty(exports, "__esModule", { value: true });
|
50434
50484
|
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
|
50435
|
-
var
|
50485
|
+
var fs9 = require("fs");
|
50436
50486
|
exports.FILE_SYSTEM_ADAPTER = {
|
50437
|
-
lstat:
|
50438
|
-
stat:
|
50439
|
-
lstatSync:
|
50440
|
-
statSync:
|
50441
|
-
readdir:
|
50442
|
-
readdirSync:
|
50487
|
+
lstat: fs9.lstat,
|
50488
|
+
stat: fs9.stat,
|
50489
|
+
lstatSync: fs9.lstatSync,
|
50490
|
+
statSync: fs9.statSync,
|
50491
|
+
readdir: fs9.readdir,
|
50492
|
+
readdirSync: fs9.readdirSync
|
50443
50493
|
};
|
50444
50494
|
function createFileSystemAdapter(fsMethods) {
|
50445
50495
|
if (fsMethods === void 0) {
|
@@ -50458,12 +50508,12 @@ var require_settings2 = __commonJS({
|
|
50458
50508
|
Object.defineProperty(exports, "__esModule", { value: true });
|
50459
50509
|
var path4 = require("path");
|
50460
50510
|
var fsStat = require_out();
|
50461
|
-
var
|
50511
|
+
var fs9 = require_fs4();
|
50462
50512
|
var Settings = class {
|
50463
50513
|
constructor(_options = {}) {
|
50464
50514
|
this._options = _options;
|
50465
50515
|
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
|
50466
|
-
this.fs =
|
50516
|
+
this.fs = fs9.createFileSystemAdapter(this._options.fs);
|
50467
50517
|
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path4.sep);
|
50468
50518
|
this.stats = this._getValue(this._options.stats, false);
|
50469
50519
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
@@ -51779,16 +51829,16 @@ var require_settings4 = __commonJS({
|
|
51779
51829
|
"use strict";
|
51780
51830
|
Object.defineProperty(exports, "__esModule", { value: true });
|
51781
51831
|
exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
|
51782
|
-
var
|
51832
|
+
var fs9 = require("fs");
|
51783
51833
|
var os2 = require("os");
|
51784
51834
|
var CPU_COUNT = Math.max(os2.cpus().length, 1);
|
51785
51835
|
exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
|
51786
|
-
lstat:
|
51787
|
-
lstatSync:
|
51788
|
-
stat:
|
51789
|
-
statSync:
|
51790
|
-
readdir:
|
51791
|
-
readdirSync:
|
51836
|
+
lstat: fs9.lstat,
|
51837
|
+
lstatSync: fs9.lstatSync,
|
51838
|
+
stat: fs9.stat,
|
51839
|
+
statSync: fs9.statSync,
|
51840
|
+
readdir: fs9.readdir,
|
51841
|
+
readdirSync: fs9.readdirSync
|
51792
51842
|
};
|
51793
51843
|
var Settings = class {
|
51794
51844
|
constructor(_options = {}) {
|
@@ -51939,13 +51989,13 @@ var require_path_type = __commonJS({
|
|
51939
51989
|
"node_modules/.pnpm/path-type@4.0.0/node_modules/path-type/index.js"(exports) {
|
51940
51990
|
"use strict";
|
51941
51991
|
var { promisify: promisify2 } = require("util");
|
51942
|
-
var
|
51992
|
+
var fs9 = require("fs");
|
51943
51993
|
async function isType(fsStatType, statsMethodName, filePath) {
|
51944
51994
|
if (typeof filePath !== "string") {
|
51945
51995
|
throw new TypeError(`Expected a string, got ${typeof filePath}`);
|
51946
51996
|
}
|
51947
51997
|
try {
|
51948
|
-
const stats = await promisify2(
|
51998
|
+
const stats = await promisify2(fs9[fsStatType])(filePath);
|
51949
51999
|
return stats[statsMethodName]();
|
51950
52000
|
} catch (error2) {
|
51951
52001
|
if (error2.code === "ENOENT") {
|
@@ -51959,7 +52009,7 @@ var require_path_type = __commonJS({
|
|
51959
52009
|
throw new TypeError(`Expected a string, got ${typeof filePath}`);
|
51960
52010
|
}
|
51961
52011
|
try {
|
51962
|
-
return
|
52012
|
+
return fs9[fsStatType](filePath)[statsMethodName]();
|
51963
52013
|
} catch (error2) {
|
51964
52014
|
if (error2.code === "ENOENT") {
|
51965
52015
|
return false;
|
@@ -59638,14 +59688,14 @@ var require_parser2 = __commonJS({
|
|
59638
59688
|
case "scalar":
|
59639
59689
|
case "single-quoted-scalar":
|
59640
59690
|
case "double-quoted-scalar": {
|
59641
|
-
const
|
59691
|
+
const fs9 = this.flowScalar(this.type);
|
59642
59692
|
if (atNextItem || it.value) {
|
59643
|
-
map.items.push({ start, key:
|
59693
|
+
map.items.push({ start, key: fs9, sep: [] });
|
59644
59694
|
this.onKeyLine = true;
|
59645
59695
|
} else if (it.sep) {
|
59646
|
-
this.stack.push(
|
59696
|
+
this.stack.push(fs9);
|
59647
59697
|
} else {
|
59648
|
-
Object.assign(it, { key:
|
59698
|
+
Object.assign(it, { key: fs9, sep: [] });
|
59649
59699
|
this.onKeyLine = true;
|
59650
59700
|
}
|
59651
59701
|
return;
|
@@ -59764,13 +59814,13 @@ var require_parser2 = __commonJS({
|
|
59764
59814
|
case "scalar":
|
59765
59815
|
case "single-quoted-scalar":
|
59766
59816
|
case "double-quoted-scalar": {
|
59767
|
-
const
|
59817
|
+
const fs9 = this.flowScalar(this.type);
|
59768
59818
|
if (!it || it.value)
|
59769
|
-
fc.items.push({ start: [], key:
|
59819
|
+
fc.items.push({ start: [], key: fs9, sep: [] });
|
59770
59820
|
else if (it.sep)
|
59771
|
-
this.stack.push(
|
59821
|
+
this.stack.push(fs9);
|
59772
59822
|
else
|
59773
|
-
Object.assign(it, { key:
|
59823
|
+
Object.assign(it, { key: fs9, sep: [] });
|
59774
59824
|
return;
|
59775
59825
|
}
|
59776
59826
|
case "flow-map-end":
|
@@ -60321,8 +60371,8 @@ var init_studioUtils = __esm({
|
|
60321
60371
|
};
|
60322
60372
|
};
|
60323
60373
|
drizzleForSQLite = async (config, sqliteSchema2, relations4, ts, verbose) => {
|
60324
|
-
const { driver, dbCredentials: creds } = config;
|
60325
|
-
if (
|
60374
|
+
const { driver: driver2, dbCredentials: creds } = config;
|
60375
|
+
if (driver2 === "d1") {
|
60326
60376
|
const { drizzle: drizzle2 } = await Promise.resolve().then(() => (init_driver(), driver_exports));
|
60327
60377
|
const { execute: execute2 } = await Promise.resolve().then(() => (init_wrangler_client(), wrangler_client_exports));
|
60328
60378
|
const db = drizzle2(execute2, creds.wranglerConfigPath, creds.dbName, {
|
@@ -60340,7 +60390,7 @@ var init_studioUtils = __esm({
|
|
60340
60390
|
ts
|
60341
60391
|
};
|
60342
60392
|
}
|
60343
|
-
if (
|
60393
|
+
if (driver2 === "better-sqlite") {
|
60344
60394
|
assertPackages("better-sqlite3");
|
60345
60395
|
const { drizzle: drizzle2 } = await import("drizzle-orm/better-sqlite3");
|
60346
60396
|
const Database = await import("better-sqlite3");
|
@@ -60359,7 +60409,7 @@ var init_studioUtils = __esm({
|
|
60359
60409
|
ts
|
60360
60410
|
};
|
60361
60411
|
}
|
60362
|
-
if (
|
60412
|
+
if (driver2 === "libsql" || driver2 === "turso") {
|
60363
60413
|
assertPackages("@libsql/client");
|
60364
60414
|
const { drizzle: drizzle2 } = await import("drizzle-orm/libsql");
|
60365
60415
|
const { createClient } = await import("@libsql/client");
|
@@ -60383,7 +60433,7 @@ var init_studioUtils = __esm({
|
|
60383
60433
|
ts
|
60384
60434
|
};
|
60385
60435
|
}
|
60386
|
-
assertUnreachable(
|
60436
|
+
assertUnreachable(driver2);
|
60387
60437
|
};
|
60388
60438
|
drizzleDb = async (drizzleConfig, models, logger) => {
|
60389
60439
|
if (drizzleConfig.driver === "pg") {
|
@@ -61097,8 +61147,8 @@ var init_mysql = __esm({
|
|
61097
61147
|
mysqlConnectionConfig
|
61098
61148
|
);
|
61099
61149
|
printCliConnectionIssues3 = (options) => {
|
61100
|
-
const { driver, uri, host, database } = options || {};
|
61101
|
-
if (
|
61150
|
+
const { driver: driver2, uri, host, database } = options || {};
|
61151
|
+
if (driver2 !== "mysql2") {
|
61102
61152
|
console.log(outputs.mysql.connection.driver());
|
61103
61153
|
}
|
61104
61154
|
if (!uri && (!host || !database)) {
|
@@ -61137,7 +61187,7 @@ var init_mysql = __esm({
|
|
61137
61187
|
const {
|
61138
61188
|
out,
|
61139
61189
|
schema: schema4,
|
61140
|
-
driver,
|
61190
|
+
driver: driver2,
|
61141
61191
|
schemaFilter,
|
61142
61192
|
tablesFilter,
|
61143
61193
|
breakpoints,
|
@@ -61147,7 +61197,7 @@ var init_mysql = __esm({
|
|
61147
61197
|
return {
|
61148
61198
|
out,
|
61149
61199
|
schema: schema4,
|
61150
|
-
driver,
|
61200
|
+
driver: driver2,
|
61151
61201
|
schemaFilter,
|
61152
61202
|
tablesFilter,
|
61153
61203
|
breakpoints,
|
@@ -61183,13 +61233,13 @@ var init_mysql = __esm({
|
|
61183
61233
|
strict,
|
61184
61234
|
verbose,
|
61185
61235
|
schema: schema4,
|
61186
|
-
driver,
|
61236
|
+
driver: driver2,
|
61187
61237
|
schemaFilter,
|
61188
61238
|
tablesFilter,
|
61189
61239
|
...rest
|
61190
61240
|
} = cliRes.data;
|
61191
61241
|
return {
|
61192
|
-
driver,
|
61242
|
+
driver: driver2,
|
61193
61243
|
schema: schema4,
|
61194
61244
|
strict,
|
61195
61245
|
verbose,
|
@@ -61270,7 +61320,7 @@ var require_package = __commonJS({
|
|
61270
61320
|
// node_modules/.pnpm/dotenv@16.0.3/node_modules/dotenv/lib/main.js
|
61271
61321
|
var require_main = __commonJS({
|
61272
61322
|
"node_modules/.pnpm/dotenv@16.0.3/node_modules/dotenv/lib/main.js"(exports, module2) {
|
61273
|
-
var
|
61323
|
+
var fs9 = require("fs");
|
61274
61324
|
var path4 = require("path");
|
61275
61325
|
var os2 = require("os");
|
61276
61326
|
var packageJson = require_package();
|
@@ -61315,7 +61365,7 @@ var require_main = __commonJS({
|
|
61315
61365
|
}
|
61316
61366
|
}
|
61317
61367
|
try {
|
61318
|
-
const parsed = DotenvModule.parse(
|
61368
|
+
const parsed = DotenvModule.parse(fs9.readFileSync(dotenvPath, { encoding }));
|
61319
61369
|
Object.keys(parsed).forEach(function(key) {
|
61320
61370
|
if (!Object.prototype.hasOwnProperty.call(process.env, key)) {
|
61321
61371
|
process.env[key] = parsed[key];
|
@@ -62109,7 +62159,7 @@ __export(cli_exports, {
|
|
62109
62159
|
});
|
62110
62160
|
module.exports = __toCommonJS(cli_exports);
|
62111
62161
|
var import_commander = require("commander");
|
62112
|
-
var
|
62162
|
+
var import_fs12 = require("fs");
|
62113
62163
|
init_lib();
|
62114
62164
|
|
62115
62165
|
// src/cli/commands/check.ts
|
@@ -62350,6 +62400,8 @@ var import_fs10 = require("fs");
|
|
62350
62400
|
var import_hanji8 = __toESM(require_hanji());
|
62351
62401
|
var import_path6 = require("path");
|
62352
62402
|
init_views();
|
62403
|
+
init_migrate();
|
62404
|
+
var import_fs11 = __toESM(require("fs"));
|
62353
62405
|
var dropMigration = async (out) => {
|
62354
62406
|
const metaFilePath = (0, import_path6.join)(out, "meta", "_journal.json");
|
62355
62407
|
const journal = JSON.parse(
|
@@ -62372,6 +62424,7 @@ var dropMigration = async (out) => {
|
|
62372
62424
|
(0, import_fs10.rmSync)(sqlFilePath);
|
62373
62425
|
(0, import_fs10.rmSync)(snapshotFilePath);
|
62374
62426
|
(0, import_fs10.writeFileSync)(metaFilePath, JSON.stringify(resultJournal));
|
62427
|
+
import_fs11.default.writeFileSync((0, import_path6.join)(out, `migrations.js`), embeddedMigrations(resultJournal));
|
62375
62428
|
console.log(`[${source_default.green("\u2713")}] ${source_default.bold(result.data.tag)} migration successfully dropped`);
|
62376
62429
|
};
|
62377
62430
|
|
@@ -62383,6 +62436,7 @@ init_source();
|
|
62383
62436
|
var import_hanji9 = __toESM(require_hanji());
|
62384
62437
|
init_mysqlSchema();
|
62385
62438
|
init_selector_ui();
|
62439
|
+
init_outputs();
|
62386
62440
|
var filterStatements = (statements, currentSchema, prevSchema) => {
|
62387
62441
|
return statements.filter((statement) => {
|
62388
62442
|
if (statement.type === "alter_table_alter_column_set_type") {
|
@@ -62426,7 +62480,8 @@ var filterStatements = (statements, currentSchema, prevSchema) => {
|
|
62426
62480
|
};
|
62427
62481
|
var logSuggestionsAndReturn = async ({
|
62428
62482
|
connection,
|
62429
|
-
statements
|
62483
|
+
statements,
|
62484
|
+
json2
|
62430
62485
|
}) => {
|
62431
62486
|
let shouldAskForApprove = false;
|
62432
62487
|
const statementsToExecute = [];
|
@@ -62533,6 +62588,16 @@ var logSuggestionsAndReturn = async ({
|
|
62533
62588
|
const res = await connection.query(
|
62534
62589
|
`select count(*) as count from \`${statement.tableName}\``
|
62535
62590
|
);
|
62591
|
+
if (Object.values(json2.tables[statement.tableName].columns).filter(
|
62592
|
+
(column7) => column7.autoincrement
|
62593
|
+
).length > 0) {
|
62594
|
+
console.log(
|
62595
|
+
`${withStyle.errorWarning(
|
62596
|
+
`You have removed the primary key from a ${statement.tableName} table without removing the auto-increment property from this table. As the database error states: 'there can be only one auto column, and it must be defined as a key. Make sure to remove autoincrement from ${statement.tableName} table`
|
62597
|
+
)}`
|
62598
|
+
);
|
62599
|
+
process.exit(1);
|
62600
|
+
}
|
62536
62601
|
const count = Number(res[0][0].count);
|
62537
62602
|
if (count > 0) {
|
62538
62603
|
infoToPrint.push(
|
@@ -62543,6 +62608,17 @@ var logSuggestionsAndReturn = async ({
|
|
62543
62608
|
tablesToTruncate.push(statement.tableName);
|
62544
62609
|
shouldAskForApprove = true;
|
62545
62610
|
}
|
62611
|
+
} else if (statement.type === "delete_composite_pk") {
|
62612
|
+
if (Object.values(json2.tables[statement.tableName].columns).filter(
|
62613
|
+
(column7) => column7.autoincrement
|
62614
|
+
).length > 0) {
|
62615
|
+
console.log(
|
62616
|
+
`${withStyle.errorWarning(
|
62617
|
+
`You have removed the primary key from a ${statement.tableName} table without removing the auto-increment property from this table. As the database error states: 'there can be only one auto column, and it must be defined as a key. Make sure to remove autoincrement from ${statement.tableName} table`
|
62618
|
+
)}`
|
62619
|
+
);
|
62620
|
+
process.exit(1);
|
62621
|
+
}
|
62546
62622
|
} else if (statement.type === "alter_table_add_column") {
|
62547
62623
|
if (statement.column.notNull && typeof statement.column.default === "undefined") {
|
62548
62624
|
const res = await connection.query(
|
@@ -63015,7 +63091,8 @@ var dbPushMysqlCommand = new import_commander.Command("push:mysql").option(
|
|
63015
63091
|
schemasToRemove
|
63016
63092
|
} = await logSuggestionsAndReturn({
|
63017
63093
|
connection: connection.client,
|
63018
|
-
statements: filteredStatements
|
63094
|
+
statements: filteredStatements,
|
63095
|
+
json2: statements == null ? void 0 : statements.validatedCur
|
63019
63096
|
});
|
63020
63097
|
const filteredSqlStatements = filteredStatements.map(
|
63021
63098
|
(filteredStatement) => fromJson([filteredStatement], "mysql")[0]
|
@@ -63437,7 +63514,7 @@ var introspectPgCommand = new import_commander.Command("introspect:pg").option("
|
|
63437
63514
|
schemasFilter
|
63438
63515
|
);
|
63439
63516
|
const schemaFile = import_path7.default.join(validatedConfig.out, "schema.ts");
|
63440
|
-
(0,
|
63517
|
+
(0, import_fs12.writeFileSync)(schemaFile, ts.file);
|
63441
63518
|
console.log();
|
63442
63519
|
if (snapshots.length === 0) {
|
63443
63520
|
const { sqlStatements, _meta } = await prepareSQL(
|
@@ -63490,7 +63567,7 @@ var introspectMySqlCommand = new import_commander.Command("introspect:mysql").op
|
|
63490
63567
|
const tablesFilter = filterConfig ? typeof filterConfig === "string" ? [filterConfig] : filterConfig : [];
|
63491
63568
|
const { schema: schema4, ts } = await mysqlIntrospect2(res, tablesFilter);
|
63492
63569
|
const schemaFile = import_path7.default.join(out, "schema.ts");
|
63493
|
-
(0,
|
63570
|
+
(0, import_fs12.writeFileSync)(schemaFile, ts.file);
|
63494
63571
|
console.log();
|
63495
63572
|
if (snapshots.length === 0) {
|
63496
63573
|
const { sqlStatements, _meta } = await prepareSQL(
|
@@ -63543,7 +63620,7 @@ var introspectSQLiteCommand = new import_commander.Command("introspect:sqlite").
|
|
63543
63620
|
const tablesFilter = filterConfig ? typeof filterConfig === "string" ? [filterConfig] : filterConfig : [];
|
63544
63621
|
const { schema: schema4, ts } = await sqliteIntrospect2(res, tablesFilter);
|
63545
63622
|
const schemaFile = import_path7.default.join(out, "schema.ts");
|
63546
|
-
(0,
|
63623
|
+
(0, import_fs12.writeFileSync)(schemaFile, ts.file);
|
63547
63624
|
console.log();
|
63548
63625
|
if (snapshots.length === 0) {
|
63549
63626
|
const { sqlStatements, _meta } = await prepareSQL(
|
@@ -63608,9 +63685,9 @@ var studioCommand = new import_commander.Command("studio").option("--port <port>
|
|
63608
63685
|
prepareSQLiteSchema: prepareSQLiteSchema2,
|
63609
63686
|
drizzleForSQLite: drizzleForSQLite2
|
63610
63687
|
} = await Promise.resolve().then(() => (init_studioUtils(), studioUtils_exports));
|
63611
|
-
const { driver, schema: schemaPath } = drizzleConfig;
|
63688
|
+
const { driver: driver2, schema: schemaPath } = drizzleConfig;
|
63612
63689
|
let setup;
|
63613
|
-
if (
|
63690
|
+
if (driver2 === "pg") {
|
63614
63691
|
const { schemaToTypeScript: schemaToTypeScript4, relationsToTypeScript: relationsToTypeScript2 } = await Promise.resolve().then(() => (init_introspect_pg(), introspect_pg_exports));
|
63615
63692
|
const { serializePg: serializePg2 } = await Promise.resolve().then(() => (init_serializer(), serializer_exports));
|
63616
63693
|
const { schema: schema4, relations: relations4 } = await preparePgSchema2(schemaPath);
|
@@ -63628,7 +63705,7 @@ var studioCommand = new import_commander.Command("studio").option("--port <port>
|
|
63628
63705
|
},
|
63629
63706
|
Boolean(options.verbose)
|
63630
63707
|
);
|
63631
|
-
} else if (
|
63708
|
+
} else if (driver2 === "mysql2") {
|
63632
63709
|
const { schemaToTypeScript: schemaToTypeScript4 } = await Promise.resolve().then(() => (init_introspect_mysql(), introspect_mysql_exports));
|
63633
63710
|
const { schema: schema4, relations: relations4 } = await prepareMySqlSchema2(schemaPath);
|
63634
63711
|
const { serializeMySql: serializeMySql2 } = await Promise.resolve().then(() => (init_serializer(), serializer_exports));
|
@@ -63645,7 +63722,7 @@ var studioCommand = new import_commander.Command("studio").option("--port <port>
|
|
63645
63722
|
},
|
63646
63723
|
Boolean(options.verbose)
|
63647
63724
|
);
|
63648
|
-
} else if (
|
63725
|
+
} else if (driver2 === "better-sqlite" || driver2 === "d1" || driver2 === "libsql" || driver2 === "turso") {
|
63649
63726
|
const { schemaToTypeScript: schemaToTypeScript4 } = await Promise.resolve().then(() => (init_introspect_sqlite(), introspect_sqlite_exports));
|
63650
63727
|
const { schema: schema4, relations: relations4 } = await prepareSQLiteSchema2(schemaPath);
|
63651
63728
|
const { serializeSQLite: serializeSQLite2 } = await Promise.resolve().then(() => (init_serializer(), serializer_exports));
|
@@ -63663,7 +63740,7 @@ var studioCommand = new import_commander.Command("studio").option("--port <port>
|
|
63663
63740
|
Boolean(options.verbose)
|
63664
63741
|
);
|
63665
63742
|
} else {
|
63666
|
-
assertUnreachable(
|
63743
|
+
assertUnreachable(driver2);
|
63667
63744
|
}
|
63668
63745
|
const qeueryEngine = (0, import_studio.queryEngineForSetup)(setup);
|
63669
63746
|
const server = await (0, import_server.prepareServer)((_2) => {
|
@@ -63677,7 +63754,7 @@ var studioCommand = new import_commander.Command("studio").option("--port <port>
|
|
63677
63754
|
"Drizzle Studio is currently in Beta. If you find anything that is not working as expected or should be improved, feel free to create an issue on GitHub: https://github.com/drizzle-team/drizzle-kit-mirror/issues/new or write to us on Discord: https://discord.gg/WcRKz2FFxN"
|
63678
63755
|
)
|
63679
63756
|
);
|
63680
|
-
if (
|
63757
|
+
if (driver2 === "d1") {
|
63681
63758
|
console.log(
|
63682
63759
|
withStyle.fullWarning(
|
63683
63760
|
"It seems like you are trying to access your D1 Database. Please make sure to run 'wrangler login' before using Drizzle Studio to ensure it has your token for making requests to the D1 Database. If you encounter an error related to CLOUDFLARE_TOKEN, please run 'wrangler login' and restart the studio"
|