drizzle-kit 0.20.7-80f4d39 → 0.20.7-b11c289
Sign up to get free protection for your applications and to get access to all the features.
- package/bin.cjs +101 -73
- package/cli/commands/migrate.d.ts +1 -0
- package/package.json +1 -1
- package/utils.js +1 -0
package/bin.cjs
CHANGED
@@ -14915,6 +14915,7 @@ var init_words = __esm({
|
|
14915
14915
|
var migrate_exports = {};
|
14916
14916
|
__export(migrate_exports, {
|
14917
14917
|
BREAKPOINT: () => BREAKPOINT,
|
14918
|
+
embeddedMigrations: () => embeddedMigrations,
|
14918
14919
|
prepareAndMigrateMySql: () => prepareAndMigrateMySql,
|
14919
14920
|
prepareAndMigratePg: () => prepareAndMigratePg,
|
14920
14921
|
prepareAndMigrateSqlite: () => prepareAndMigrateSqlite,
|
@@ -22356,15 +22357,15 @@ var require_pg_connection_string = __commonJS({
|
|
22356
22357
|
if (config.sslcert || config.sslkey || config.sslrootcert || config.sslmode) {
|
22357
22358
|
config.ssl = {};
|
22358
22359
|
}
|
22359
|
-
const
|
22360
|
+
const fs9 = config.sslcert || config.sslkey || config.sslrootcert ? require("fs") : null;
|
22360
22361
|
if (config.sslcert) {
|
22361
|
-
config.ssl.cert =
|
22362
|
+
config.ssl.cert = fs9.readFileSync(config.sslcert).toString();
|
22362
22363
|
}
|
22363
22364
|
if (config.sslkey) {
|
22364
|
-
config.ssl.key =
|
22365
|
+
config.ssl.key = fs9.readFileSync(config.sslkey).toString();
|
22365
22366
|
}
|
22366
22367
|
if (config.sslrootcert) {
|
22367
|
-
config.ssl.ca =
|
22368
|
+
config.ssl.ca = fs9.readFileSync(config.sslrootcert).toString();
|
22368
22369
|
}
|
22369
22370
|
switch (config.sslmode) {
|
22370
22371
|
case "disable": {
|
@@ -24148,15 +24149,15 @@ var require_lib = __commonJS({
|
|
24148
24149
|
"node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/index.js"(exports, module2) {
|
24149
24150
|
"use strict";
|
24150
24151
|
var path4 = require("path");
|
24151
|
-
var
|
24152
|
+
var fs9 = require("fs");
|
24152
24153
|
var helper = require_helper();
|
24153
24154
|
module2.exports = function(connInfo, cb) {
|
24154
24155
|
var file = helper.getFileName();
|
24155
|
-
|
24156
|
+
fs9.stat(file, function(err2, stat) {
|
24156
24157
|
if (err2 || !helper.usePgPass(stat, file)) {
|
24157
24158
|
return cb(void 0);
|
24158
24159
|
}
|
24159
|
-
var st =
|
24160
|
+
var st = fs9.createReadStream(file);
|
24160
24161
|
helper.getPassword(connInfo, st, cb);
|
24161
24162
|
});
|
24162
24163
|
};
|
@@ -44901,7 +44902,7 @@ var require_windows = __commonJS({
|
|
44901
44902
|
"node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports, module2) {
|
44902
44903
|
module2.exports = isexe;
|
44903
44904
|
isexe.sync = sync2;
|
44904
|
-
var
|
44905
|
+
var fs9 = require("fs");
|
44905
44906
|
function checkPathExt(path4, options) {
|
44906
44907
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
44907
44908
|
if (!pathext) {
|
@@ -44926,12 +44927,12 @@ var require_windows = __commonJS({
|
|
44926
44927
|
return checkPathExt(path4, options);
|
44927
44928
|
}
|
44928
44929
|
function isexe(path4, options, cb) {
|
44929
|
-
|
44930
|
+
fs9.stat(path4, function(er, stat) {
|
44930
44931
|
cb(er, er ? false : checkStat(stat, path4, options));
|
44931
44932
|
});
|
44932
44933
|
}
|
44933
44934
|
function sync2(path4, options) {
|
44934
|
-
return checkStat(
|
44935
|
+
return checkStat(fs9.statSync(path4), path4, options);
|
44935
44936
|
}
|
44936
44937
|
}
|
44937
44938
|
});
|
@@ -44941,14 +44942,14 @@ var require_mode = __commonJS({
|
|
44941
44942
|
"node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports, module2) {
|
44942
44943
|
module2.exports = isexe;
|
44943
44944
|
isexe.sync = sync2;
|
44944
|
-
var
|
44945
|
+
var fs9 = require("fs");
|
44945
44946
|
function isexe(path4, options, cb) {
|
44946
|
-
|
44947
|
+
fs9.stat(path4, function(er, stat) {
|
44947
44948
|
cb(er, er ? false : checkStat(stat, options));
|
44948
44949
|
});
|
44949
44950
|
}
|
44950
44951
|
function sync2(path4, options) {
|
44951
|
-
return checkStat(
|
44952
|
+
return checkStat(fs9.statSync(path4), options);
|
44952
44953
|
}
|
44953
44954
|
function checkStat(stat, options) {
|
44954
44955
|
return stat.isFile() && checkMode(stat, options);
|
@@ -44972,7 +44973,7 @@ var require_mode = __commonJS({
|
|
44972
44973
|
// node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
|
44973
44974
|
var require_isexe = __commonJS({
|
44974
44975
|
"node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module2) {
|
44975
|
-
var
|
44976
|
+
var fs9 = require("fs");
|
44976
44977
|
var core;
|
44977
44978
|
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
44978
44979
|
core = require_windows();
|
@@ -49915,8 +49916,8 @@ var require_utils6 = __commonJS({
|
|
49915
49916
|
exports.array = array;
|
49916
49917
|
var errno = require_errno();
|
49917
49918
|
exports.errno = errno;
|
49918
|
-
var
|
49919
|
-
exports.fs =
|
49919
|
+
var fs9 = require_fs();
|
49920
|
+
exports.fs = fs9;
|
49920
49921
|
var path4 = require_path();
|
49921
49922
|
exports.path = path4;
|
49922
49923
|
var pattern = require_pattern();
|
@@ -50100,12 +50101,12 @@ var require_fs2 = __commonJS({
|
|
50100
50101
|
"use strict";
|
50101
50102
|
Object.defineProperty(exports, "__esModule", { value: true });
|
50102
50103
|
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
|
50103
|
-
var
|
50104
|
+
var fs9 = require("fs");
|
50104
50105
|
exports.FILE_SYSTEM_ADAPTER = {
|
50105
|
-
lstat:
|
50106
|
-
stat:
|
50107
|
-
lstatSync:
|
50108
|
-
statSync:
|
50106
|
+
lstat: fs9.lstat,
|
50107
|
+
stat: fs9.stat,
|
50108
|
+
lstatSync: fs9.lstatSync,
|
50109
|
+
statSync: fs9.statSync
|
50109
50110
|
};
|
50110
50111
|
function createFileSystemAdapter(fsMethods) {
|
50111
50112
|
if (fsMethods === void 0) {
|
@@ -50122,12 +50123,12 @@ var require_settings = __commonJS({
|
|
50122
50123
|
"node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/settings.js"(exports) {
|
50123
50124
|
"use strict";
|
50124
50125
|
Object.defineProperty(exports, "__esModule", { value: true });
|
50125
|
-
var
|
50126
|
+
var fs9 = require_fs2();
|
50126
50127
|
var Settings = class {
|
50127
50128
|
constructor(_options = {}) {
|
50128
50129
|
this._options = _options;
|
50129
50130
|
this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
|
50130
|
-
this.fs =
|
50131
|
+
this.fs = fs9.createFileSystemAdapter(this._options.fs);
|
50131
50132
|
this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
|
50132
50133
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
50133
50134
|
}
|
@@ -50285,8 +50286,8 @@ var require_utils7 = __commonJS({
|
|
50285
50286
|
"use strict";
|
50286
50287
|
Object.defineProperty(exports, "__esModule", { value: true });
|
50287
50288
|
exports.fs = void 0;
|
50288
|
-
var
|
50289
|
-
exports.fs =
|
50289
|
+
var fs9 = require_fs3();
|
50290
|
+
exports.fs = fs9;
|
50290
50291
|
}
|
50291
50292
|
});
|
50292
50293
|
|
@@ -50481,14 +50482,14 @@ var require_fs4 = __commonJS({
|
|
50481
50482
|
"use strict";
|
50482
50483
|
Object.defineProperty(exports, "__esModule", { value: true });
|
50483
50484
|
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
|
50484
|
-
var
|
50485
|
+
var fs9 = require("fs");
|
50485
50486
|
exports.FILE_SYSTEM_ADAPTER = {
|
50486
|
-
lstat:
|
50487
|
-
stat:
|
50488
|
-
lstatSync:
|
50489
|
-
statSync:
|
50490
|
-
readdir:
|
50491
|
-
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
|
50492
50493
|
};
|
50493
50494
|
function createFileSystemAdapter(fsMethods) {
|
50494
50495
|
if (fsMethods === void 0) {
|
@@ -50507,12 +50508,12 @@ var require_settings2 = __commonJS({
|
|
50507
50508
|
Object.defineProperty(exports, "__esModule", { value: true });
|
50508
50509
|
var path4 = require("path");
|
50509
50510
|
var fsStat = require_out();
|
50510
|
-
var
|
50511
|
+
var fs9 = require_fs4();
|
50511
50512
|
var Settings = class {
|
50512
50513
|
constructor(_options = {}) {
|
50513
50514
|
this._options = _options;
|
50514
50515
|
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
|
50515
|
-
this.fs =
|
50516
|
+
this.fs = fs9.createFileSystemAdapter(this._options.fs);
|
50516
50517
|
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path4.sep);
|
50517
50518
|
this.stats = this._getValue(this._options.stats, false);
|
50518
50519
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
@@ -51828,16 +51829,16 @@ var require_settings4 = __commonJS({
|
|
51828
51829
|
"use strict";
|
51829
51830
|
Object.defineProperty(exports, "__esModule", { value: true });
|
51830
51831
|
exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
|
51831
|
-
var
|
51832
|
+
var fs9 = require("fs");
|
51832
51833
|
var os2 = require("os");
|
51833
51834
|
var CPU_COUNT = Math.max(os2.cpus().length, 1);
|
51834
51835
|
exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
|
51835
|
-
lstat:
|
51836
|
-
lstatSync:
|
51837
|
-
stat:
|
51838
|
-
statSync:
|
51839
|
-
readdir:
|
51840
|
-
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
|
51841
51842
|
};
|
51842
51843
|
var Settings = class {
|
51843
51844
|
constructor(_options = {}) {
|
@@ -51988,13 +51989,13 @@ var require_path_type = __commonJS({
|
|
51988
51989
|
"node_modules/.pnpm/path-type@4.0.0/node_modules/path-type/index.js"(exports) {
|
51989
51990
|
"use strict";
|
51990
51991
|
var { promisify: promisify2 } = require("util");
|
51991
|
-
var
|
51992
|
+
var fs9 = require("fs");
|
51992
51993
|
async function isType(fsStatType, statsMethodName, filePath) {
|
51993
51994
|
if (typeof filePath !== "string") {
|
51994
51995
|
throw new TypeError(`Expected a string, got ${typeof filePath}`);
|
51995
51996
|
}
|
51996
51997
|
try {
|
51997
|
-
const stats = await promisify2(
|
51998
|
+
const stats = await promisify2(fs9[fsStatType])(filePath);
|
51998
51999
|
return stats[statsMethodName]();
|
51999
52000
|
} catch (error2) {
|
52000
52001
|
if (error2.code === "ENOENT") {
|
@@ -52008,7 +52009,7 @@ var require_path_type = __commonJS({
|
|
52008
52009
|
throw new TypeError(`Expected a string, got ${typeof filePath}`);
|
52009
52010
|
}
|
52010
52011
|
try {
|
52011
|
-
return
|
52012
|
+
return fs9[fsStatType](filePath)[statsMethodName]();
|
52012
52013
|
} catch (error2) {
|
52013
52014
|
if (error2.code === "ENOENT") {
|
52014
52015
|
return false;
|
@@ -59687,14 +59688,14 @@ var require_parser2 = __commonJS({
|
|
59687
59688
|
case "scalar":
|
59688
59689
|
case "single-quoted-scalar":
|
59689
59690
|
case "double-quoted-scalar": {
|
59690
|
-
const
|
59691
|
+
const fs9 = this.flowScalar(this.type);
|
59691
59692
|
if (atNextItem || it.value) {
|
59692
|
-
map.items.push({ start, key:
|
59693
|
+
map.items.push({ start, key: fs9, sep: [] });
|
59693
59694
|
this.onKeyLine = true;
|
59694
59695
|
} else if (it.sep) {
|
59695
|
-
this.stack.push(
|
59696
|
+
this.stack.push(fs9);
|
59696
59697
|
} else {
|
59697
|
-
Object.assign(it, { key:
|
59698
|
+
Object.assign(it, { key: fs9, sep: [] });
|
59698
59699
|
this.onKeyLine = true;
|
59699
59700
|
}
|
59700
59701
|
return;
|
@@ -59813,13 +59814,13 @@ var require_parser2 = __commonJS({
|
|
59813
59814
|
case "scalar":
|
59814
59815
|
case "single-quoted-scalar":
|
59815
59816
|
case "double-quoted-scalar": {
|
59816
|
-
const
|
59817
|
+
const fs9 = this.flowScalar(this.type);
|
59817
59818
|
if (!it || it.value)
|
59818
|
-
fc.items.push({ start: [], key:
|
59819
|
+
fc.items.push({ start: [], key: fs9, sep: [] });
|
59819
59820
|
else if (it.sep)
|
59820
|
-
this.stack.push(
|
59821
|
+
this.stack.push(fs9);
|
59821
59822
|
else
|
59822
|
-
Object.assign(it, { key:
|
59823
|
+
Object.assign(it, { key: fs9, sep: [] });
|
59823
59824
|
return;
|
59824
59825
|
}
|
59825
59826
|
case "flow-map-end":
|
@@ -61319,7 +61320,7 @@ var require_package = __commonJS({
|
|
61319
61320
|
// node_modules/.pnpm/dotenv@16.0.3/node_modules/dotenv/lib/main.js
|
61320
61321
|
var require_main = __commonJS({
|
61321
61322
|
"node_modules/.pnpm/dotenv@16.0.3/node_modules/dotenv/lib/main.js"(exports, module2) {
|
61322
|
-
var
|
61323
|
+
var fs9 = require("fs");
|
61323
61324
|
var path4 = require("path");
|
61324
61325
|
var os2 = require("os");
|
61325
61326
|
var packageJson = require_package();
|
@@ -61364,7 +61365,7 @@ var require_main = __commonJS({
|
|
61364
61365
|
}
|
61365
61366
|
}
|
61366
61367
|
try {
|
61367
|
-
const parsed = DotenvModule.parse(
|
61368
|
+
const parsed = DotenvModule.parse(fs9.readFileSync(dotenvPath, { encoding }));
|
61368
61369
|
Object.keys(parsed).forEach(function(key) {
|
61369
61370
|
if (!Object.prototype.hasOwnProperty.call(process.env, key)) {
|
61370
61371
|
process.env[key] = parsed[key];
|
@@ -62158,7 +62159,7 @@ __export(cli_exports, {
|
|
62158
62159
|
});
|
62159
62160
|
module.exports = __toCommonJS(cli_exports);
|
62160
62161
|
var import_commander = require("commander");
|
62161
|
-
var
|
62162
|
+
var import_fs12 = require("fs");
|
62162
62163
|
init_lib();
|
62163
62164
|
|
62164
62165
|
// src/cli/commands/check.ts
|
@@ -62399,13 +62400,18 @@ var import_fs10 = require("fs");
|
|
62399
62400
|
var import_hanji8 = __toESM(require_hanji());
|
62400
62401
|
var import_path6 = require("path");
|
62401
62402
|
init_views();
|
62402
|
-
|
62403
|
+
init_migrate();
|
62404
|
+
var import_fs11 = __toESM(require("fs"));
|
62405
|
+
var dropMigration = async ({
|
62406
|
+
out,
|
62407
|
+
bundle
|
62408
|
+
}) => {
|
62403
62409
|
const metaFilePath = (0, import_path6.join)(out, "meta", "_journal.json");
|
62404
|
-
const journal = JSON.parse(
|
62405
|
-
(0, import_fs10.readFileSync)(metaFilePath, "utf-8")
|
62406
|
-
);
|
62410
|
+
const journal = JSON.parse((0, import_fs10.readFileSync)(metaFilePath, "utf-8"));
|
62407
62411
|
if (journal.entries.length === 0) {
|
62408
|
-
console.log(
|
62412
|
+
console.log(
|
62413
|
+
`[${source_default.blue("i")}] no migration entries found in ${metaFilePath}`
|
62414
|
+
);
|
62409
62415
|
return;
|
62410
62416
|
}
|
62411
62417
|
const result = await (0, import_hanji8.render)(new DropMigrationView(journal.entries));
|
@@ -62417,11 +62423,25 @@ var dropMigration = async (out) => {
|
|
62417
62423
|
entries: journal.entries.filter(Boolean)
|
62418
62424
|
};
|
62419
62425
|
const sqlFilePath = (0, import_path6.join)(out, `${result.data.tag}.sql`);
|
62420
|
-
const snapshotFilePath = (0, import_path6.join)(
|
62426
|
+
const snapshotFilePath = (0, import_path6.join)(
|
62427
|
+
out,
|
62428
|
+
"meta",
|
62429
|
+
`${result.data.idx.toFixed(0).padStart(4, "0")}_snapshot.json`
|
62430
|
+
);
|
62421
62431
|
(0, import_fs10.rmSync)(sqlFilePath);
|
62422
62432
|
(0, import_fs10.rmSync)(snapshotFilePath);
|
62423
62433
|
(0, import_fs10.writeFileSync)(metaFilePath, JSON.stringify(resultJournal));
|
62424
|
-
|
62434
|
+
if (bundle) {
|
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
|
+
);
|
62425
62445
|
};
|
62426
62446
|
|
62427
62447
|
// src/cli/index.ts
|
@@ -63043,7 +63063,7 @@ var generateMysqlCommand = new import_commander.Command("generate:mysql").option
|
|
63043
63063
|
var dbPushMysqlCommand = new import_commander.Command("push:mysql").option(
|
63044
63064
|
"--config <config>",
|
63045
63065
|
"Path to a config.json file, drizzle.config.ts by default"
|
63046
|
-
).option("--schema <schema...>", "Path to a schema file or folder").option("--tablesFilter", `Table name filters`).option("--connectionString <connectionString>", "MySQL connection string").option("--driver <driver>", "
|
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>", "Driver used for querying the database").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) => {
|
63047
63067
|
await printVersions();
|
63048
63068
|
await assertPackages("drizzle-orm");
|
63049
63069
|
await assertOrmCoreVersion();
|
@@ -63160,7 +63180,7 @@ var dbPushPgCommand = new import_commander.Command("push:pg").option(
|
|
63160
63180
|
).option("--schema <schema...>", "Path to a schema file or folder").option("--tablesFilter", `Table name filters`).option("--schemaFilters", `Schema name filters`).option(
|
63161
63181
|
"--connectionString <connectionString>",
|
63162
63182
|
"PostgreSQL connection string"
|
63163
|
-
).option("--driver <driver>", "
|
63183
|
+
).option("--driver <driver>", "Driver used for querying the database").option(
|
63164
63184
|
"--connectionString <connectionString>",
|
63165
63185
|
"PostgreSQL connection string"
|
63166
63186
|
).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) => {
|
@@ -63270,7 +63290,7 @@ var dbPushPgCommand = new import_commander.Command("push:pg").option(
|
|
63270
63290
|
var dbPushSqliteCommand = new import_commander.Command("push:sqlite").option(
|
63271
63291
|
"--config <config>",
|
63272
63292
|
"Path to a config.ts file, drizzle.config.ts by default"
|
63273
|
-
).option("--schema <schema>", "Path to a schema file or folder").option("--tablesFilter", `Table name filters`).option("--connectionString <connectionString>", "SQLite connection string").option("--driver <driver>", "
|
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>", "Driver used for querying the database").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) => {
|
63274
63294
|
printVersions();
|
63275
63295
|
assertPackages("drizzle-orm");
|
63276
63296
|
assertOrmCoreVersion();
|
@@ -63385,7 +63405,8 @@ var generateSqliteCommand = new import_commander.Command("generate:sqlite").opti
|
|
63385
63405
|
});
|
63386
63406
|
var checkSchema = objectType({
|
63387
63407
|
out: stringType().optional(),
|
63388
|
-
config: stringType().optional()
|
63408
|
+
config: stringType().optional(),
|
63409
|
+
driver: stringType().optional()
|
63389
63410
|
}).strict();
|
63390
63411
|
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) => {
|
63391
63412
|
await printVersions();
|
@@ -63491,7 +63512,7 @@ var upSqliteCommand = new import_commander.Command("up:sqlite").option("--out <o
|
|
63491
63512
|
var introspectPgCommand = new import_commander.Command("introspect:pg").option("--out <out>", `Migrations folder`).option("--breakpoints", `Prepare SQL statements with breakpoints`).option(
|
63492
63513
|
"--introspect-casing <introspectCasing>",
|
63493
63514
|
"Column object keys naming strategy"
|
63494
|
-
).option("--tablesFilter", `Table name filters`).option("--driver <driver>", "
|
63515
|
+
).option("--tablesFilter", `Table name filters`).option("--driver <driver>", "Driver used for querying the database").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) => {
|
63495
63516
|
await printVersions();
|
63496
63517
|
await assertPackages("drizzle-orm");
|
63497
63518
|
await assertOrmCoreVersion();
|
@@ -63510,7 +63531,7 @@ var introspectPgCommand = new import_commander.Command("introspect:pg").option("
|
|
63510
63531
|
schemasFilter
|
63511
63532
|
);
|
63512
63533
|
const schemaFile = import_path7.default.join(validatedConfig.out, "schema.ts");
|
63513
|
-
(0,
|
63534
|
+
(0, import_fs12.writeFileSync)(schemaFile, ts.file);
|
63514
63535
|
console.log();
|
63515
63536
|
if (snapshots.length === 0) {
|
63516
63537
|
const { sqlStatements, _meta } = await prepareSQL(
|
@@ -63563,7 +63584,7 @@ var introspectMySqlCommand = new import_commander.Command("introspect:mysql").op
|
|
63563
63584
|
const tablesFilter = filterConfig ? typeof filterConfig === "string" ? [filterConfig] : filterConfig : [];
|
63564
63585
|
const { schema: schema4, ts } = await mysqlIntrospect2(res, tablesFilter);
|
63565
63586
|
const schemaFile = import_path7.default.join(out, "schema.ts");
|
63566
|
-
(0,
|
63587
|
+
(0, import_fs12.writeFileSync)(schemaFile, ts.file);
|
63567
63588
|
console.log();
|
63568
63589
|
if (snapshots.length === 0) {
|
63569
63590
|
const { sqlStatements, _meta } = await prepareSQL(
|
@@ -63604,7 +63625,7 @@ var introspectSQLiteCommand = new import_commander.Command("introspect:sqlite").
|
|
63604
63625
|
).option(
|
63605
63626
|
"--introspect-casing <introspectCasing>",
|
63606
63627
|
"Column object keys naming strategy"
|
63607
|
-
).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>", "
|
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>", "Driver used for querying the database").option("--url <url>", "SQLite database url").option("--auth-token <authToken>", "SQLite database path").action(async (options) => {
|
63608
63629
|
printVersions();
|
63609
63630
|
assertPackages("drizzle-orm");
|
63610
63631
|
assertOrmCoreVersion();
|
@@ -63616,7 +63637,7 @@ var introspectSQLiteCommand = new import_commander.Command("introspect:sqlite").
|
|
63616
63637
|
const tablesFilter = filterConfig ? typeof filterConfig === "string" ? [filterConfig] : filterConfig : [];
|
63617
63638
|
const { schema: schema4, ts } = await sqliteIntrospect2(res, tablesFilter);
|
63618
63639
|
const schemaFile = import_path7.default.join(out, "schema.ts");
|
63619
|
-
(0,
|
63640
|
+
(0, import_fs12.writeFileSync)(schemaFile, ts.file);
|
63620
63641
|
console.log();
|
63621
63642
|
if (snapshots.length === 0) {
|
63622
63643
|
const { sqlStatements, _meta } = await prepareSQL(
|
@@ -63651,7 +63672,7 @@ var introspectSQLiteCommand = new import_commander.Command("introspect:sqlite").
|
|
63651
63672
|
);
|
63652
63673
|
process.exit(0);
|
63653
63674
|
});
|
63654
|
-
var dropCommand = new import_commander.Command("drop").option("--out <out>", `Output folder`).option("--config <config>", `Config path [default=drizzle.config.ts]`).action(async (options) => {
|
63675
|
+
var dropCommand = new import_commander.Command("drop").option("--out <out>", `Output folder`).option("--driver <driver>", `Driver used for querying the database`).option("--config <config>", `Config path [default=drizzle.config.ts]`).action(async (options) => {
|
63655
63676
|
await printVersions();
|
63656
63677
|
await assertOrmCoreVersion();
|
63657
63678
|
const collisionRes = checkCollisions(
|
@@ -63664,8 +63685,15 @@ var dropCommand = new import_commander.Command("drop").option("--out <out>", `Ou
|
|
63664
63685
|
}
|
63665
63686
|
const params = checkSchema.parse(options);
|
63666
63687
|
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
|
+
}
|
63667
63695
|
assertV1OutFolder(out, "{dialect}");
|
63668
|
-
await dropMigration(out);
|
63696
|
+
await dropMigration({ out, bundle });
|
63669
63697
|
});
|
63670
63698
|
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) => {
|
63671
63699
|
await printVersions();
|
@@ -266,4 +266,5 @@ export declare const writeResult: ({ cur, sqlStatements, journal, _meta, outFold
|
|
266
266
|
bundle?: boolean | undefined;
|
267
267
|
type?: "none" | "custom" | "introspect" | undefined;
|
268
268
|
}) => void;
|
269
|
+
export declare const embeddedMigrations: (journal: Journal) => string;
|
269
270
|
export declare const prepareSnapshotFolderName: () => string;
|
package/package.json
CHANGED
package/utils.js
CHANGED
@@ -14632,6 +14632,7 @@ var init_words = __esm({
|
|
14632
14632
|
var migrate_exports = {};
|
14633
14633
|
__export(migrate_exports, {
|
14634
14634
|
BREAKPOINT: () => BREAKPOINT,
|
14635
|
+
embeddedMigrations: () => embeddedMigrations,
|
14635
14636
|
prepareAndMigrateMySql: () => prepareAndMigrateMySql,
|
14636
14637
|
prepareAndMigratePg: () => prepareAndMigratePg,
|
14637
14638
|
prepareAndMigrateSqlite: () => prepareAndMigrateSqlite,
|