drizzle-kit 0.20.7-80f4d39 → 0.20.7-8d149c2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin.cjs +62 -58
- 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,6 +62400,8 @@ var import_fs10 = require("fs");
|
|
|
62399
62400
|
var import_hanji8 = __toESM(require_hanji());
|
|
62400
62401
|
var import_path6 = require("path");
|
|
62401
62402
|
init_views();
|
|
62403
|
+
init_migrate();
|
|
62404
|
+
var import_fs11 = __toESM(require("fs"));
|
|
62402
62405
|
var dropMigration = async (out) => {
|
|
62403
62406
|
const metaFilePath = (0, import_path6.join)(out, "meta", "_journal.json");
|
|
62404
62407
|
const journal = JSON.parse(
|
|
@@ -62421,6 +62424,7 @@ var dropMigration = async (out) => {
|
|
|
62421
62424
|
(0, import_fs10.rmSync)(sqlFilePath);
|
|
62422
62425
|
(0, import_fs10.rmSync)(snapshotFilePath);
|
|
62423
62426
|
(0, import_fs10.writeFileSync)(metaFilePath, JSON.stringify(resultJournal));
|
|
62427
|
+
import_fs11.default.writeFileSync((0, import_path6.join)(out, `migrations.js`), embeddedMigrations(resultJournal));
|
|
62424
62428
|
console.log(`[${source_default.green("\u2713")}] ${source_default.bold(result.data.tag)} migration successfully dropped`);
|
|
62425
62429
|
};
|
|
62426
62430
|
|
|
@@ -63510,7 +63514,7 @@ var introspectPgCommand = new import_commander.Command("introspect:pg").option("
|
|
|
63510
63514
|
schemasFilter
|
|
63511
63515
|
);
|
|
63512
63516
|
const schemaFile = import_path7.default.join(validatedConfig.out, "schema.ts");
|
|
63513
|
-
(0,
|
|
63517
|
+
(0, import_fs12.writeFileSync)(schemaFile, ts.file);
|
|
63514
63518
|
console.log();
|
|
63515
63519
|
if (snapshots.length === 0) {
|
|
63516
63520
|
const { sqlStatements, _meta } = await prepareSQL(
|
|
@@ -63563,7 +63567,7 @@ var introspectMySqlCommand = new import_commander.Command("introspect:mysql").op
|
|
|
63563
63567
|
const tablesFilter = filterConfig ? typeof filterConfig === "string" ? [filterConfig] : filterConfig : [];
|
|
63564
63568
|
const { schema: schema4, ts } = await mysqlIntrospect2(res, tablesFilter);
|
|
63565
63569
|
const schemaFile = import_path7.default.join(out, "schema.ts");
|
|
63566
|
-
(0,
|
|
63570
|
+
(0, import_fs12.writeFileSync)(schemaFile, ts.file);
|
|
63567
63571
|
console.log();
|
|
63568
63572
|
if (snapshots.length === 0) {
|
|
63569
63573
|
const { sqlStatements, _meta } = await prepareSQL(
|
|
@@ -63616,7 +63620,7 @@ var introspectSQLiteCommand = new import_commander.Command("introspect:sqlite").
|
|
|
63616
63620
|
const tablesFilter = filterConfig ? typeof filterConfig === "string" ? [filterConfig] : filterConfig : [];
|
|
63617
63621
|
const { schema: schema4, ts } = await sqliteIntrospect2(res, tablesFilter);
|
|
63618
63622
|
const schemaFile = import_path7.default.join(out, "schema.ts");
|
|
63619
|
-
(0,
|
|
63623
|
+
(0, import_fs12.writeFileSync)(schemaFile, ts.file);
|
|
63620
63624
|
console.log();
|
|
63621
63625
|
if (snapshots.length === 0) {
|
|
63622
63626
|
const { sqlStatements, _meta } = await prepareSQL(
|
|
@@ -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,
|