drizzle-kit 0.20.7-b11c289 → 0.20.7-c9519c9
Sign up to get free protection for your applications and to get access to all the features.
- package/bin.cjs +143 -201
- 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 -78
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,22 +15383,6 @@ ${sql2}
|
|
15398
15383
|
)} \u{1F680}`
|
15399
15384
|
);
|
15400
15385
|
};
|
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
|
-
};
|
15417
15386
|
prepareSnapshotFolderName = () => {
|
15418
15387
|
const now = /* @__PURE__ */ new Date();
|
15419
15388
|
return `${now.getFullYear()}${two(now.getUTCMonth() + 1)}${two(
|
@@ -22357,15 +22326,15 @@ var require_pg_connection_string = __commonJS({
|
|
22357
22326
|
if (config.sslcert || config.sslkey || config.sslrootcert || config.sslmode) {
|
22358
22327
|
config.ssl = {};
|
22359
22328
|
}
|
22360
|
-
const
|
22329
|
+
const fs8 = config.sslcert || config.sslkey || config.sslrootcert ? require("fs") : null;
|
22361
22330
|
if (config.sslcert) {
|
22362
|
-
config.ssl.cert =
|
22331
|
+
config.ssl.cert = fs8.readFileSync(config.sslcert).toString();
|
22363
22332
|
}
|
22364
22333
|
if (config.sslkey) {
|
22365
|
-
config.ssl.key =
|
22334
|
+
config.ssl.key = fs8.readFileSync(config.sslkey).toString();
|
22366
22335
|
}
|
22367
22336
|
if (config.sslrootcert) {
|
22368
|
-
config.ssl.ca =
|
22337
|
+
config.ssl.ca = fs8.readFileSync(config.sslrootcert).toString();
|
22369
22338
|
}
|
22370
22339
|
switch (config.sslmode) {
|
22371
22340
|
case "disable": {
|
@@ -24149,15 +24118,15 @@ var require_lib = __commonJS({
|
|
24149
24118
|
"node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/index.js"(exports, module2) {
|
24150
24119
|
"use strict";
|
24151
24120
|
var path4 = require("path");
|
24152
|
-
var
|
24121
|
+
var fs8 = require("fs");
|
24153
24122
|
var helper = require_helper();
|
24154
24123
|
module2.exports = function(connInfo, cb) {
|
24155
24124
|
var file = helper.getFileName();
|
24156
|
-
|
24125
|
+
fs8.stat(file, function(err2, stat) {
|
24157
24126
|
if (err2 || !helper.usePgPass(stat, file)) {
|
24158
24127
|
return cb(void 0);
|
24159
24128
|
}
|
24160
|
-
var st =
|
24129
|
+
var st = fs8.createReadStream(file);
|
24161
24130
|
helper.getPassword(connInfo, st, cb);
|
24162
24131
|
});
|
24163
24132
|
};
|
@@ -44902,7 +44871,7 @@ var require_windows = __commonJS({
|
|
44902
44871
|
"node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports, module2) {
|
44903
44872
|
module2.exports = isexe;
|
44904
44873
|
isexe.sync = sync2;
|
44905
|
-
var
|
44874
|
+
var fs8 = require("fs");
|
44906
44875
|
function checkPathExt(path4, options) {
|
44907
44876
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
44908
44877
|
if (!pathext) {
|
@@ -44927,12 +44896,12 @@ var require_windows = __commonJS({
|
|
44927
44896
|
return checkPathExt(path4, options);
|
44928
44897
|
}
|
44929
44898
|
function isexe(path4, options, cb) {
|
44930
|
-
|
44899
|
+
fs8.stat(path4, function(er, stat) {
|
44931
44900
|
cb(er, er ? false : checkStat(stat, path4, options));
|
44932
44901
|
});
|
44933
44902
|
}
|
44934
44903
|
function sync2(path4, options) {
|
44935
|
-
return checkStat(
|
44904
|
+
return checkStat(fs8.statSync(path4), path4, options);
|
44936
44905
|
}
|
44937
44906
|
}
|
44938
44907
|
});
|
@@ -44942,14 +44911,14 @@ var require_mode = __commonJS({
|
|
44942
44911
|
"node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports, module2) {
|
44943
44912
|
module2.exports = isexe;
|
44944
44913
|
isexe.sync = sync2;
|
44945
|
-
var
|
44914
|
+
var fs8 = require("fs");
|
44946
44915
|
function isexe(path4, options, cb) {
|
44947
|
-
|
44916
|
+
fs8.stat(path4, function(er, stat) {
|
44948
44917
|
cb(er, er ? false : checkStat(stat, options));
|
44949
44918
|
});
|
44950
44919
|
}
|
44951
44920
|
function sync2(path4, options) {
|
44952
|
-
return checkStat(
|
44921
|
+
return checkStat(fs8.statSync(path4), options);
|
44953
44922
|
}
|
44954
44923
|
function checkStat(stat, options) {
|
44955
44924
|
return stat.isFile() && checkMode(stat, options);
|
@@ -44973,7 +44942,7 @@ var require_mode = __commonJS({
|
|
44973
44942
|
// node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
|
44974
44943
|
var require_isexe = __commonJS({
|
44975
44944
|
"node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module2) {
|
44976
|
-
var
|
44945
|
+
var fs8 = require("fs");
|
44977
44946
|
var core;
|
44978
44947
|
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
44979
44948
|
core = require_windows();
|
@@ -49916,8 +49885,8 @@ var require_utils6 = __commonJS({
|
|
49916
49885
|
exports.array = array;
|
49917
49886
|
var errno = require_errno();
|
49918
49887
|
exports.errno = errno;
|
49919
|
-
var
|
49920
|
-
exports.fs =
|
49888
|
+
var fs8 = require_fs();
|
49889
|
+
exports.fs = fs8;
|
49921
49890
|
var path4 = require_path();
|
49922
49891
|
exports.path = path4;
|
49923
49892
|
var pattern = require_pattern();
|
@@ -50101,12 +50070,12 @@ var require_fs2 = __commonJS({
|
|
50101
50070
|
"use strict";
|
50102
50071
|
Object.defineProperty(exports, "__esModule", { value: true });
|
50103
50072
|
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
|
50104
|
-
var
|
50073
|
+
var fs8 = require("fs");
|
50105
50074
|
exports.FILE_SYSTEM_ADAPTER = {
|
50106
|
-
lstat:
|
50107
|
-
stat:
|
50108
|
-
lstatSync:
|
50109
|
-
statSync:
|
50075
|
+
lstat: fs8.lstat,
|
50076
|
+
stat: fs8.stat,
|
50077
|
+
lstatSync: fs8.lstatSync,
|
50078
|
+
statSync: fs8.statSync
|
50110
50079
|
};
|
50111
50080
|
function createFileSystemAdapter(fsMethods) {
|
50112
50081
|
if (fsMethods === void 0) {
|
@@ -50123,12 +50092,12 @@ var require_settings = __commonJS({
|
|
50123
50092
|
"node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/settings.js"(exports) {
|
50124
50093
|
"use strict";
|
50125
50094
|
Object.defineProperty(exports, "__esModule", { value: true });
|
50126
|
-
var
|
50095
|
+
var fs8 = require_fs2();
|
50127
50096
|
var Settings = class {
|
50128
50097
|
constructor(_options = {}) {
|
50129
50098
|
this._options = _options;
|
50130
50099
|
this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
|
50131
|
-
this.fs =
|
50100
|
+
this.fs = fs8.createFileSystemAdapter(this._options.fs);
|
50132
50101
|
this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
|
50133
50102
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
50134
50103
|
}
|
@@ -50286,8 +50255,8 @@ var require_utils7 = __commonJS({
|
|
50286
50255
|
"use strict";
|
50287
50256
|
Object.defineProperty(exports, "__esModule", { value: true });
|
50288
50257
|
exports.fs = void 0;
|
50289
|
-
var
|
50290
|
-
exports.fs =
|
50258
|
+
var fs8 = require_fs3();
|
50259
|
+
exports.fs = fs8;
|
50291
50260
|
}
|
50292
50261
|
});
|
50293
50262
|
|
@@ -50482,14 +50451,14 @@ var require_fs4 = __commonJS({
|
|
50482
50451
|
"use strict";
|
50483
50452
|
Object.defineProperty(exports, "__esModule", { value: true });
|
50484
50453
|
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
|
50485
|
-
var
|
50454
|
+
var fs8 = require("fs");
|
50486
50455
|
exports.FILE_SYSTEM_ADAPTER = {
|
50487
|
-
lstat:
|
50488
|
-
stat:
|
50489
|
-
lstatSync:
|
50490
|
-
statSync:
|
50491
|
-
readdir:
|
50492
|
-
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
|
50493
50462
|
};
|
50494
50463
|
function createFileSystemAdapter(fsMethods) {
|
50495
50464
|
if (fsMethods === void 0) {
|
@@ -50508,12 +50477,12 @@ var require_settings2 = __commonJS({
|
|
50508
50477
|
Object.defineProperty(exports, "__esModule", { value: true });
|
50509
50478
|
var path4 = require("path");
|
50510
50479
|
var fsStat = require_out();
|
50511
|
-
var
|
50480
|
+
var fs8 = require_fs4();
|
50512
50481
|
var Settings = class {
|
50513
50482
|
constructor(_options = {}) {
|
50514
50483
|
this._options = _options;
|
50515
50484
|
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
|
50516
|
-
this.fs =
|
50485
|
+
this.fs = fs8.createFileSystemAdapter(this._options.fs);
|
50517
50486
|
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path4.sep);
|
50518
50487
|
this.stats = this._getValue(this._options.stats, false);
|
50519
50488
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
@@ -51829,16 +51798,16 @@ var require_settings4 = __commonJS({
|
|
51829
51798
|
"use strict";
|
51830
51799
|
Object.defineProperty(exports, "__esModule", { value: true });
|
51831
51800
|
exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
|
51832
|
-
var
|
51801
|
+
var fs8 = require("fs");
|
51833
51802
|
var os2 = require("os");
|
51834
51803
|
var CPU_COUNT = Math.max(os2.cpus().length, 1);
|
51835
51804
|
exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
|
51836
|
-
lstat:
|
51837
|
-
lstatSync:
|
51838
|
-
stat:
|
51839
|
-
statSync:
|
51840
|
-
readdir:
|
51841
|
-
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
|
51842
51811
|
};
|
51843
51812
|
var Settings = class {
|
51844
51813
|
constructor(_options = {}) {
|
@@ -51989,13 +51958,13 @@ var require_path_type = __commonJS({
|
|
51989
51958
|
"node_modules/.pnpm/path-type@4.0.0/node_modules/path-type/index.js"(exports) {
|
51990
51959
|
"use strict";
|
51991
51960
|
var { promisify: promisify2 } = require("util");
|
51992
|
-
var
|
51961
|
+
var fs8 = require("fs");
|
51993
51962
|
async function isType(fsStatType, statsMethodName, filePath) {
|
51994
51963
|
if (typeof filePath !== "string") {
|
51995
51964
|
throw new TypeError(`Expected a string, got ${typeof filePath}`);
|
51996
51965
|
}
|
51997
51966
|
try {
|
51998
|
-
const stats = await promisify2(
|
51967
|
+
const stats = await promisify2(fs8[fsStatType])(filePath);
|
51999
51968
|
return stats[statsMethodName]();
|
52000
51969
|
} catch (error2) {
|
52001
51970
|
if (error2.code === "ENOENT") {
|
@@ -52009,7 +51978,7 @@ var require_path_type = __commonJS({
|
|
52009
51978
|
throw new TypeError(`Expected a string, got ${typeof filePath}`);
|
52010
51979
|
}
|
52011
51980
|
try {
|
52012
|
-
return
|
51981
|
+
return fs8[fsStatType](filePath)[statsMethodName]();
|
52013
51982
|
} catch (error2) {
|
52014
51983
|
if (error2.code === "ENOENT") {
|
52015
51984
|
return false;
|
@@ -59688,14 +59657,14 @@ var require_parser2 = __commonJS({
|
|
59688
59657
|
case "scalar":
|
59689
59658
|
case "single-quoted-scalar":
|
59690
59659
|
case "double-quoted-scalar": {
|
59691
|
-
const
|
59660
|
+
const fs8 = this.flowScalar(this.type);
|
59692
59661
|
if (atNextItem || it.value) {
|
59693
|
-
map.items.push({ start, key:
|
59662
|
+
map.items.push({ start, key: fs8, sep: [] });
|
59694
59663
|
this.onKeyLine = true;
|
59695
59664
|
} else if (it.sep) {
|
59696
|
-
this.stack.push(
|
59665
|
+
this.stack.push(fs8);
|
59697
59666
|
} else {
|
59698
|
-
Object.assign(it, { key:
|
59667
|
+
Object.assign(it, { key: fs8, sep: [] });
|
59699
59668
|
this.onKeyLine = true;
|
59700
59669
|
}
|
59701
59670
|
return;
|
@@ -59814,13 +59783,13 @@ var require_parser2 = __commonJS({
|
|
59814
59783
|
case "scalar":
|
59815
59784
|
case "single-quoted-scalar":
|
59816
59785
|
case "double-quoted-scalar": {
|
59817
|
-
const
|
59786
|
+
const fs8 = this.flowScalar(this.type);
|
59818
59787
|
if (!it || it.value)
|
59819
|
-
fc.items.push({ start: [], key:
|
59788
|
+
fc.items.push({ start: [], key: fs8, sep: [] });
|
59820
59789
|
else if (it.sep)
|
59821
|
-
this.stack.push(
|
59790
|
+
this.stack.push(fs8);
|
59822
59791
|
else
|
59823
|
-
Object.assign(it, { key:
|
59792
|
+
Object.assign(it, { key: fs8, sep: [] });
|
59824
59793
|
return;
|
59825
59794
|
}
|
59826
59795
|
case "flow-map-end":
|
@@ -60371,8 +60340,8 @@ var init_studioUtils = __esm({
|
|
60371
60340
|
};
|
60372
60341
|
};
|
60373
60342
|
drizzleForSQLite = async (config, sqliteSchema2, relations4, ts, verbose) => {
|
60374
|
-
const { driver
|
60375
|
-
if (
|
60343
|
+
const { driver, dbCredentials: creds } = config;
|
60344
|
+
if (driver === "d1") {
|
60376
60345
|
const { drizzle: drizzle2 } = await Promise.resolve().then(() => (init_driver(), driver_exports));
|
60377
60346
|
const { execute: execute2 } = await Promise.resolve().then(() => (init_wrangler_client(), wrangler_client_exports));
|
60378
60347
|
const db = drizzle2(execute2, creds.wranglerConfigPath, creds.dbName, {
|
@@ -60390,7 +60359,7 @@ var init_studioUtils = __esm({
|
|
60390
60359
|
ts
|
60391
60360
|
};
|
60392
60361
|
}
|
60393
|
-
if (
|
60362
|
+
if (driver === "better-sqlite") {
|
60394
60363
|
assertPackages("better-sqlite3");
|
60395
60364
|
const { drizzle: drizzle2 } = await import("drizzle-orm/better-sqlite3");
|
60396
60365
|
const Database = await import("better-sqlite3");
|
@@ -60409,7 +60378,7 @@ var init_studioUtils = __esm({
|
|
60409
60378
|
ts
|
60410
60379
|
};
|
60411
60380
|
}
|
60412
|
-
if (
|
60381
|
+
if (driver === "libsql" || driver === "turso") {
|
60413
60382
|
assertPackages("@libsql/client");
|
60414
60383
|
const { drizzle: drizzle2 } = await import("drizzle-orm/libsql");
|
60415
60384
|
const { createClient } = await import("@libsql/client");
|
@@ -60433,7 +60402,7 @@ var init_studioUtils = __esm({
|
|
60433
60402
|
ts
|
60434
60403
|
};
|
60435
60404
|
}
|
60436
|
-
assertUnreachable(
|
60405
|
+
assertUnreachable(driver);
|
60437
60406
|
};
|
60438
60407
|
drizzleDb = async (drizzleConfig, models, logger) => {
|
60439
60408
|
if (drizzleConfig.driver === "pg") {
|
@@ -61147,8 +61116,8 @@ var init_mysql = __esm({
|
|
61147
61116
|
mysqlConnectionConfig
|
61148
61117
|
);
|
61149
61118
|
printCliConnectionIssues3 = (options) => {
|
61150
|
-
const { driver
|
61151
|
-
if (
|
61119
|
+
const { driver, uri, host, database } = options || {};
|
61120
|
+
if (driver !== "mysql2") {
|
61152
61121
|
console.log(outputs.mysql.connection.driver());
|
61153
61122
|
}
|
61154
61123
|
if (!uri && (!host || !database)) {
|
@@ -61187,7 +61156,7 @@ var init_mysql = __esm({
|
|
61187
61156
|
const {
|
61188
61157
|
out,
|
61189
61158
|
schema: schema4,
|
61190
|
-
driver
|
61159
|
+
driver,
|
61191
61160
|
schemaFilter,
|
61192
61161
|
tablesFilter,
|
61193
61162
|
breakpoints,
|
@@ -61197,7 +61166,7 @@ var init_mysql = __esm({
|
|
61197
61166
|
return {
|
61198
61167
|
out,
|
61199
61168
|
schema: schema4,
|
61200
|
-
driver
|
61169
|
+
driver,
|
61201
61170
|
schemaFilter,
|
61202
61171
|
tablesFilter,
|
61203
61172
|
breakpoints,
|
@@ -61233,13 +61202,13 @@ var init_mysql = __esm({
|
|
61233
61202
|
strict,
|
61234
61203
|
verbose,
|
61235
61204
|
schema: schema4,
|
61236
|
-
driver
|
61205
|
+
driver,
|
61237
61206
|
schemaFilter,
|
61238
61207
|
tablesFilter,
|
61239
61208
|
...rest
|
61240
61209
|
} = cliRes.data;
|
61241
61210
|
return {
|
61242
|
-
driver
|
61211
|
+
driver,
|
61243
61212
|
schema: schema4,
|
61244
61213
|
strict,
|
61245
61214
|
verbose,
|
@@ -61320,7 +61289,7 @@ var require_package = __commonJS({
|
|
61320
61289
|
// node_modules/.pnpm/dotenv@16.0.3/node_modules/dotenv/lib/main.js
|
61321
61290
|
var require_main = __commonJS({
|
61322
61291
|
"node_modules/.pnpm/dotenv@16.0.3/node_modules/dotenv/lib/main.js"(exports, module2) {
|
61323
|
-
var
|
61292
|
+
var fs8 = require("fs");
|
61324
61293
|
var path4 = require("path");
|
61325
61294
|
var os2 = require("os");
|
61326
61295
|
var packageJson = require_package();
|
@@ -61365,7 +61334,7 @@ var require_main = __commonJS({
|
|
61365
61334
|
}
|
61366
61335
|
}
|
61367
61336
|
try {
|
61368
|
-
const parsed = DotenvModule.parse(
|
61337
|
+
const parsed = DotenvModule.parse(fs8.readFileSync(dotenvPath, { encoding }));
|
61369
61338
|
Object.keys(parsed).forEach(function(key) {
|
61370
61339
|
if (!Object.prototype.hasOwnProperty.call(process.env, key)) {
|
61371
61340
|
process.env[key] = parsed[key];
|
@@ -62159,7 +62128,7 @@ __export(cli_exports, {
|
|
62159
62128
|
});
|
62160
62129
|
module.exports = __toCommonJS(cli_exports);
|
62161
62130
|
var import_commander = require("commander");
|
62162
|
-
var
|
62131
|
+
var import_fs11 = require("fs");
|
62163
62132
|
init_lib();
|
62164
62133
|
|
62165
62134
|
// src/cli/commands/check.ts
|
@@ -62400,18 +62369,13 @@ var import_fs10 = require("fs");
|
|
62400
62369
|
var import_hanji8 = __toESM(require_hanji());
|
62401
62370
|
var import_path6 = require("path");
|
62402
62371
|
init_views();
|
62403
|
-
|
62404
|
-
var import_fs11 = __toESM(require("fs"));
|
62405
|
-
var dropMigration = async ({
|
62406
|
-
out,
|
62407
|
-
bundle
|
62408
|
-
}) => {
|
62372
|
+
var dropMigration = async (out) => {
|
62409
62373
|
const metaFilePath = (0, import_path6.join)(out, "meta", "_journal.json");
|
62410
|
-
const journal = JSON.parse(
|
62374
|
+
const journal = JSON.parse(
|
62375
|
+
(0, import_fs10.readFileSync)(metaFilePath, "utf-8")
|
62376
|
+
);
|
62411
62377
|
if (journal.entries.length === 0) {
|
62412
|
-
console.log(
|
62413
|
-
`[${source_default.blue("i")}] no migration entries found in ${metaFilePath}`
|
62414
|
-
);
|
62378
|
+
console.log(`[${source_default.blue("i")}] no migration entries found in ${metaFilePath}`);
|
62415
62379
|
return;
|
62416
62380
|
}
|
62417
62381
|
const result = await (0, import_hanji8.render)(new DropMigrationView(journal.entries));
|
@@ -62423,25 +62387,11 @@ var dropMigration = async ({
|
|
62423
62387
|
entries: journal.entries.filter(Boolean)
|
62424
62388
|
};
|
62425
62389
|
const sqlFilePath = (0, import_path6.join)(out, `${result.data.tag}.sql`);
|
62426
|
-
const snapshotFilePath = (0, import_path6.join)(
|
62427
|
-
out,
|
62428
|
-
"meta",
|
62429
|
-
`${result.data.idx.toFixed(0).padStart(4, "0")}_snapshot.json`
|
62430
|
-
);
|
62390
|
+
const snapshotFilePath = (0, import_path6.join)(out, "meta", `${result.data.idx.toFixed(0).padStart(4, "0")}_snapshot.json`);
|
62431
62391
|
(0, import_fs10.rmSync)(sqlFilePath);
|
62432
62392
|
(0, import_fs10.rmSync)(snapshotFilePath);
|
62433
62393
|
(0, import_fs10.writeFileSync)(metaFilePath, JSON.stringify(resultJournal));
|
62434
|
-
|
62435
|
-
import_fs11.default.writeFileSync(
|
62436
|
-
(0, import_path6.join)(out, `migrations.js`),
|
62437
|
-
embeddedMigrations(resultJournal)
|
62438
|
-
);
|
62439
|
-
}
|
62440
|
-
console.log(
|
62441
|
-
`[${source_default.green("\u2713")}] ${source_default.bold(
|
62442
|
-
result.data.tag
|
62443
|
-
)} migration successfully dropped`
|
62444
|
-
);
|
62394
|
+
console.log(`[${source_default.green("\u2713")}] ${source_default.bold(result.data.tag)} migration successfully dropped`);
|
62445
62395
|
};
|
62446
62396
|
|
62447
62397
|
// src/cli/index.ts
|
@@ -63063,7 +63013,7 @@ var generateMysqlCommand = new import_commander.Command("generate:mysql").option
|
|
63063
63013
|
var dbPushMysqlCommand = new import_commander.Command("push:mysql").option(
|
63064
63014
|
"--config <config>",
|
63065
63015
|
"Path to a config.json file, drizzle.config.ts by default"
|
63066
|
-
).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) => {
|
63067
63017
|
await printVersions();
|
63068
63018
|
await assertPackages("drizzle-orm");
|
63069
63019
|
await assertOrmCoreVersion();
|
@@ -63180,7 +63130,7 @@ var dbPushPgCommand = new import_commander.Command("push:pg").option(
|
|
63180
63130
|
).option("--schema <schema...>", "Path to a schema file or folder").option("--tablesFilter", `Table name filters`).option("--schemaFilters", `Schema name filters`).option(
|
63181
63131
|
"--connectionString <connectionString>",
|
63182
63132
|
"PostgreSQL connection string"
|
63183
|
-
).option("--driver <driver>", "
|
63133
|
+
).option("--driver <driver>", "PostgreSQL database path").option(
|
63184
63134
|
"--connectionString <connectionString>",
|
63185
63135
|
"PostgreSQL connection string"
|
63186
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) => {
|
@@ -63290,7 +63240,7 @@ var dbPushPgCommand = new import_commander.Command("push:pg").option(
|
|
63290
63240
|
var dbPushSqliteCommand = new import_commander.Command("push:sqlite").option(
|
63291
63241
|
"--config <config>",
|
63292
63242
|
"Path to a config.ts file, drizzle.config.ts by default"
|
63293
|
-
).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) => {
|
63294
63244
|
printVersions();
|
63295
63245
|
assertPackages("drizzle-orm");
|
63296
63246
|
assertOrmCoreVersion();
|
@@ -63405,8 +63355,7 @@ var generateSqliteCommand = new import_commander.Command("generate:sqlite").opti
|
|
63405
63355
|
});
|
63406
63356
|
var checkSchema = objectType({
|
63407
63357
|
out: stringType().optional(),
|
63408
|
-
config: stringType().optional()
|
63409
|
-
driver: stringType().optional()
|
63358
|
+
config: stringType().optional()
|
63410
63359
|
}).strict();
|
63411
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) => {
|
63412
63361
|
await printVersions();
|
@@ -63512,7 +63461,7 @@ var upSqliteCommand = new import_commander.Command("up:sqlite").option("--out <o
|
|
63512
63461
|
var introspectPgCommand = new import_commander.Command("introspect:pg").option("--out <out>", `Migrations folder`).option("--breakpoints", `Prepare SQL statements with breakpoints`).option(
|
63513
63462
|
"--introspect-casing <introspectCasing>",
|
63514
63463
|
"Column object keys naming strategy"
|
63515
|
-
).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) => {
|
63516
63465
|
await printVersions();
|
63517
63466
|
await assertPackages("drizzle-orm");
|
63518
63467
|
await assertOrmCoreVersion();
|
@@ -63531,7 +63480,7 @@ var introspectPgCommand = new import_commander.Command("introspect:pg").option("
|
|
63531
63480
|
schemasFilter
|
63532
63481
|
);
|
63533
63482
|
const schemaFile = import_path7.default.join(validatedConfig.out, "schema.ts");
|
63534
|
-
(0,
|
63483
|
+
(0, import_fs11.writeFileSync)(schemaFile, ts.file);
|
63535
63484
|
console.log();
|
63536
63485
|
if (snapshots.length === 0) {
|
63537
63486
|
const { sqlStatements, _meta } = await prepareSQL(
|
@@ -63584,7 +63533,7 @@ var introspectMySqlCommand = new import_commander.Command("introspect:mysql").op
|
|
63584
63533
|
const tablesFilter = filterConfig ? typeof filterConfig === "string" ? [filterConfig] : filterConfig : [];
|
63585
63534
|
const { schema: schema4, ts } = await mysqlIntrospect2(res, tablesFilter);
|
63586
63535
|
const schemaFile = import_path7.default.join(out, "schema.ts");
|
63587
|
-
(0,
|
63536
|
+
(0, import_fs11.writeFileSync)(schemaFile, ts.file);
|
63588
63537
|
console.log();
|
63589
63538
|
if (snapshots.length === 0) {
|
63590
63539
|
const { sqlStatements, _meta } = await prepareSQL(
|
@@ -63625,7 +63574,7 @@ var introspectSQLiteCommand = new import_commander.Command("introspect:sqlite").
|
|
63625
63574
|
).option(
|
63626
63575
|
"--introspect-casing <introspectCasing>",
|
63627
63576
|
"Column object keys naming strategy"
|
63628
|
-
).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) => {
|
63629
63578
|
printVersions();
|
63630
63579
|
assertPackages("drizzle-orm");
|
63631
63580
|
assertOrmCoreVersion();
|
@@ -63637,7 +63586,7 @@ var introspectSQLiteCommand = new import_commander.Command("introspect:sqlite").
|
|
63637
63586
|
const tablesFilter = filterConfig ? typeof filterConfig === "string" ? [filterConfig] : filterConfig : [];
|
63638
63587
|
const { schema: schema4, ts } = await sqliteIntrospect2(res, tablesFilter);
|
63639
63588
|
const schemaFile = import_path7.default.join(out, "schema.ts");
|
63640
|
-
(0,
|
63589
|
+
(0, import_fs11.writeFileSync)(schemaFile, ts.file);
|
63641
63590
|
console.log();
|
63642
63591
|
if (snapshots.length === 0) {
|
63643
63592
|
const { sqlStatements, _meta } = await prepareSQL(
|
@@ -63672,7 +63621,7 @@ var introspectSQLiteCommand = new import_commander.Command("introspect:sqlite").
|
|
63672
63621
|
);
|
63673
63622
|
process.exit(0);
|
63674
63623
|
});
|
63675
|
-
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) => {
|
63676
63625
|
await printVersions();
|
63677
63626
|
await assertOrmCoreVersion();
|
63678
63627
|
const collisionRes = checkCollisions(
|
@@ -63685,15 +63634,8 @@ var dropCommand = new import_commander.Command("drop").option("--out <out>", `Ou
|
|
63685
63634
|
}
|
63686
63635
|
const params = checkSchema.parse(options);
|
63687
63636
|
const out = await assertOutFolder(params);
|
63688
|
-
let bundle = false;
|
63689
|
-
if (typeof options.driver !== "undefined") {
|
63690
|
-
bundle = options.driver === "expo";
|
63691
|
-
} else {
|
63692
|
-
const drizzleConfig = await drizzleConfigFromFile(options.config);
|
63693
|
-
bundle = drizzleConfig.driver === "expo";
|
63694
|
-
}
|
63695
63637
|
assertV1OutFolder(out, "{dialect}");
|
63696
|
-
await dropMigration(
|
63638
|
+
await dropMigration(out);
|
63697
63639
|
});
|
63698
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) => {
|
63699
63641
|
await printVersions();
|
@@ -63709,9 +63651,9 @@ var studioCommand = new import_commander.Command("studio").option("--port <port>
|
|
63709
63651
|
prepareSQLiteSchema: prepareSQLiteSchema2,
|
63710
63652
|
drizzleForSQLite: drizzleForSQLite2
|
63711
63653
|
} = await Promise.resolve().then(() => (init_studioUtils(), studioUtils_exports));
|
63712
|
-
const { driver
|
63654
|
+
const { driver, schema: schemaPath } = drizzleConfig;
|
63713
63655
|
let setup;
|
63714
|
-
if (
|
63656
|
+
if (driver === "pg") {
|
63715
63657
|
const { schemaToTypeScript: schemaToTypeScript4, relationsToTypeScript: relationsToTypeScript2 } = await Promise.resolve().then(() => (init_introspect_pg(), introspect_pg_exports));
|
63716
63658
|
const { serializePg: serializePg2 } = await Promise.resolve().then(() => (init_serializer(), serializer_exports));
|
63717
63659
|
const { schema: schema4, relations: relations4 } = await preparePgSchema2(schemaPath);
|
@@ -63729,7 +63671,7 @@ var studioCommand = new import_commander.Command("studio").option("--port <port>
|
|
63729
63671
|
},
|
63730
63672
|
Boolean(options.verbose)
|
63731
63673
|
);
|
63732
|
-
} else if (
|
63674
|
+
} else if (driver === "mysql2") {
|
63733
63675
|
const { schemaToTypeScript: schemaToTypeScript4 } = await Promise.resolve().then(() => (init_introspect_mysql(), introspect_mysql_exports));
|
63734
63676
|
const { schema: schema4, relations: relations4 } = await prepareMySqlSchema2(schemaPath);
|
63735
63677
|
const { serializeMySql: serializeMySql2 } = await Promise.resolve().then(() => (init_serializer(), serializer_exports));
|
@@ -63746,7 +63688,7 @@ var studioCommand = new import_commander.Command("studio").option("--port <port>
|
|
63746
63688
|
},
|
63747
63689
|
Boolean(options.verbose)
|
63748
63690
|
);
|
63749
|
-
} else if (
|
63691
|
+
} else if (driver === "better-sqlite" || driver === "d1" || driver === "libsql" || driver === "turso") {
|
63750
63692
|
const { schemaToTypeScript: schemaToTypeScript4 } = await Promise.resolve().then(() => (init_introspect_sqlite(), introspect_sqlite_exports));
|
63751
63693
|
const { schema: schema4, relations: relations4 } = await prepareSQLiteSchema2(schemaPath);
|
63752
63694
|
const { serializeSQLite: serializeSQLite2 } = await Promise.resolve().then(() => (init_serializer(), serializer_exports));
|
@@ -63764,7 +63706,7 @@ var studioCommand = new import_commander.Command("studio").option("--port <port>
|
|
63764
63706
|
Boolean(options.verbose)
|
63765
63707
|
);
|
63766
63708
|
} else {
|
63767
|
-
assertUnreachable(
|
63709
|
+
assertUnreachable(driver);
|
63768
63710
|
}
|
63769
63711
|
const qeueryEngine = (0, import_studio.queryEngineForSetup)(setup);
|
63770
63712
|
const server = await (0, import_server.prepareServer)((_2) => {
|
@@ -63778,7 +63720,7 @@ var studioCommand = new import_commander.Command("studio").option("--port <port>
|
|
63778
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"
|
63779
63721
|
)
|
63780
63722
|
);
|
63781
|
-
if (
|
63723
|
+
if (driver === "d1") {
|
63782
63724
|
console.log(
|
63783
63725
|
withStyle.fullWarning(
|
63784
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"
|