drizzle-kit 0.20.7-0650f86 → 0.20.7-2e40056
Sign up to get free protection for your applications and to get access to all the features.
- package/bin.cjs +106 -75
- package/cli/commands/migrate.d.ts +1 -0
- package/package.json +1 -1
- package/utils.js +6 -2
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,
|
@@ -15123,6 +15124,7 @@ var init_migrate = __esm({
|
|
15123
15124
|
journal,
|
15124
15125
|
outFolder,
|
15125
15126
|
breakpoints: config.breakpoints,
|
15127
|
+
bundle: config.bundle,
|
15126
15128
|
type: "custom"
|
15127
15129
|
});
|
15128
15130
|
return;
|
@@ -15140,7 +15142,8 @@ var init_migrate = __esm({
|
|
15140
15142
|
journal,
|
15141
15143
|
_meta,
|
15142
15144
|
outFolder,
|
15143
|
-
breakpoints: config.breakpoints
|
15145
|
+
breakpoints: config.breakpoints,
|
15146
|
+
bundle: config.bundle
|
15144
15147
|
});
|
15145
15148
|
} catch (e) {
|
15146
15149
|
console.error(e);
|
@@ -15396,7 +15399,8 @@ ${sql2}
|
|
15396
15399
|
);
|
15397
15400
|
};
|
15398
15401
|
embeddedMigrations = (journal) => {
|
15399
|
-
let content = "
|
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";
|
15400
15404
|
journal.entries.forEach((entry) => {
|
15401
15405
|
content += `import m${entry.idx.toString().padStart(4, "0")} from './${entry.tag}.sql';
|
15402
15406
|
`;
|
@@ -22354,15 +22358,15 @@ var require_pg_connection_string = __commonJS({
|
|
22354
22358
|
if (config.sslcert || config.sslkey || config.sslrootcert || config.sslmode) {
|
22355
22359
|
config.ssl = {};
|
22356
22360
|
}
|
22357
|
-
const
|
22361
|
+
const fs9 = config.sslcert || config.sslkey || config.sslrootcert ? require("fs") : null;
|
22358
22362
|
if (config.sslcert) {
|
22359
|
-
config.ssl.cert =
|
22363
|
+
config.ssl.cert = fs9.readFileSync(config.sslcert).toString();
|
22360
22364
|
}
|
22361
22365
|
if (config.sslkey) {
|
22362
|
-
config.ssl.key =
|
22366
|
+
config.ssl.key = fs9.readFileSync(config.sslkey).toString();
|
22363
22367
|
}
|
22364
22368
|
if (config.sslrootcert) {
|
22365
|
-
config.ssl.ca =
|
22369
|
+
config.ssl.ca = fs9.readFileSync(config.sslrootcert).toString();
|
22366
22370
|
}
|
22367
22371
|
switch (config.sslmode) {
|
22368
22372
|
case "disable": {
|
@@ -24146,15 +24150,15 @@ var require_lib = __commonJS({
|
|
24146
24150
|
"node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/index.js"(exports, module2) {
|
24147
24151
|
"use strict";
|
24148
24152
|
var path4 = require("path");
|
24149
|
-
var
|
24153
|
+
var fs9 = require("fs");
|
24150
24154
|
var helper = require_helper();
|
24151
24155
|
module2.exports = function(connInfo, cb) {
|
24152
24156
|
var file = helper.getFileName();
|
24153
|
-
|
24157
|
+
fs9.stat(file, function(err2, stat) {
|
24154
24158
|
if (err2 || !helper.usePgPass(stat, file)) {
|
24155
24159
|
return cb(void 0);
|
24156
24160
|
}
|
24157
|
-
var st =
|
24161
|
+
var st = fs9.createReadStream(file);
|
24158
24162
|
helper.getPassword(connInfo, st, cb);
|
24159
24163
|
});
|
24160
24164
|
};
|
@@ -44899,7 +44903,7 @@ var require_windows = __commonJS({
|
|
44899
44903
|
"node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports, module2) {
|
44900
44904
|
module2.exports = isexe;
|
44901
44905
|
isexe.sync = sync2;
|
44902
|
-
var
|
44906
|
+
var fs9 = require("fs");
|
44903
44907
|
function checkPathExt(path4, options) {
|
44904
44908
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
44905
44909
|
if (!pathext) {
|
@@ -44924,12 +44928,12 @@ var require_windows = __commonJS({
|
|
44924
44928
|
return checkPathExt(path4, options);
|
44925
44929
|
}
|
44926
44930
|
function isexe(path4, options, cb) {
|
44927
|
-
|
44931
|
+
fs9.stat(path4, function(er, stat) {
|
44928
44932
|
cb(er, er ? false : checkStat(stat, path4, options));
|
44929
44933
|
});
|
44930
44934
|
}
|
44931
44935
|
function sync2(path4, options) {
|
44932
|
-
return checkStat(
|
44936
|
+
return checkStat(fs9.statSync(path4), path4, options);
|
44933
44937
|
}
|
44934
44938
|
}
|
44935
44939
|
});
|
@@ -44939,14 +44943,14 @@ var require_mode = __commonJS({
|
|
44939
44943
|
"node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports, module2) {
|
44940
44944
|
module2.exports = isexe;
|
44941
44945
|
isexe.sync = sync2;
|
44942
|
-
var
|
44946
|
+
var fs9 = require("fs");
|
44943
44947
|
function isexe(path4, options, cb) {
|
44944
|
-
|
44948
|
+
fs9.stat(path4, function(er, stat) {
|
44945
44949
|
cb(er, er ? false : checkStat(stat, options));
|
44946
44950
|
});
|
44947
44951
|
}
|
44948
44952
|
function sync2(path4, options) {
|
44949
|
-
return checkStat(
|
44953
|
+
return checkStat(fs9.statSync(path4), options);
|
44950
44954
|
}
|
44951
44955
|
function checkStat(stat, options) {
|
44952
44956
|
return stat.isFile() && checkMode(stat, options);
|
@@ -44970,7 +44974,7 @@ var require_mode = __commonJS({
|
|
44970
44974
|
// node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
|
44971
44975
|
var require_isexe = __commonJS({
|
44972
44976
|
"node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module2) {
|
44973
|
-
var
|
44977
|
+
var fs9 = require("fs");
|
44974
44978
|
var core;
|
44975
44979
|
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
44976
44980
|
core = require_windows();
|
@@ -49913,8 +49917,8 @@ var require_utils6 = __commonJS({
|
|
49913
49917
|
exports.array = array;
|
49914
49918
|
var errno = require_errno();
|
49915
49919
|
exports.errno = errno;
|
49916
|
-
var
|
49917
|
-
exports.fs =
|
49920
|
+
var fs9 = require_fs();
|
49921
|
+
exports.fs = fs9;
|
49918
49922
|
var path4 = require_path();
|
49919
49923
|
exports.path = path4;
|
49920
49924
|
var pattern = require_pattern();
|
@@ -50098,12 +50102,12 @@ var require_fs2 = __commonJS({
|
|
50098
50102
|
"use strict";
|
50099
50103
|
Object.defineProperty(exports, "__esModule", { value: true });
|
50100
50104
|
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
|
50101
|
-
var
|
50105
|
+
var fs9 = require("fs");
|
50102
50106
|
exports.FILE_SYSTEM_ADAPTER = {
|
50103
|
-
lstat:
|
50104
|
-
stat:
|
50105
|
-
lstatSync:
|
50106
|
-
statSync:
|
50107
|
+
lstat: fs9.lstat,
|
50108
|
+
stat: fs9.stat,
|
50109
|
+
lstatSync: fs9.lstatSync,
|
50110
|
+
statSync: fs9.statSync
|
50107
50111
|
};
|
50108
50112
|
function createFileSystemAdapter(fsMethods) {
|
50109
50113
|
if (fsMethods === void 0) {
|
@@ -50120,12 +50124,12 @@ var require_settings = __commonJS({
|
|
50120
50124
|
"node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/settings.js"(exports) {
|
50121
50125
|
"use strict";
|
50122
50126
|
Object.defineProperty(exports, "__esModule", { value: true });
|
50123
|
-
var
|
50127
|
+
var fs9 = require_fs2();
|
50124
50128
|
var Settings = class {
|
50125
50129
|
constructor(_options = {}) {
|
50126
50130
|
this._options = _options;
|
50127
50131
|
this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
|
50128
|
-
this.fs =
|
50132
|
+
this.fs = fs9.createFileSystemAdapter(this._options.fs);
|
50129
50133
|
this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
|
50130
50134
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
50131
50135
|
}
|
@@ -50283,8 +50287,8 @@ var require_utils7 = __commonJS({
|
|
50283
50287
|
"use strict";
|
50284
50288
|
Object.defineProperty(exports, "__esModule", { value: true });
|
50285
50289
|
exports.fs = void 0;
|
50286
|
-
var
|
50287
|
-
exports.fs =
|
50290
|
+
var fs9 = require_fs3();
|
50291
|
+
exports.fs = fs9;
|
50288
50292
|
}
|
50289
50293
|
});
|
50290
50294
|
|
@@ -50479,14 +50483,14 @@ var require_fs4 = __commonJS({
|
|
50479
50483
|
"use strict";
|
50480
50484
|
Object.defineProperty(exports, "__esModule", { value: true });
|
50481
50485
|
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
|
50482
|
-
var
|
50486
|
+
var fs9 = require("fs");
|
50483
50487
|
exports.FILE_SYSTEM_ADAPTER = {
|
50484
|
-
lstat:
|
50485
|
-
stat:
|
50486
|
-
lstatSync:
|
50487
|
-
statSync:
|
50488
|
-
readdir:
|
50489
|
-
readdirSync:
|
50488
|
+
lstat: fs9.lstat,
|
50489
|
+
stat: fs9.stat,
|
50490
|
+
lstatSync: fs9.lstatSync,
|
50491
|
+
statSync: fs9.statSync,
|
50492
|
+
readdir: fs9.readdir,
|
50493
|
+
readdirSync: fs9.readdirSync
|
50490
50494
|
};
|
50491
50495
|
function createFileSystemAdapter(fsMethods) {
|
50492
50496
|
if (fsMethods === void 0) {
|
@@ -50505,12 +50509,12 @@ var require_settings2 = __commonJS({
|
|
50505
50509
|
Object.defineProperty(exports, "__esModule", { value: true });
|
50506
50510
|
var path4 = require("path");
|
50507
50511
|
var fsStat = require_out();
|
50508
|
-
var
|
50512
|
+
var fs9 = require_fs4();
|
50509
50513
|
var Settings = class {
|
50510
50514
|
constructor(_options = {}) {
|
50511
50515
|
this._options = _options;
|
50512
50516
|
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
|
50513
|
-
this.fs =
|
50517
|
+
this.fs = fs9.createFileSystemAdapter(this._options.fs);
|
50514
50518
|
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path4.sep);
|
50515
50519
|
this.stats = this._getValue(this._options.stats, false);
|
50516
50520
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
@@ -51826,16 +51830,16 @@ var require_settings4 = __commonJS({
|
|
51826
51830
|
"use strict";
|
51827
51831
|
Object.defineProperty(exports, "__esModule", { value: true });
|
51828
51832
|
exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
|
51829
|
-
var
|
51833
|
+
var fs9 = require("fs");
|
51830
51834
|
var os2 = require("os");
|
51831
51835
|
var CPU_COUNT = Math.max(os2.cpus().length, 1);
|
51832
51836
|
exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
|
51833
|
-
lstat:
|
51834
|
-
lstatSync:
|
51835
|
-
stat:
|
51836
|
-
statSync:
|
51837
|
-
readdir:
|
51838
|
-
readdirSync:
|
51837
|
+
lstat: fs9.lstat,
|
51838
|
+
lstatSync: fs9.lstatSync,
|
51839
|
+
stat: fs9.stat,
|
51840
|
+
statSync: fs9.statSync,
|
51841
|
+
readdir: fs9.readdir,
|
51842
|
+
readdirSync: fs9.readdirSync
|
51839
51843
|
};
|
51840
51844
|
var Settings = class {
|
51841
51845
|
constructor(_options = {}) {
|
@@ -51986,13 +51990,13 @@ var require_path_type = __commonJS({
|
|
51986
51990
|
"node_modules/.pnpm/path-type@4.0.0/node_modules/path-type/index.js"(exports) {
|
51987
51991
|
"use strict";
|
51988
51992
|
var { promisify: promisify2 } = require("util");
|
51989
|
-
var
|
51993
|
+
var fs9 = require("fs");
|
51990
51994
|
async function isType(fsStatType, statsMethodName, filePath) {
|
51991
51995
|
if (typeof filePath !== "string") {
|
51992
51996
|
throw new TypeError(`Expected a string, got ${typeof filePath}`);
|
51993
51997
|
}
|
51994
51998
|
try {
|
51995
|
-
const stats = await promisify2(
|
51999
|
+
const stats = await promisify2(fs9[fsStatType])(filePath);
|
51996
52000
|
return stats[statsMethodName]();
|
51997
52001
|
} catch (error2) {
|
51998
52002
|
if (error2.code === "ENOENT") {
|
@@ -52006,7 +52010,7 @@ var require_path_type = __commonJS({
|
|
52006
52010
|
throw new TypeError(`Expected a string, got ${typeof filePath}`);
|
52007
52011
|
}
|
52008
52012
|
try {
|
52009
|
-
return
|
52013
|
+
return fs9[fsStatType](filePath)[statsMethodName]();
|
52010
52014
|
} catch (error2) {
|
52011
52015
|
if (error2.code === "ENOENT") {
|
52012
52016
|
return false;
|
@@ -59685,14 +59689,14 @@ var require_parser2 = __commonJS({
|
|
59685
59689
|
case "scalar":
|
59686
59690
|
case "single-quoted-scalar":
|
59687
59691
|
case "double-quoted-scalar": {
|
59688
|
-
const
|
59692
|
+
const fs9 = this.flowScalar(this.type);
|
59689
59693
|
if (atNextItem || it.value) {
|
59690
|
-
map.items.push({ start, key:
|
59694
|
+
map.items.push({ start, key: fs9, sep: [] });
|
59691
59695
|
this.onKeyLine = true;
|
59692
59696
|
} else if (it.sep) {
|
59693
|
-
this.stack.push(
|
59697
|
+
this.stack.push(fs9);
|
59694
59698
|
} else {
|
59695
|
-
Object.assign(it, { key:
|
59699
|
+
Object.assign(it, { key: fs9, sep: [] });
|
59696
59700
|
this.onKeyLine = true;
|
59697
59701
|
}
|
59698
59702
|
return;
|
@@ -59811,13 +59815,13 @@ var require_parser2 = __commonJS({
|
|
59811
59815
|
case "scalar":
|
59812
59816
|
case "single-quoted-scalar":
|
59813
59817
|
case "double-quoted-scalar": {
|
59814
|
-
const
|
59818
|
+
const fs9 = this.flowScalar(this.type);
|
59815
59819
|
if (!it || it.value)
|
59816
|
-
fc.items.push({ start: [], key:
|
59820
|
+
fc.items.push({ start: [], key: fs9, sep: [] });
|
59817
59821
|
else if (it.sep)
|
59818
|
-
this.stack.push(
|
59822
|
+
this.stack.push(fs9);
|
59819
59823
|
else
|
59820
|
-
Object.assign(it, { key:
|
59824
|
+
Object.assign(it, { key: fs9, sep: [] });
|
59821
59825
|
return;
|
59822
59826
|
}
|
59823
59827
|
case "flow-map-end":
|
@@ -61317,7 +61321,7 @@ var require_package = __commonJS({
|
|
61317
61321
|
// node_modules/.pnpm/dotenv@16.0.3/node_modules/dotenv/lib/main.js
|
61318
61322
|
var require_main = __commonJS({
|
61319
61323
|
"node_modules/.pnpm/dotenv@16.0.3/node_modules/dotenv/lib/main.js"(exports, module2) {
|
61320
|
-
var
|
61324
|
+
var fs9 = require("fs");
|
61321
61325
|
var path4 = require("path");
|
61322
61326
|
var os2 = require("os");
|
61323
61327
|
var packageJson = require_package();
|
@@ -61362,7 +61366,7 @@ var require_main = __commonJS({
|
|
61362
61366
|
}
|
61363
61367
|
}
|
61364
61368
|
try {
|
61365
|
-
const parsed = DotenvModule.parse(
|
61369
|
+
const parsed = DotenvModule.parse(fs9.readFileSync(dotenvPath, { encoding }));
|
61366
61370
|
Object.keys(parsed).forEach(function(key) {
|
61367
61371
|
if (!Object.prototype.hasOwnProperty.call(process.env, key)) {
|
61368
61372
|
process.env[key] = parsed[key];
|
@@ -62156,7 +62160,7 @@ __export(cli_exports, {
|
|
62156
62160
|
});
|
62157
62161
|
module.exports = __toCommonJS(cli_exports);
|
62158
62162
|
var import_commander = require("commander");
|
62159
|
-
var
|
62163
|
+
var import_fs12 = require("fs");
|
62160
62164
|
init_lib();
|
62161
62165
|
|
62162
62166
|
// src/cli/commands/check.ts
|
@@ -62397,13 +62401,18 @@ var import_fs10 = require("fs");
|
|
62397
62401
|
var import_hanji8 = __toESM(require_hanji());
|
62398
62402
|
var import_path6 = require("path");
|
62399
62403
|
init_views();
|
62400
|
-
|
62404
|
+
init_migrate();
|
62405
|
+
var import_fs11 = __toESM(require("fs"));
|
62406
|
+
var dropMigration = async ({
|
62407
|
+
out,
|
62408
|
+
bundle
|
62409
|
+
}) => {
|
62401
62410
|
const metaFilePath = (0, import_path6.join)(out, "meta", "_journal.json");
|
62402
|
-
const journal = JSON.parse(
|
62403
|
-
(0, import_fs10.readFileSync)(metaFilePath, "utf-8")
|
62404
|
-
);
|
62411
|
+
const journal = JSON.parse((0, import_fs10.readFileSync)(metaFilePath, "utf-8"));
|
62405
62412
|
if (journal.entries.length === 0) {
|
62406
|
-
console.log(
|
62413
|
+
console.log(
|
62414
|
+
`[${source_default.blue("i")}] no migration entries found in ${metaFilePath}`
|
62415
|
+
);
|
62407
62416
|
return;
|
62408
62417
|
}
|
62409
62418
|
const result = await (0, import_hanji8.render)(new DropMigrationView(journal.entries));
|
@@ -62415,11 +62424,25 @@ var dropMigration = async (out) => {
|
|
62415
62424
|
entries: journal.entries.filter(Boolean)
|
62416
62425
|
};
|
62417
62426
|
const sqlFilePath = (0, import_path6.join)(out, `${result.data.tag}.sql`);
|
62418
|
-
const snapshotFilePath = (0, import_path6.join)(
|
62427
|
+
const snapshotFilePath = (0, import_path6.join)(
|
62428
|
+
out,
|
62429
|
+
"meta",
|
62430
|
+
`${result.data.idx.toFixed(0).padStart(4, "0")}_snapshot.json`
|
62431
|
+
);
|
62419
62432
|
(0, import_fs10.rmSync)(sqlFilePath);
|
62420
62433
|
(0, import_fs10.rmSync)(snapshotFilePath);
|
62421
62434
|
(0, import_fs10.writeFileSync)(metaFilePath, JSON.stringify(resultJournal));
|
62422
|
-
|
62435
|
+
if (bundle) {
|
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
|
+
);
|
62423
62446
|
};
|
62424
62447
|
|
62425
62448
|
// src/cli/index.ts
|
@@ -63041,7 +63064,7 @@ var generateMysqlCommand = new import_commander.Command("generate:mysql").option
|
|
63041
63064
|
var dbPushMysqlCommand = new import_commander.Command("push:mysql").option(
|
63042
63065
|
"--config <config>",
|
63043
63066
|
"Path to a config.json file, drizzle.config.ts by default"
|
63044
|
-
).option("--schema <schema...>", "Path to a schema file or folder").option("--tablesFilter", `Table name filters`).option("--connectionString <connectionString>", "MySQL connection string").option("--driver <driver>", "
|
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>", "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) => {
|
63045
63068
|
await printVersions();
|
63046
63069
|
await assertPackages("drizzle-orm");
|
63047
63070
|
await assertOrmCoreVersion();
|
@@ -63158,7 +63181,7 @@ var dbPushPgCommand = new import_commander.Command("push:pg").option(
|
|
63158
63181
|
).option("--schema <schema...>", "Path to a schema file or folder").option("--tablesFilter", `Table name filters`).option("--schemaFilters", `Schema name filters`).option(
|
63159
63182
|
"--connectionString <connectionString>",
|
63160
63183
|
"PostgreSQL connection string"
|
63161
|
-
).option("--driver <driver>", "
|
63184
|
+
).option("--driver <driver>", "Driver used for querying the database").option(
|
63162
63185
|
"--connectionString <connectionString>",
|
63163
63186
|
"PostgreSQL connection string"
|
63164
63187
|
).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) => {
|
@@ -63268,7 +63291,7 @@ var dbPushPgCommand = new import_commander.Command("push:pg").option(
|
|
63268
63291
|
var dbPushSqliteCommand = new import_commander.Command("push:sqlite").option(
|
63269
63292
|
"--config <config>",
|
63270
63293
|
"Path to a config.ts file, drizzle.config.ts by default"
|
63271
|
-
).option("--schema <schema>", "Path to a schema file or folder").option("--tablesFilter", `Table name filters`).option("--connectionString <connectionString>", "SQLite connection string").option("--driver <driver>", "
|
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>", "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) => {
|
63272
63295
|
printVersions();
|
63273
63296
|
assertPackages("drizzle-orm");
|
63274
63297
|
assertOrmCoreVersion();
|
@@ -63383,7 +63406,8 @@ var generateSqliteCommand = new import_commander.Command("generate:sqlite").opti
|
|
63383
63406
|
});
|
63384
63407
|
var checkSchema = objectType({
|
63385
63408
|
out: stringType().optional(),
|
63386
|
-
config: stringType().optional()
|
63409
|
+
config: stringType().optional(),
|
63410
|
+
driver: stringType().optional()
|
63387
63411
|
}).strict();
|
63388
63412
|
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) => {
|
63389
63413
|
await printVersions();
|
@@ -63489,7 +63513,7 @@ var upSqliteCommand = new import_commander.Command("up:sqlite").option("--out <o
|
|
63489
63513
|
var introspectPgCommand = new import_commander.Command("introspect:pg").option("--out <out>", `Migrations folder`).option("--breakpoints", `Prepare SQL statements with breakpoints`).option(
|
63490
63514
|
"--introspect-casing <introspectCasing>",
|
63491
63515
|
"Column object keys naming strategy"
|
63492
|
-
).option("--tablesFilter", `Table name filters`).option("--driver <driver>", "
|
63516
|
+
).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) => {
|
63493
63517
|
await printVersions();
|
63494
63518
|
await assertPackages("drizzle-orm");
|
63495
63519
|
await assertOrmCoreVersion();
|
@@ -63508,7 +63532,7 @@ var introspectPgCommand = new import_commander.Command("introspect:pg").option("
|
|
63508
63532
|
schemasFilter
|
63509
63533
|
);
|
63510
63534
|
const schemaFile = import_path7.default.join(validatedConfig.out, "schema.ts");
|
63511
|
-
(0,
|
63535
|
+
(0, import_fs12.writeFileSync)(schemaFile, ts.file);
|
63512
63536
|
console.log();
|
63513
63537
|
if (snapshots.length === 0) {
|
63514
63538
|
const { sqlStatements, _meta } = await prepareSQL(
|
@@ -63561,7 +63585,7 @@ var introspectMySqlCommand = new import_commander.Command("introspect:mysql").op
|
|
63561
63585
|
const tablesFilter = filterConfig ? typeof filterConfig === "string" ? [filterConfig] : filterConfig : [];
|
63562
63586
|
const { schema: schema4, ts } = await mysqlIntrospect2(res, tablesFilter);
|
63563
63587
|
const schemaFile = import_path7.default.join(out, "schema.ts");
|
63564
|
-
(0,
|
63588
|
+
(0, import_fs12.writeFileSync)(schemaFile, ts.file);
|
63565
63589
|
console.log();
|
63566
63590
|
if (snapshots.length === 0) {
|
63567
63591
|
const { sqlStatements, _meta } = await prepareSQL(
|
@@ -63602,7 +63626,7 @@ var introspectSQLiteCommand = new import_commander.Command("introspect:sqlite").
|
|
63602
63626
|
).option(
|
63603
63627
|
"--introspect-casing <introspectCasing>",
|
63604
63628
|
"Column object keys naming strategy"
|
63605
|
-
).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>", "
|
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>", "Driver used for querying the database").option("--url <url>", "SQLite database url").option("--auth-token <authToken>", "SQLite database path").action(async (options) => {
|
63606
63630
|
printVersions();
|
63607
63631
|
assertPackages("drizzle-orm");
|
63608
63632
|
assertOrmCoreVersion();
|
@@ -63614,7 +63638,7 @@ var introspectSQLiteCommand = new import_commander.Command("introspect:sqlite").
|
|
63614
63638
|
const tablesFilter = filterConfig ? typeof filterConfig === "string" ? [filterConfig] : filterConfig : [];
|
63615
63639
|
const { schema: schema4, ts } = await sqliteIntrospect2(res, tablesFilter);
|
63616
63640
|
const schemaFile = import_path7.default.join(out, "schema.ts");
|
63617
|
-
(0,
|
63641
|
+
(0, import_fs12.writeFileSync)(schemaFile, ts.file);
|
63618
63642
|
console.log();
|
63619
63643
|
if (snapshots.length === 0) {
|
63620
63644
|
const { sqlStatements, _meta } = await prepareSQL(
|
@@ -63649,7 +63673,7 @@ var introspectSQLiteCommand = new import_commander.Command("introspect:sqlite").
|
|
63649
63673
|
);
|
63650
63674
|
process.exit(0);
|
63651
63675
|
});
|
63652
|
-
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
|
+
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) => {
|
63653
63677
|
await printVersions();
|
63654
63678
|
await assertOrmCoreVersion();
|
63655
63679
|
const collisionRes = checkCollisions(
|
@@ -63662,8 +63686,15 @@ var dropCommand = new import_commander.Command("drop").option("--out <out>", `Ou
|
|
63662
63686
|
}
|
63663
63687
|
const params = checkSchema.parse(options);
|
63664
63688
|
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
|
+
}
|
63665
63696
|
assertV1OutFolder(out, "{dialect}");
|
63666
|
-
await dropMigration(out);
|
63697
|
+
await dropMigration({ out, bundle });
|
63667
63698
|
});
|
63668
63699
|
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) => {
|
63669
63700
|
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,
|
@@ -14840,6 +14841,7 @@ var init_migrate = __esm({
|
|
14840
14841
|
journal,
|
14841
14842
|
outFolder,
|
14842
14843
|
breakpoints: config.breakpoints,
|
14844
|
+
bundle: config.bundle,
|
14843
14845
|
type: "custom"
|
14844
14846
|
});
|
14845
14847
|
return;
|
@@ -14857,7 +14859,8 @@ var init_migrate = __esm({
|
|
14857
14859
|
journal,
|
14858
14860
|
_meta,
|
14859
14861
|
outFolder,
|
14860
|
-
breakpoints: config.breakpoints
|
14862
|
+
breakpoints: config.breakpoints,
|
14863
|
+
bundle: config.bundle
|
14861
14864
|
});
|
14862
14865
|
} catch (e) {
|
14863
14866
|
console.error(e);
|
@@ -15113,7 +15116,8 @@ ${sql2}
|
|
15113
15116
|
);
|
15114
15117
|
};
|
15115
15118
|
embeddedMigrations = (journal) => {
|
15116
|
-
let content = "
|
15119
|
+
let content = "// This file is required for Expo/React Native SQLite migrations - https://orm.drizzle.team/quick-sqlite/expo\n\n";
|
15120
|
+
content += "import journal from './meta/_journal.json';\n";
|
15117
15121
|
journal.entries.forEach((entry) => {
|
15118
15122
|
content += `import m${entry.idx.toString().padStart(4, "0")} from './${entry.tag}.sql';
|
15119
15123
|
`;
|