drizzle-kit 0.20.7-2e40056 → 0.20.7-4f47c46
Sign up to get free protection for your applications and to get access to all the features.
- package/bin.cjs +143 -202
- package/cli/commands/migrate.d.ts +1 -11
- package/cli/commands/utils.d.ts +0 -9
- package/cli/validations/mysql.d.ts +6 -6
- package/cli/validations/pg.d.ts +12 -12
- package/index.d.mts +0 -2
- package/index.d.ts +0 -2
- package/package.json +1 -1
- package/utils.js +48 -79
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,
|
11264
|
+
var import_path, import_fs, import_hanji2, assertES5, safeRegister, prepareGenerateConfig, assertOutFolder, 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,8 +11324,7 @@ var init_utils = __esm({
|
|
11324
11324
|
custom,
|
11325
11325
|
breakpoints: drizzleConfig.breakpoints ?? false,
|
11326
11326
|
schema: drizzleConfig.schema,
|
11327
|
-
out: drizzleConfig.out
|
11328
|
-
bundle: drizzleConfig.driver === "expo"
|
11327
|
+
out: drizzleConfig.out
|
11329
11328
|
};
|
11330
11329
|
}
|
11331
11330
|
if (!schema4) {
|
@@ -11341,7 +11340,7 @@ var init_utils = __esm({
|
|
11341
11340
|
console.error(`'out' param must be set`);
|
11342
11341
|
process.exit(1);
|
11343
11342
|
}
|
11344
|
-
return { schema: schema4, out, breakpoints, custom
|
11343
|
+
return { schema: schema4, out, breakpoints, custom };
|
11345
11344
|
};
|
11346
11345
|
assertOutFolder = async (it) => {
|
11347
11346
|
if ("out" in it)
|
@@ -11357,20 +11356,10 @@ var init_utils = __esm({
|
|
11357
11356
|
}
|
11358
11357
|
return cliConfig.out;
|
11359
11358
|
};
|
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
|
-
]);
|
11369
11359
|
configCommonSchema = objectType({
|
11370
11360
|
schema: unionType([stringType(), stringType().array()]),
|
11371
11361
|
out: stringType().optional(),
|
11372
11362
|
breakpoints: booleanType().default(true),
|
11373
|
-
driver: driver.optional(),
|
11374
11363
|
tablesFilter: unionType([stringType(), stringType().array()]).optional(),
|
11375
11364
|
schemaFilter: unionType([stringType(), stringType().array()]).default(["public"])
|
11376
11365
|
});
|
@@ -11577,9 +11566,9 @@ var init_outputs = __esm({
|
|
11577
11566
|
driver: () => withStyle.error(
|
11578
11567
|
`Either "turso", "libsql", "better-sqlite" are available options for "--driver"`
|
11579
11568
|
),
|
11580
|
-
url: (
|
11581
|
-
authToken: (
|
11582
|
-
`"authToken" is a required option for driver "${
|
11569
|
+
url: (driver) => withStyle.error(`"url" is a required option for driver "${driver}". You can read more about drizzle.config: https://orm.drizzle.team/kit-docs/config-reference`),
|
11570
|
+
authToken: (driver) => withStyle.error(
|
11571
|
+
`"authToken" is a required option for driver "${driver}". You can read more about drizzle.config: https://orm.drizzle.team/kit-docs/config-reference`
|
11583
11572
|
)
|
11584
11573
|
},
|
11585
11574
|
introspect: {},
|
@@ -12006,9 +11995,9 @@ We have encountered a collision between the index name on columns ${source_defau
|
|
12006
11995
|
}
|
12007
11996
|
try {
|
12008
11997
|
const fks = await db.execute(
|
12009
|
-
`SELECT INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_SCHEMA,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_NAME,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_NAME,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.COLUMN_NAME,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_TABLE_SCHEMA,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_TABLE_NAME, INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_COLUMN_NAME,
|
11998
|
+
`SELECT INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_SCHEMA,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_NAME,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_NAME,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.COLUMN_NAME,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_TABLE_SCHEMA,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_TABLE_NAME, INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_COLUMN_NAME,INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS.UPDATE_RULE, INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS.DELETE_RULE
|
12010
11999
|
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
|
12011
|
-
LEFT JOIN
|
12000
|
+
LEFT JOIN INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS on INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS.CONSTRAINT_NAME = INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_NAME
|
12012
12001
|
WHERE INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_SCHEMA = ? AND INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_NAME != 'PRIMARY' and INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_TABLE_NAME is not null;
|
12013
12002
|
`,
|
12014
12003
|
[inputSchema]
|
@@ -14915,7 +14904,6 @@ var init_words = __esm({
|
|
14915
14904
|
var migrate_exports = {};
|
14916
14905
|
__export(migrate_exports, {
|
14917
14906
|
BREAKPOINT: () => BREAKPOINT,
|
14918
|
-
embeddedMigrations: () => embeddedMigrations,
|
14919
14907
|
prepareAndMigrateMySql: () => prepareAndMigrateMySql,
|
14920
14908
|
prepareAndMigratePg: () => prepareAndMigratePg,
|
14921
14909
|
prepareAndMigrateSqlite: () => prepareAndMigrateSqlite,
|
@@ -14926,7 +14914,7 @@ __export(migrate_exports, {
|
|
14926
14914
|
prepareSnapshotFolderName: () => prepareSnapshotFolderName,
|
14927
14915
|
writeResult: () => writeResult
|
14928
14916
|
});
|
14929
|
-
var import_fs4, import_path3, import_hanji3, prepareAndMigratePg, prepareMySQLPush, prepareSQLitePush, preparePgPush, prepareAndMigrateMySql, prepareAndMigrateSqlite, prepareSQL, promptColumnsConflicts, promptTablesConflict, promptSchemasConflict, BREAKPOINT, writeResult,
|
14917
|
+
var import_fs4, import_path3, import_hanji3, prepareAndMigratePg, prepareMySQLPush, prepareSQLitePush, preparePgPush, prepareAndMigrateMySql, prepareAndMigrateSqlite, prepareSQL, promptColumnsConflicts, promptTablesConflict, promptSchemasConflict, BREAKPOINT, writeResult, prepareSnapshotFolderName, two;
|
14930
14918
|
var init_migrate = __esm({
|
14931
14919
|
"src/cli/commands/migrate.ts"() {
|
14932
14920
|
import_fs4 = __toESM(require("fs"));
|
@@ -14955,14 +14943,19 @@ var init_migrate = __esm({
|
|
14955
14943
|
const validatedPrev = pgSchema.parse(prev);
|
14956
14944
|
const validatedCur = pgSchema.parse(cur);
|
14957
14945
|
if (config.custom) {
|
14958
|
-
writeResult(
|
14959
|
-
|
14960
|
-
|
14946
|
+
writeResult(
|
14947
|
+
custom,
|
14948
|
+
[],
|
14961
14949
|
journal,
|
14950
|
+
{
|
14951
|
+
columns: {},
|
14952
|
+
schemas: {},
|
14953
|
+
tables: {}
|
14954
|
+
},
|
14962
14955
|
outFolder,
|
14963
|
-
|
14964
|
-
|
14965
|
-
|
14956
|
+
config.breakpoints,
|
14957
|
+
"custom"
|
14958
|
+
);
|
14966
14959
|
return;
|
14967
14960
|
}
|
14968
14961
|
const squashedPrev = squashPgScheme(validatedPrev);
|
@@ -14974,13 +14967,14 @@ var init_migrate = __esm({
|
|
14974
14967
|
validatedPrev,
|
14975
14968
|
validatedCur
|
14976
14969
|
);
|
14977
|
-
writeResult(
|
14970
|
+
writeResult(
|
14978
14971
|
cur,
|
14979
14972
|
sqlStatements,
|
14980
14973
|
journal,
|
14974
|
+
_meta,
|
14981
14975
|
outFolder,
|
14982
|
-
|
14983
|
-
|
14976
|
+
config.breakpoints
|
14977
|
+
);
|
14984
14978
|
} catch (e) {
|
14985
14979
|
console.error(e);
|
14986
14980
|
}
|
@@ -15074,14 +15068,19 @@ var init_migrate = __esm({
|
|
15074
15068
|
const validatedPrev = mysqlSchema.parse(prev);
|
15075
15069
|
const validatedCur = mysqlSchema.parse(cur);
|
15076
15070
|
if (config.custom) {
|
15077
|
-
writeResult(
|
15078
|
-
|
15079
|
-
|
15071
|
+
writeResult(
|
15072
|
+
custom,
|
15073
|
+
[],
|
15080
15074
|
journal,
|
15075
|
+
{
|
15076
|
+
columns: {},
|
15077
|
+
schemas: {},
|
15078
|
+
tables: {}
|
15079
|
+
},
|
15081
15080
|
outFolder,
|
15082
|
-
|
15083
|
-
|
15084
|
-
|
15081
|
+
config.breakpoints,
|
15082
|
+
"custom"
|
15083
|
+
);
|
15085
15084
|
return;
|
15086
15085
|
}
|
15087
15086
|
const squashedPrev = squashMysqlScheme(validatedPrev);
|
@@ -15093,14 +15092,14 @@ var init_migrate = __esm({
|
|
15093
15092
|
validatedPrev,
|
15094
15093
|
validatedCur
|
15095
15094
|
);
|
15096
|
-
writeResult(
|
15095
|
+
writeResult(
|
15097
15096
|
cur,
|
15098
15097
|
sqlStatements,
|
15099
15098
|
journal,
|
15100
15099
|
_meta,
|
15101
15100
|
outFolder,
|
15102
|
-
|
15103
|
-
|
15101
|
+
config.breakpoints
|
15102
|
+
);
|
15104
15103
|
} catch (e) {
|
15105
15104
|
console.error(e);
|
15106
15105
|
}
|
@@ -15118,15 +15117,19 @@ var init_migrate = __esm({
|
|
15118
15117
|
const validatedPrev = sqliteSchema.parse(prev);
|
15119
15118
|
const validatedCur = sqliteSchema.parse(cur);
|
15120
15119
|
if (config.custom) {
|
15121
|
-
writeResult(
|
15122
|
-
|
15123
|
-
|
15120
|
+
writeResult(
|
15121
|
+
custom,
|
15122
|
+
[],
|
15124
15123
|
journal,
|
15124
|
+
{
|
15125
|
+
columns: {},
|
15126
|
+
schemas: {},
|
15127
|
+
tables: {}
|
15128
|
+
},
|
15125
15129
|
outFolder,
|
15126
|
-
|
15127
|
-
|
15128
|
-
|
15129
|
-
});
|
15130
|
+
config.breakpoints,
|
15131
|
+
"custom"
|
15132
|
+
);
|
15130
15133
|
return;
|
15131
15134
|
}
|
15132
15135
|
const squashedPrev = squashSqliteScheme(validatedPrev);
|
@@ -15136,15 +15139,14 @@ var init_migrate = __esm({
|
|
15136
15139
|
squashedCur,
|
15137
15140
|
"sqlite"
|
15138
15141
|
);
|
15139
|
-
writeResult(
|
15142
|
+
writeResult(
|
15140
15143
|
cur,
|
15141
15144
|
sqlStatements,
|
15142
15145
|
journal,
|
15143
15146
|
_meta,
|
15144
15147
|
outFolder,
|
15145
|
-
|
15146
|
-
|
15147
|
-
});
|
15148
|
+
config.breakpoints
|
15149
|
+
);
|
15148
15150
|
} catch (e) {
|
15149
15151
|
console.error(e);
|
15150
15152
|
}
|
@@ -15332,20 +15334,7 @@ var init_migrate = __esm({
|
|
15332
15334
|
return result;
|
15333
15335
|
};
|
15334
15336
|
BREAKPOINT = "--> statement-breakpoint\n";
|
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
|
-
}) => {
|
15337
|
+
writeResult = (cur, sqlStatements, journal, _meta, outFolder, breakpoints, type = "none") => {
|
15349
15338
|
if (type === "none") {
|
15350
15339
|
console.log(schema(cur));
|
15351
15340
|
if (sqlStatements.length === 0) {
|
@@ -15386,10 +15375,6 @@ ${sql2}
|
|
15386
15375
|
});
|
15387
15376
|
import_fs4.default.writeFileSync(metaJournal, JSON.stringify(journal, null, 2));
|
15388
15377
|
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
|
-
}
|
15393
15378
|
(0, import_hanji3.render)(
|
15394
15379
|
`[${source_default.green(
|
15395
15380
|
"\u2713"
|
@@ -15398,23 +15383,6 @@ ${sql2}
|
|
15398
15383
|
)} \u{1F680}`
|
15399
15384
|
);
|
15400
15385
|
};
|
15401
|
-
embeddedMigrations = (journal) => {
|
15402
|
-
let content = "// This file is required for Expo/React Native SQLite migrations - https://orm.drizzle.team/quick-sqlite/expo\n\n";
|
15403
|
-
content += "import journal from './meta/_journal.json';\n";
|
15404
|
-
journal.entries.forEach((entry) => {
|
15405
|
-
content += `import m${entry.idx.toString().padStart(4, "0")} from './${entry.tag}.sql';
|
15406
|
-
`;
|
15407
|
-
});
|
15408
|
-
content += `
|
15409
|
-
export default {
|
15410
|
-
journal,
|
15411
|
-
migrations: {
|
15412
|
-
${journal.entries.map((it) => `m${it.idx.toString().padStart(4, "0")}`).join(",\n")}
|
15413
|
-
}
|
15414
|
-
}
|
15415
|
-
`;
|
15416
|
-
return content;
|
15417
|
-
};
|
15418
15386
|
prepareSnapshotFolderName = () => {
|
15419
15387
|
const now = /* @__PURE__ */ new Date();
|
15420
15388
|
return `${now.getFullYear()}${two(now.getUTCMonth() + 1)}${two(
|
@@ -22358,15 +22326,15 @@ var require_pg_connection_string = __commonJS({
|
|
22358
22326
|
if (config.sslcert || config.sslkey || config.sslrootcert || config.sslmode) {
|
22359
22327
|
config.ssl = {};
|
22360
22328
|
}
|
22361
|
-
const
|
22329
|
+
const fs8 = config.sslcert || config.sslkey || config.sslrootcert ? require("fs") : null;
|
22362
22330
|
if (config.sslcert) {
|
22363
|
-
config.ssl.cert =
|
22331
|
+
config.ssl.cert = fs8.readFileSync(config.sslcert).toString();
|
22364
22332
|
}
|
22365
22333
|
if (config.sslkey) {
|
22366
|
-
config.ssl.key =
|
22334
|
+
config.ssl.key = fs8.readFileSync(config.sslkey).toString();
|
22367
22335
|
}
|
22368
22336
|
if (config.sslrootcert) {
|
22369
|
-
config.ssl.ca =
|
22337
|
+
config.ssl.ca = fs8.readFileSync(config.sslrootcert).toString();
|
22370
22338
|
}
|
22371
22339
|
switch (config.sslmode) {
|
22372
22340
|
case "disable": {
|
@@ -24150,15 +24118,15 @@ var require_lib = __commonJS({
|
|
24150
24118
|
"node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/index.js"(exports, module2) {
|
24151
24119
|
"use strict";
|
24152
24120
|
var path4 = require("path");
|
24153
|
-
var
|
24121
|
+
var fs8 = require("fs");
|
24154
24122
|
var helper = require_helper();
|
24155
24123
|
module2.exports = function(connInfo, cb) {
|
24156
24124
|
var file = helper.getFileName();
|
24157
|
-
|
24125
|
+
fs8.stat(file, function(err2, stat) {
|
24158
24126
|
if (err2 || !helper.usePgPass(stat, file)) {
|
24159
24127
|
return cb(void 0);
|
24160
24128
|
}
|
24161
|
-
var st =
|
24129
|
+
var st = fs8.createReadStream(file);
|
24162
24130
|
helper.getPassword(connInfo, st, cb);
|
24163
24131
|
});
|
24164
24132
|
};
|
@@ -44903,7 +44871,7 @@ var require_windows = __commonJS({
|
|
44903
44871
|
"node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports, module2) {
|
44904
44872
|
module2.exports = isexe;
|
44905
44873
|
isexe.sync = sync2;
|
44906
|
-
var
|
44874
|
+
var fs8 = require("fs");
|
44907
44875
|
function checkPathExt(path4, options) {
|
44908
44876
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
44909
44877
|
if (!pathext) {
|
@@ -44928,12 +44896,12 @@ var require_windows = __commonJS({
|
|
44928
44896
|
return checkPathExt(path4, options);
|
44929
44897
|
}
|
44930
44898
|
function isexe(path4, options, cb) {
|
44931
|
-
|
44899
|
+
fs8.stat(path4, function(er, stat) {
|
44932
44900
|
cb(er, er ? false : checkStat(stat, path4, options));
|
44933
44901
|
});
|
44934
44902
|
}
|
44935
44903
|
function sync2(path4, options) {
|
44936
|
-
return checkStat(
|
44904
|
+
return checkStat(fs8.statSync(path4), path4, options);
|
44937
44905
|
}
|
44938
44906
|
}
|
44939
44907
|
});
|
@@ -44943,14 +44911,14 @@ var require_mode = __commonJS({
|
|
44943
44911
|
"node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports, module2) {
|
44944
44912
|
module2.exports = isexe;
|
44945
44913
|
isexe.sync = sync2;
|
44946
|
-
var
|
44914
|
+
var fs8 = require("fs");
|
44947
44915
|
function isexe(path4, options, cb) {
|
44948
|
-
|
44916
|
+
fs8.stat(path4, function(er, stat) {
|
44949
44917
|
cb(er, er ? false : checkStat(stat, options));
|
44950
44918
|
});
|
44951
44919
|
}
|
44952
44920
|
function sync2(path4, options) {
|
44953
|
-
return checkStat(
|
44921
|
+
return checkStat(fs8.statSync(path4), options);
|
44954
44922
|
}
|
44955
44923
|
function checkStat(stat, options) {
|
44956
44924
|
return stat.isFile() && checkMode(stat, options);
|
@@ -44974,7 +44942,7 @@ var require_mode = __commonJS({
|
|
44974
44942
|
// node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
|
44975
44943
|
var require_isexe = __commonJS({
|
44976
44944
|
"node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module2) {
|
44977
|
-
var
|
44945
|
+
var fs8 = require("fs");
|
44978
44946
|
var core;
|
44979
44947
|
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
44980
44948
|
core = require_windows();
|
@@ -49917,8 +49885,8 @@ var require_utils6 = __commonJS({
|
|
49917
49885
|
exports.array = array;
|
49918
49886
|
var errno = require_errno();
|
49919
49887
|
exports.errno = errno;
|
49920
|
-
var
|
49921
|
-
exports.fs =
|
49888
|
+
var fs8 = require_fs();
|
49889
|
+
exports.fs = fs8;
|
49922
49890
|
var path4 = require_path();
|
49923
49891
|
exports.path = path4;
|
49924
49892
|
var pattern = require_pattern();
|
@@ -50102,12 +50070,12 @@ var require_fs2 = __commonJS({
|
|
50102
50070
|
"use strict";
|
50103
50071
|
Object.defineProperty(exports, "__esModule", { value: true });
|
50104
50072
|
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
|
50105
|
-
var
|
50073
|
+
var fs8 = require("fs");
|
50106
50074
|
exports.FILE_SYSTEM_ADAPTER = {
|
50107
|
-
lstat:
|
50108
|
-
stat:
|
50109
|
-
lstatSync:
|
50110
|
-
statSync:
|
50075
|
+
lstat: fs8.lstat,
|
50076
|
+
stat: fs8.stat,
|
50077
|
+
lstatSync: fs8.lstatSync,
|
50078
|
+
statSync: fs8.statSync
|
50111
50079
|
};
|
50112
50080
|
function createFileSystemAdapter(fsMethods) {
|
50113
50081
|
if (fsMethods === void 0) {
|
@@ -50124,12 +50092,12 @@ var require_settings = __commonJS({
|
|
50124
50092
|
"node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/settings.js"(exports) {
|
50125
50093
|
"use strict";
|
50126
50094
|
Object.defineProperty(exports, "__esModule", { value: true });
|
50127
|
-
var
|
50095
|
+
var fs8 = require_fs2();
|
50128
50096
|
var Settings = class {
|
50129
50097
|
constructor(_options = {}) {
|
50130
50098
|
this._options = _options;
|
50131
50099
|
this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
|
50132
|
-
this.fs =
|
50100
|
+
this.fs = fs8.createFileSystemAdapter(this._options.fs);
|
50133
50101
|
this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
|
50134
50102
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
50135
50103
|
}
|
@@ -50287,8 +50255,8 @@ var require_utils7 = __commonJS({
|
|
50287
50255
|
"use strict";
|
50288
50256
|
Object.defineProperty(exports, "__esModule", { value: true });
|
50289
50257
|
exports.fs = void 0;
|
50290
|
-
var
|
50291
|
-
exports.fs =
|
50258
|
+
var fs8 = require_fs3();
|
50259
|
+
exports.fs = fs8;
|
50292
50260
|
}
|
50293
50261
|
});
|
50294
50262
|
|
@@ -50483,14 +50451,14 @@ var require_fs4 = __commonJS({
|
|
50483
50451
|
"use strict";
|
50484
50452
|
Object.defineProperty(exports, "__esModule", { value: true });
|
50485
50453
|
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
|
50486
|
-
var
|
50454
|
+
var fs8 = require("fs");
|
50487
50455
|
exports.FILE_SYSTEM_ADAPTER = {
|
50488
|
-
lstat:
|
50489
|
-
stat:
|
50490
|
-
lstatSync:
|
50491
|
-
statSync:
|
50492
|
-
readdir:
|
50493
|
-
readdirSync:
|
50456
|
+
lstat: fs8.lstat,
|
50457
|
+
stat: fs8.stat,
|
50458
|
+
lstatSync: fs8.lstatSync,
|
50459
|
+
statSync: fs8.statSync,
|
50460
|
+
readdir: fs8.readdir,
|
50461
|
+
readdirSync: fs8.readdirSync
|
50494
50462
|
};
|
50495
50463
|
function createFileSystemAdapter(fsMethods) {
|
50496
50464
|
if (fsMethods === void 0) {
|
@@ -50509,12 +50477,12 @@ var require_settings2 = __commonJS({
|
|
50509
50477
|
Object.defineProperty(exports, "__esModule", { value: true });
|
50510
50478
|
var path4 = require("path");
|
50511
50479
|
var fsStat = require_out();
|
50512
|
-
var
|
50480
|
+
var fs8 = require_fs4();
|
50513
50481
|
var Settings = class {
|
50514
50482
|
constructor(_options = {}) {
|
50515
50483
|
this._options = _options;
|
50516
50484
|
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
|
50517
|
-
this.fs =
|
50485
|
+
this.fs = fs8.createFileSystemAdapter(this._options.fs);
|
50518
50486
|
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path4.sep);
|
50519
50487
|
this.stats = this._getValue(this._options.stats, false);
|
50520
50488
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
@@ -51830,16 +51798,16 @@ var require_settings4 = __commonJS({
|
|
51830
51798
|
"use strict";
|
51831
51799
|
Object.defineProperty(exports, "__esModule", { value: true });
|
51832
51800
|
exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
|
51833
|
-
var
|
51801
|
+
var fs8 = require("fs");
|
51834
51802
|
var os2 = require("os");
|
51835
51803
|
var CPU_COUNT = Math.max(os2.cpus().length, 1);
|
51836
51804
|
exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
|
51837
|
-
lstat:
|
51838
|
-
lstatSync:
|
51839
|
-
stat:
|
51840
|
-
statSync:
|
51841
|
-
readdir:
|
51842
|
-
readdirSync:
|
51805
|
+
lstat: fs8.lstat,
|
51806
|
+
lstatSync: fs8.lstatSync,
|
51807
|
+
stat: fs8.stat,
|
51808
|
+
statSync: fs8.statSync,
|
51809
|
+
readdir: fs8.readdir,
|
51810
|
+
readdirSync: fs8.readdirSync
|
51843
51811
|
};
|
51844
51812
|
var Settings = class {
|
51845
51813
|
constructor(_options = {}) {
|
@@ -51990,13 +51958,13 @@ var require_path_type = __commonJS({
|
|
51990
51958
|
"node_modules/.pnpm/path-type@4.0.0/node_modules/path-type/index.js"(exports) {
|
51991
51959
|
"use strict";
|
51992
51960
|
var { promisify: promisify2 } = require("util");
|
51993
|
-
var
|
51961
|
+
var fs8 = require("fs");
|
51994
51962
|
async function isType(fsStatType, statsMethodName, filePath) {
|
51995
51963
|
if (typeof filePath !== "string") {
|
51996
51964
|
throw new TypeError(`Expected a string, got ${typeof filePath}`);
|
51997
51965
|
}
|
51998
51966
|
try {
|
51999
|
-
const stats = await promisify2(
|
51967
|
+
const stats = await promisify2(fs8[fsStatType])(filePath);
|
52000
51968
|
return stats[statsMethodName]();
|
52001
51969
|
} catch (error2) {
|
52002
51970
|
if (error2.code === "ENOENT") {
|
@@ -52010,7 +51978,7 @@ var require_path_type = __commonJS({
|
|
52010
51978
|
throw new TypeError(`Expected a string, got ${typeof filePath}`);
|
52011
51979
|
}
|
52012
51980
|
try {
|
52013
|
-
return
|
51981
|
+
return fs8[fsStatType](filePath)[statsMethodName]();
|
52014
51982
|
} catch (error2) {
|
52015
51983
|
if (error2.code === "ENOENT") {
|
52016
51984
|
return false;
|
@@ -59689,14 +59657,14 @@ var require_parser2 = __commonJS({
|
|
59689
59657
|
case "scalar":
|
59690
59658
|
case "single-quoted-scalar":
|
59691
59659
|
case "double-quoted-scalar": {
|
59692
|
-
const
|
59660
|
+
const fs8 = this.flowScalar(this.type);
|
59693
59661
|
if (atNextItem || it.value) {
|
59694
|
-
map.items.push({ start, key:
|
59662
|
+
map.items.push({ start, key: fs8, sep: [] });
|
59695
59663
|
this.onKeyLine = true;
|
59696
59664
|
} else if (it.sep) {
|
59697
|
-
this.stack.push(
|
59665
|
+
this.stack.push(fs8);
|
59698
59666
|
} else {
|
59699
|
-
Object.assign(it, { key:
|
59667
|
+
Object.assign(it, { key: fs8, sep: [] });
|
59700
59668
|
this.onKeyLine = true;
|
59701
59669
|
}
|
59702
59670
|
return;
|
@@ -59815,13 +59783,13 @@ var require_parser2 = __commonJS({
|
|
59815
59783
|
case "scalar":
|
59816
59784
|
case "single-quoted-scalar":
|
59817
59785
|
case "double-quoted-scalar": {
|
59818
|
-
const
|
59786
|
+
const fs8 = this.flowScalar(this.type);
|
59819
59787
|
if (!it || it.value)
|
59820
|
-
fc.items.push({ start: [], key:
|
59788
|
+
fc.items.push({ start: [], key: fs8, sep: [] });
|
59821
59789
|
else if (it.sep)
|
59822
|
-
this.stack.push(
|
59790
|
+
this.stack.push(fs8);
|
59823
59791
|
else
|
59824
|
-
Object.assign(it, { key:
|
59792
|
+
Object.assign(it, { key: fs8, sep: [] });
|
59825
59793
|
return;
|
59826
59794
|
}
|
59827
59795
|
case "flow-map-end":
|
@@ -60372,8 +60340,8 @@ var init_studioUtils = __esm({
|
|
60372
60340
|
};
|
60373
60341
|
};
|
60374
60342
|
drizzleForSQLite = async (config, sqliteSchema2, relations4, ts, verbose) => {
|
60375
|
-
const { driver
|
60376
|
-
if (
|
60343
|
+
const { driver, dbCredentials: creds } = config;
|
60344
|
+
if (driver === "d1") {
|
60377
60345
|
const { drizzle: drizzle2 } = await Promise.resolve().then(() => (init_driver(), driver_exports));
|
60378
60346
|
const { execute: execute2 } = await Promise.resolve().then(() => (init_wrangler_client(), wrangler_client_exports));
|
60379
60347
|
const db = drizzle2(execute2, creds.wranglerConfigPath, creds.dbName, {
|
@@ -60391,7 +60359,7 @@ var init_studioUtils = __esm({
|
|
60391
60359
|
ts
|
60392
60360
|
};
|
60393
60361
|
}
|
60394
|
-
if (
|
60362
|
+
if (driver === "better-sqlite") {
|
60395
60363
|
assertPackages("better-sqlite3");
|
60396
60364
|
const { drizzle: drizzle2 } = await import("drizzle-orm/better-sqlite3");
|
60397
60365
|
const Database = await import("better-sqlite3");
|
@@ -60410,7 +60378,7 @@ var init_studioUtils = __esm({
|
|
60410
60378
|
ts
|
60411
60379
|
};
|
60412
60380
|
}
|
60413
|
-
if (
|
60381
|
+
if (driver === "libsql" || driver === "turso") {
|
60414
60382
|
assertPackages("@libsql/client");
|
60415
60383
|
const { drizzle: drizzle2 } = await import("drizzle-orm/libsql");
|
60416
60384
|
const { createClient } = await import("@libsql/client");
|
@@ -60434,7 +60402,7 @@ var init_studioUtils = __esm({
|
|
60434
60402
|
ts
|
60435
60403
|
};
|
60436
60404
|
}
|
60437
|
-
assertUnreachable(
|
60405
|
+
assertUnreachable(driver);
|
60438
60406
|
};
|
60439
60407
|
drizzleDb = async (drizzleConfig, models, logger) => {
|
60440
60408
|
if (drizzleConfig.driver === "pg") {
|
@@ -61148,8 +61116,8 @@ var init_mysql = __esm({
|
|
61148
61116
|
mysqlConnectionConfig
|
61149
61117
|
);
|
61150
61118
|
printCliConnectionIssues3 = (options) => {
|
61151
|
-
const { driver
|
61152
|
-
if (
|
61119
|
+
const { driver, uri, host, database } = options || {};
|
61120
|
+
if (driver !== "mysql2") {
|
61153
61121
|
console.log(outputs.mysql.connection.driver());
|
61154
61122
|
}
|
61155
61123
|
if (!uri && (!host || !database)) {
|
@@ -61188,7 +61156,7 @@ var init_mysql = __esm({
|
|
61188
61156
|
const {
|
61189
61157
|
out,
|
61190
61158
|
schema: schema4,
|
61191
|
-
driver
|
61159
|
+
driver,
|
61192
61160
|
schemaFilter,
|
61193
61161
|
tablesFilter,
|
61194
61162
|
breakpoints,
|
@@ -61198,7 +61166,7 @@ var init_mysql = __esm({
|
|
61198
61166
|
return {
|
61199
61167
|
out,
|
61200
61168
|
schema: schema4,
|
61201
|
-
driver
|
61169
|
+
driver,
|
61202
61170
|
schemaFilter,
|
61203
61171
|
tablesFilter,
|
61204
61172
|
breakpoints,
|
@@ -61234,13 +61202,13 @@ var init_mysql = __esm({
|
|
61234
61202
|
strict,
|
61235
61203
|
verbose,
|
61236
61204
|
schema: schema4,
|
61237
|
-
driver
|
61205
|
+
driver,
|
61238
61206
|
schemaFilter,
|
61239
61207
|
tablesFilter,
|
61240
61208
|
...rest
|
61241
61209
|
} = cliRes.data;
|
61242
61210
|
return {
|
61243
|
-
driver
|
61211
|
+
driver,
|
61244
61212
|
schema: schema4,
|
61245
61213
|
strict,
|
61246
61214
|
verbose,
|
@@ -61321,7 +61289,7 @@ var require_package = __commonJS({
|
|
61321
61289
|
// node_modules/.pnpm/dotenv@16.0.3/node_modules/dotenv/lib/main.js
|
61322
61290
|
var require_main = __commonJS({
|
61323
61291
|
"node_modules/.pnpm/dotenv@16.0.3/node_modules/dotenv/lib/main.js"(exports, module2) {
|
61324
|
-
var
|
61292
|
+
var fs8 = require("fs");
|
61325
61293
|
var path4 = require("path");
|
61326
61294
|
var os2 = require("os");
|
61327
61295
|
var packageJson = require_package();
|
@@ -61366,7 +61334,7 @@ var require_main = __commonJS({
|
|
61366
61334
|
}
|
61367
61335
|
}
|
61368
61336
|
try {
|
61369
|
-
const parsed = DotenvModule.parse(
|
61337
|
+
const parsed = DotenvModule.parse(fs8.readFileSync(dotenvPath, { encoding }));
|
61370
61338
|
Object.keys(parsed).forEach(function(key) {
|
61371
61339
|
if (!Object.prototype.hasOwnProperty.call(process.env, key)) {
|
61372
61340
|
process.env[key] = parsed[key];
|
@@ -62160,7 +62128,7 @@ __export(cli_exports, {
|
|
62160
62128
|
});
|
62161
62129
|
module.exports = __toCommonJS(cli_exports);
|
62162
62130
|
var import_commander = require("commander");
|
62163
|
-
var
|
62131
|
+
var import_fs11 = require("fs");
|
62164
62132
|
init_lib();
|
62165
62133
|
|
62166
62134
|
// src/cli/commands/check.ts
|
@@ -62401,18 +62369,13 @@ var import_fs10 = require("fs");
|
|
62401
62369
|
var import_hanji8 = __toESM(require_hanji());
|
62402
62370
|
var import_path6 = require("path");
|
62403
62371
|
init_views();
|
62404
|
-
|
62405
|
-
var import_fs11 = __toESM(require("fs"));
|
62406
|
-
var dropMigration = async ({
|
62407
|
-
out,
|
62408
|
-
bundle
|
62409
|
-
}) => {
|
62372
|
+
var dropMigration = async (out) => {
|
62410
62373
|
const metaFilePath = (0, import_path6.join)(out, "meta", "_journal.json");
|
62411
|
-
const journal = JSON.parse(
|
62374
|
+
const journal = JSON.parse(
|
62375
|
+
(0, import_fs10.readFileSync)(metaFilePath, "utf-8")
|
62376
|
+
);
|
62412
62377
|
if (journal.entries.length === 0) {
|
62413
|
-
console.log(
|
62414
|
-
`[${source_default.blue("i")}] no migration entries found in ${metaFilePath}`
|
62415
|
-
);
|
62378
|
+
console.log(`[${source_default.blue("i")}] no migration entries found in ${metaFilePath}`);
|
62416
62379
|
return;
|
62417
62380
|
}
|
62418
62381
|
const result = await (0, import_hanji8.render)(new DropMigrationView(journal.entries));
|
@@ -62424,25 +62387,11 @@ var dropMigration = async ({
|
|
62424
62387
|
entries: journal.entries.filter(Boolean)
|
62425
62388
|
};
|
62426
62389
|
const sqlFilePath = (0, import_path6.join)(out, `${result.data.tag}.sql`);
|
62427
|
-
const snapshotFilePath = (0, import_path6.join)(
|
62428
|
-
out,
|
62429
|
-
"meta",
|
62430
|
-
`${result.data.idx.toFixed(0).padStart(4, "0")}_snapshot.json`
|
62431
|
-
);
|
62390
|
+
const snapshotFilePath = (0, import_path6.join)(out, "meta", `${result.data.idx.toFixed(0).padStart(4, "0")}_snapshot.json`);
|
62432
62391
|
(0, import_fs10.rmSync)(sqlFilePath);
|
62433
62392
|
(0, import_fs10.rmSync)(snapshotFilePath);
|
62434
62393
|
(0, import_fs10.writeFileSync)(metaFilePath, JSON.stringify(resultJournal));
|
62435
|
-
|
62436
|
-
import_fs11.default.writeFileSync(
|
62437
|
-
(0, import_path6.join)(out, `migrations.js`),
|
62438
|
-
embeddedMigrations(resultJournal)
|
62439
|
-
);
|
62440
|
-
}
|
62441
|
-
console.log(
|
62442
|
-
`[${source_default.green("\u2713")}] ${source_default.bold(
|
62443
|
-
result.data.tag
|
62444
|
-
)} migration successfully dropped`
|
62445
|
-
);
|
62394
|
+
console.log(`[${source_default.green("\u2713")}] ${source_default.bold(result.data.tag)} migration successfully dropped`);
|
62446
62395
|
};
|
62447
62396
|
|
62448
62397
|
// src/cli/index.ts
|
@@ -63064,7 +63013,7 @@ var generateMysqlCommand = new import_commander.Command("generate:mysql").option
|
|
63064
63013
|
var dbPushMysqlCommand = new import_commander.Command("push:mysql").option(
|
63065
63014
|
"--config <config>",
|
63066
63015
|
"Path to a config.json file, drizzle.config.ts by default"
|
63067
|
-
).option("--schema <schema...>", "Path to a schema file or folder").option("--tablesFilter", `Table name filters`).option("--connectionString <connectionString>", "MySQL connection string").option("--driver <driver>", "
|
63016
|
+
).option("--schema <schema...>", "Path to a schema file or folder").option("--tablesFilter", `Table name filters`).option("--connectionString <connectionString>", "MySQL connection string").option("--driver <driver>", "MySQL database path").option("--connectionString <connectionString>", "MySQL connection string").option("--host <host>", "MySQL host").option("--port <port>", "MySQL port").option("--user <user>", "MySQL user").option("--password <password>", "MySQL password").option("--database <database>", "MySQL database name").option("--verbose", "Print all statements for each push").option("--strict", "Always ask for confirmation").action(async (options) => {
|
63068
63017
|
await printVersions();
|
63069
63018
|
await assertPackages("drizzle-orm");
|
63070
63019
|
await assertOrmCoreVersion();
|
@@ -63181,7 +63130,7 @@ var dbPushPgCommand = new import_commander.Command("push:pg").option(
|
|
63181
63130
|
).option("--schema <schema...>", "Path to a schema file or folder").option("--tablesFilter", `Table name filters`).option("--schemaFilters", `Schema name filters`).option(
|
63182
63131
|
"--connectionString <connectionString>",
|
63183
63132
|
"PostgreSQL connection string"
|
63184
|
-
).option("--driver <driver>", "
|
63133
|
+
).option("--driver <driver>", "PostgreSQL database path").option(
|
63185
63134
|
"--connectionString <connectionString>",
|
63186
63135
|
"PostgreSQL connection string"
|
63187
63136
|
).option("--host <host>", "PostgreSQL host").option("--port <port>", "PostgreSQL port").option("--user <user>", "PostgreSQL user").option("--password <password>", "PostgreSQL password").option("--ssl <ssl>", "Postgres ssl").option("--database <database>", "PostgreSQL database name").option("--verbose", "Print all statements for each push").option("--strict", "Always ask for confirmation").action(async (options) => {
|
@@ -63291,7 +63240,7 @@ var dbPushPgCommand = new import_commander.Command("push:pg").option(
|
|
63291
63240
|
var dbPushSqliteCommand = new import_commander.Command("push:sqlite").option(
|
63292
63241
|
"--config <config>",
|
63293
63242
|
"Path to a config.ts file, drizzle.config.ts by default"
|
63294
|
-
).option("--schema <schema>", "Path to a schema file or folder").option("--tablesFilter", `Table name filters`).option("--connectionString <connectionString>", "SQLite connection string").option("--driver <driver>", "
|
63243
|
+
).option("--schema <schema>", "Path to a schema file or folder").option("--tablesFilter", `Table name filters`).option("--connectionString <connectionString>", "SQLite connection string").option("--driver <driver>", "SQLite database path").option("--url <url>", "SQLite database path").option("--auth-token <authToken>", "SQLite database path").option("--verbose", "Print all statements for each push").option("--strict", "Always ask for confirmation").action(async (options) => {
|
63295
63244
|
printVersions();
|
63296
63245
|
assertPackages("drizzle-orm");
|
63297
63246
|
assertOrmCoreVersion();
|
@@ -63406,8 +63355,7 @@ var generateSqliteCommand = new import_commander.Command("generate:sqlite").opti
|
|
63406
63355
|
});
|
63407
63356
|
var checkSchema = objectType({
|
63408
63357
|
out: stringType().optional(),
|
63409
|
-
config: stringType().optional()
|
63410
|
-
driver: stringType().optional()
|
63358
|
+
config: stringType().optional()
|
63411
63359
|
}).strict();
|
63412
63360
|
var checkPgCommand = new import_commander.Command("check:pg").option("--out <out>", `Output folder`).option("--config <config>", `Config path [default=drizzle.config.ts]`).action(async (options) => {
|
63413
63361
|
await printVersions();
|
@@ -63513,7 +63461,7 @@ var upSqliteCommand = new import_commander.Command("up:sqlite").option("--out <o
|
|
63513
63461
|
var introspectPgCommand = new import_commander.Command("introspect:pg").option("--out <out>", `Migrations folder`).option("--breakpoints", `Prepare SQL statements with breakpoints`).option(
|
63514
63462
|
"--introspect-casing <introspectCasing>",
|
63515
63463
|
"Column object keys naming strategy"
|
63516
|
-
).option("--tablesFilter", `Table name filters`).option("--driver <driver>", "
|
63464
|
+
).option("--tablesFilter", `Table name filters`).option("--driver <driver>", "Postgres connection string").option("--connectionString <connectionString>", "Postgres connection string").option("--host <host>", "Postgres host").option("--port <port>", "Postgres port").option("--user <user>", "Postgres user").option("--password <password>", "Postgres password").option("--database <database>", "Postgres database name").option("--ssl <ssl>", "Postgres ssl").option("--config <config>", `Config path [default=drizzle.config.ts]`).action(async (options) => {
|
63517
63465
|
await printVersions();
|
63518
63466
|
await assertPackages("drizzle-orm");
|
63519
63467
|
await assertOrmCoreVersion();
|
@@ -63532,7 +63480,7 @@ var introspectPgCommand = new import_commander.Command("introspect:pg").option("
|
|
63532
63480
|
schemasFilter
|
63533
63481
|
);
|
63534
63482
|
const schemaFile = import_path7.default.join(validatedConfig.out, "schema.ts");
|
63535
|
-
(0,
|
63483
|
+
(0, import_fs11.writeFileSync)(schemaFile, ts.file);
|
63536
63484
|
console.log();
|
63537
63485
|
if (snapshots.length === 0) {
|
63538
63486
|
const { sqlStatements, _meta } = await prepareSQL(
|
@@ -63585,7 +63533,7 @@ var introspectMySqlCommand = new import_commander.Command("introspect:mysql").op
|
|
63585
63533
|
const tablesFilter = filterConfig ? typeof filterConfig === "string" ? [filterConfig] : filterConfig : [];
|
63586
63534
|
const { schema: schema4, ts } = await mysqlIntrospect2(res, tablesFilter);
|
63587
63535
|
const schemaFile = import_path7.default.join(out, "schema.ts");
|
63588
|
-
(0,
|
63536
|
+
(0, import_fs11.writeFileSync)(schemaFile, ts.file);
|
63589
63537
|
console.log();
|
63590
63538
|
if (snapshots.length === 0) {
|
63591
63539
|
const { sqlStatements, _meta } = await prepareSQL(
|
@@ -63626,7 +63574,7 @@ var introspectSQLiteCommand = new import_commander.Command("introspect:sqlite").
|
|
63626
63574
|
).option(
|
63627
63575
|
"--introspect-casing <introspectCasing>",
|
63628
63576
|
"Column object keys naming strategy"
|
63629
|
-
).option("--tablesFilter", `Table name filters`).option("--schema <schema>", `Migrations folder`).option("--out <out>", `Migrations folder`).option("--breakpoints", `Prepare SQL statements with breakpoints`).option("--driver <driver>", "
|
63577
|
+
).option("--tablesFilter", `Table name filters`).option("--schema <schema>", `Migrations folder`).option("--out <out>", `Migrations folder`).option("--breakpoints", `Prepare SQL statements with breakpoints`).option("--driver <driver>", "SQLite database path").option("--url <url>", "SQLite database url").option("--auth-token <authToken>", "SQLite database path").action(async (options) => {
|
63630
63578
|
printVersions();
|
63631
63579
|
assertPackages("drizzle-orm");
|
63632
63580
|
assertOrmCoreVersion();
|
@@ -63638,7 +63586,7 @@ var introspectSQLiteCommand = new import_commander.Command("introspect:sqlite").
|
|
63638
63586
|
const tablesFilter = filterConfig ? typeof filterConfig === "string" ? [filterConfig] : filterConfig : [];
|
63639
63587
|
const { schema: schema4, ts } = await sqliteIntrospect2(res, tablesFilter);
|
63640
63588
|
const schemaFile = import_path7.default.join(out, "schema.ts");
|
63641
|
-
(0,
|
63589
|
+
(0, import_fs11.writeFileSync)(schemaFile, ts.file);
|
63642
63590
|
console.log();
|
63643
63591
|
if (snapshots.length === 0) {
|
63644
63592
|
const { sqlStatements, _meta } = await prepareSQL(
|
@@ -63673,7 +63621,7 @@ var introspectSQLiteCommand = new import_commander.Command("introspect:sqlite").
|
|
63673
63621
|
);
|
63674
63622
|
process.exit(0);
|
63675
63623
|
});
|
63676
|
-
var dropCommand = new import_commander.Command("drop").option("--out <out>", `Output folder`).option("--
|
63624
|
+
var dropCommand = new import_commander.Command("drop").option("--out <out>", `Output folder`).option("--config <config>", `Config path [default=drizzle.config.ts]`).action(async (options) => {
|
63677
63625
|
await printVersions();
|
63678
63626
|
await assertOrmCoreVersion();
|
63679
63627
|
const collisionRes = checkCollisions(
|
@@ -63686,15 +63634,8 @@ var dropCommand = new import_commander.Command("drop").option("--out <out>", `Ou
|
|
63686
63634
|
}
|
63687
63635
|
const params = checkSchema.parse(options);
|
63688
63636
|
const out = await assertOutFolder(params);
|
63689
|
-
let bundle = false;
|
63690
|
-
if (typeof options.driver !== "undefined") {
|
63691
|
-
bundle = options.driver === "expo";
|
63692
|
-
} else {
|
63693
|
-
const drizzleConfig = await drizzleConfigFromFile(options.config);
|
63694
|
-
bundle = drizzleConfig.driver === "expo";
|
63695
|
-
}
|
63696
63637
|
assertV1OutFolder(out, "{dialect}");
|
63697
|
-
await dropMigration(
|
63638
|
+
await dropMigration(out);
|
63698
63639
|
});
|
63699
63640
|
var studioCommand = new import_commander.Command("studio").option("--port <port>", "Custom port for drizzle studio [default=4983]").option("--host <host>", "Custom host for drizzle studio [default=0.0.0.0]").option("--verbose", "Print all stataments that are executed by Studio").option("--config <config>", `Config path [default=drizzle.config.ts]`).action(async (options) => {
|
63700
63641
|
await printVersions();
|
@@ -63710,9 +63651,9 @@ var studioCommand = new import_commander.Command("studio").option("--port <port>
|
|
63710
63651
|
prepareSQLiteSchema: prepareSQLiteSchema2,
|
63711
63652
|
drizzleForSQLite: drizzleForSQLite2
|
63712
63653
|
} = await Promise.resolve().then(() => (init_studioUtils(), studioUtils_exports));
|
63713
|
-
const { driver
|
63654
|
+
const { driver, schema: schemaPath } = drizzleConfig;
|
63714
63655
|
let setup;
|
63715
|
-
if (
|
63656
|
+
if (driver === "pg") {
|
63716
63657
|
const { schemaToTypeScript: schemaToTypeScript4, relationsToTypeScript: relationsToTypeScript2 } = await Promise.resolve().then(() => (init_introspect_pg(), introspect_pg_exports));
|
63717
63658
|
const { serializePg: serializePg2 } = await Promise.resolve().then(() => (init_serializer(), serializer_exports));
|
63718
63659
|
const { schema: schema4, relations: relations4 } = await preparePgSchema2(schemaPath);
|
@@ -63730,7 +63671,7 @@ var studioCommand = new import_commander.Command("studio").option("--port <port>
|
|
63730
63671
|
},
|
63731
63672
|
Boolean(options.verbose)
|
63732
63673
|
);
|
63733
|
-
} else if (
|
63674
|
+
} else if (driver === "mysql2") {
|
63734
63675
|
const { schemaToTypeScript: schemaToTypeScript4 } = await Promise.resolve().then(() => (init_introspect_mysql(), introspect_mysql_exports));
|
63735
63676
|
const { schema: schema4, relations: relations4 } = await prepareMySqlSchema2(schemaPath);
|
63736
63677
|
const { serializeMySql: serializeMySql2 } = await Promise.resolve().then(() => (init_serializer(), serializer_exports));
|
@@ -63747,7 +63688,7 @@ var studioCommand = new import_commander.Command("studio").option("--port <port>
|
|
63747
63688
|
},
|
63748
63689
|
Boolean(options.verbose)
|
63749
63690
|
);
|
63750
|
-
} else if (
|
63691
|
+
} else if (driver === "better-sqlite" || driver === "d1" || driver === "libsql" || driver === "turso") {
|
63751
63692
|
const { schemaToTypeScript: schemaToTypeScript4 } = await Promise.resolve().then(() => (init_introspect_sqlite(), introspect_sqlite_exports));
|
63752
63693
|
const { schema: schema4, relations: relations4 } = await prepareSQLiteSchema2(schemaPath);
|
63753
63694
|
const { serializeSQLite: serializeSQLite2 } = await Promise.resolve().then(() => (init_serializer(), serializer_exports));
|
@@ -63765,7 +63706,7 @@ var studioCommand = new import_commander.Command("studio").option("--port <port>
|
|
63765
63706
|
Boolean(options.verbose)
|
63766
63707
|
);
|
63767
63708
|
} else {
|
63768
|
-
assertUnreachable(
|
63709
|
+
assertUnreachable(driver);
|
63769
63710
|
}
|
63770
63711
|
const qeueryEngine = (0, import_studio.queryEngineForSetup)(setup);
|
63771
63712
|
const server = await (0, import_server.prepareServer)((_2) => {
|
@@ -63779,7 +63720,7 @@ var studioCommand = new import_commander.Command("studio").option("--port <port>
|
|
63779
63720
|
"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"
|
63780
63721
|
)
|
63781
63722
|
);
|
63782
|
-
if (
|
63723
|
+
if (driver === "d1") {
|
63783
63724
|
console.log(
|
63784
63725
|
withStyle.fullWarning(
|
63785
63726
|
"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"
|