@prisma/migrate 6.5.0-dev.1 → 6.5.0-dev.3
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/dist/CLI.js +3 -4
- package/dist/Migrate.js +6 -7
- package/dist/SchemaEngine.js +6 -7
- package/dist/bin.js +116 -146
- package/dist/{chunk-WOOPRG54.js → chunk-255BRND3.js} +7 -14
- package/dist/{chunk-75EIHNAH.js → chunk-2NMFKGXM.js} +5 -6
- package/dist/chunk-3WC4XD74.js +98 -0
- package/dist/chunk-4EV2RVXY.js +226 -0
- package/dist/{chunk-YWWOSXMY.js → chunk-4JQIX6O7.js} +7 -15
- package/dist/{chunk-M5YNQ2NP.js → chunk-6DFJIBJX.js} +5 -12
- package/dist/{chunk-SGCF5OHF.js → chunk-7CQBDP4H.js} +6 -13
- package/dist/{chunk-7IT2ZO3D.js → chunk-AHJ2N6BJ.js} +3 -9
- package/dist/chunk-C2PR6JQR.js +266 -0
- package/dist/chunk-CTPONE6G.js +65 -0
- package/dist/{chunk-DUCG3NRP.js → chunk-D74DU52C.js} +633 -806
- package/dist/{chunk-UVNSK22K.js → chunk-DDHPSYC4.js} +122 -130
- package/dist/{chunk-CUDKD32S.js → chunk-DIAO4W7O.js} +11 -17
- package/dist/{chunk-XJQP3B4W.js → chunk-DJMFXNR4.js} +7 -15
- package/dist/{chunk-V5LEZ5BX.js → chunk-DY3QUOB7.js} +634 -807
- package/dist/{chunk-YD7GG4WS.js → chunk-FRTPDRF2.js} +66 -74
- package/dist/chunk-HIFVDK2U.js +96 -0
- package/dist/chunk-I4EY55DC.js +195 -0
- package/dist/{chunk-WLJHGKMK.js → chunk-IHDN3L3R.js} +7 -8
- package/dist/{chunk-INC2OACE.js → chunk-JFKDSUIE.js} +3 -9
- package/dist/{chunk-V7DE6JTG.js → chunk-JZ75RIMZ.js} +3 -9
- package/dist/{chunk-AAATUOV6.js → chunk-L6KOIJJ5.js} +53 -59
- package/dist/{chunk-GN5BY5N2.js → chunk-LGYRZ6CV.js} +4 -10
- package/dist/chunk-LVLRGTYH.js +148 -0
- package/dist/{chunk-CQQQ436N.js → chunk-MATFO4ZW.js} +186 -200
- package/dist/{chunk-IFCV5MY4.js → chunk-OCQGHQED.js} +5 -11
- package/dist/chunk-ORL3LJOT.js +470 -0
- package/dist/{chunk-Q7ACZDDT.js → chunk-QOPTDDIH.js} +5 -12
- package/dist/chunk-QTAIWPLH.js +78 -0
- package/dist/{chunk-35LAJN5S.js → chunk-RP2N6UXA.js} +23 -29
- package/dist/chunk-RQFGRXJI.js +174 -0
- package/dist/{chunk-QBK5XTJE.js → chunk-RR6BKMNO.js} +3 -9
- package/dist/{chunk-ILJRJJ3S.js → chunk-RTGQXNX6.js} +3 -9
- package/dist/chunk-SKRR5WT4.js +76 -0
- package/dist/chunk-TM3ETZES.js +153 -0
- package/dist/{chunk-KPUNMK5W.js → chunk-TWPTG4XS.js} +5 -12
- package/dist/{chunk-6QFE3AWR.js → chunk-UP6FVCDK.js} +6 -13
- package/dist/{chunk-YKUZUAXA.js → chunk-V3ZMNXZC.js} +16 -23
- package/dist/chunk-WLPX3672.js +365 -0
- package/dist/chunk-WNH2ACJS.js +122 -0
- package/dist/chunk-XSNOKQTD.js +347 -0
- package/dist/{chunk-X6XGFLEF.js → chunk-YZVZCC3I.js} +25 -30
- package/dist/commands/DbCommand.js +3 -4
- package/dist/commands/DbDrop.js +9 -9
- package/dist/commands/DbExecute.js +7 -8
- package/dist/commands/DbPull.js +18 -19
- package/dist/commands/DbPush.js +12 -13
- package/dist/commands/DbSeed.js +4 -5
- package/dist/commands/MigrateCommand.js +3 -4
- package/dist/commands/MigrateDeploy.js +13 -14
- package/dist/commands/MigrateDev.js +17 -18
- package/dist/commands/MigrateDiff.js +8 -9
- package/dist/commands/MigrateReset.js +15 -16
- package/dist/commands/MigrateResolve.js +11 -12
- package/dist/commands/MigrateStatus.js +11 -12
- package/dist/index.js +60 -77
- package/dist/{multipart-parser-73VM3J4A.js → multipart-parser-NDLECNMN.js} +527 -561
- package/dist/utils/byline.js +5 -6
- package/dist/utils/captureStdout.js +2 -3
- package/dist/utils/countModelsAndTypes.js +2 -3
- package/dist/utils/ensureDatabaseExists.js +8 -9
- package/dist/utils/errors.js +8 -9
- package/dist/utils/flagErrors.js +5 -5
- package/dist/utils/getDatabaseVersionSafe.js +6 -7
- package/dist/utils/getSchemaPathAndPrint.js +4 -5
- package/dist/utils/handleEvaluateDataloss.js +3 -4
- package/dist/utils/introspectSql.js +6 -6
- package/dist/utils/isSchemaEmpty.js +2 -3
- package/dist/utils/printDatasource.js +3 -4
- package/dist/utils/printDatasources.js +3 -4
- package/dist/utils/printFiles.js +5 -6
- package/dist/utils/printIntrospectedSchema.js +2 -3
- package/dist/utils/printMigrationId.js +4 -5
- package/dist/utils/promptForMigrationName.js +2 -3
- package/dist/utils/removeSchemaFiles.js +2 -3
- package/dist/utils/replaceOrAddDatasource.js +2 -3
- package/dist/utils/replaceOrAddDatasource.test.js +7 -8
- package/dist/utils/saveSchemaFiles.js +2 -3
- package/dist/utils/seed.js +6 -7
- package/dist/utils/spinner.js +2 -3
- package/dist/utils/unixSocket.js +2 -3
- package/dist/views/handleViewsIO.js +2 -3
- package/package.json +6 -6
- package/dist/chunk-26XQQ4AG.js +0 -386
- package/dist/chunk-2RSEPJFX.js +0 -165
- package/dist/chunk-4B2LXK4R.js +0 -207
- package/dist/chunk-4UJBOCZJ.js +0 -130
- package/dist/chunk-5HZLCY6X.js +0 -161
- package/dist/chunk-6TE2RIPN.js +0 -80
- package/dist/chunk-7S3Q4MCN.js +0 -480
- package/dist/chunk-AOX7CJAS.js +0 -234
- package/dist/chunk-FF3526PX.js +0 -279
- package/dist/chunk-FUSFURVP.js +0 -86
- package/dist/chunk-GCTCQLOF.js +0 -365
- package/dist/chunk-K44VNAFW.js +0 -189
- package/dist/chunk-O4BT6W33.js +0 -104
- package/dist/chunk-TKAGMA5K.js +0 -72
- package/dist/chunk-U374EXYQ.js +0 -106
|
@@ -26,16 +26,14 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_L6KOIJJ5_exports = {};
|
|
30
|
+
__export(chunk_L6KOIJJ5_exports, {
|
|
31
31
|
LineStream: () => LineStream,
|
|
32
32
|
byline: () => byline,
|
|
33
33
|
createLineStream: () => createLineStream,
|
|
34
|
-
createStream: () => createStream
|
|
35
|
-
init_byline: () => init_byline
|
|
34
|
+
createStream: () => createStream
|
|
36
35
|
});
|
|
37
|
-
module.exports = __toCommonJS(
|
|
38
|
-
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
|
36
|
+
module.exports = __toCommonJS(chunk_L6KOIJJ5_exports);
|
|
39
37
|
var import_stream = __toESM(require("stream"));
|
|
40
38
|
var import_util = __toESM(require("util"));
|
|
41
39
|
function byline(readStream, options) {
|
|
@@ -74,58 +72,54 @@ function LineStream(options) {
|
|
|
74
72
|
}
|
|
75
73
|
});
|
|
76
74
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
});
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
done();
|
|
117
|
-
};
|
|
118
|
-
LineStream.prototype._flush = function(done) {
|
|
119
|
-
this._pushBuffer(this._chunkEncoding, 0, done);
|
|
120
|
-
};
|
|
121
|
-
LineStream.prototype._reencode = function(line, chunkEncoding) {
|
|
122
|
-
if (this.encoding && this.encoding != chunkEncoding) {
|
|
123
|
-
return Buffer.from(line, chunkEncoding).toString(this.encoding);
|
|
124
|
-
} else if (this.encoding) {
|
|
125
|
-
return line;
|
|
126
|
-
} else {
|
|
127
|
-
return Buffer.from(line, chunkEncoding);
|
|
75
|
+
import_util.default.inherits(LineStream, import_stream.default.Transform);
|
|
76
|
+
LineStream.prototype._transform = function(chunk, encoding, done) {
|
|
77
|
+
encoding = encoding || "utf8";
|
|
78
|
+
if (Buffer.isBuffer(chunk)) {
|
|
79
|
+
if (encoding == "buffer") {
|
|
80
|
+
chunk = chunk.toString();
|
|
81
|
+
encoding = "utf8";
|
|
82
|
+
} else {
|
|
83
|
+
chunk = chunk.toString(encoding);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
this._chunkEncoding = encoding;
|
|
87
|
+
const lines = chunk.split(/\r\n|\r|\n/g);
|
|
88
|
+
if (this._lastChunkEndedWithCR && chunk[0] == "\n") {
|
|
89
|
+
lines.shift();
|
|
90
|
+
}
|
|
91
|
+
if (this._lineBuffer.length > 0) {
|
|
92
|
+
this._lineBuffer[this._lineBuffer.length - 1] += lines[0];
|
|
93
|
+
lines.shift();
|
|
94
|
+
}
|
|
95
|
+
this._lastChunkEndedWithCR = chunk[chunk.length - 1] == "\r";
|
|
96
|
+
this._lineBuffer = this._lineBuffer.concat(lines);
|
|
97
|
+
this._pushBuffer(encoding, 1, done);
|
|
98
|
+
};
|
|
99
|
+
LineStream.prototype._pushBuffer = function(encoding, keep, done) {
|
|
100
|
+
while (this._lineBuffer.length > keep) {
|
|
101
|
+
const line = this._lineBuffer.shift();
|
|
102
|
+
if (this._keepEmptyLines || line.length > 0) {
|
|
103
|
+
if (!this.push(this._reencode(line, encoding))) {
|
|
104
|
+
const self = this;
|
|
105
|
+
setImmediate(function() {
|
|
106
|
+
self._pushBuffer(encoding, keep, done);
|
|
107
|
+
});
|
|
108
|
+
return;
|
|
128
109
|
}
|
|
129
|
-
}
|
|
110
|
+
}
|
|
130
111
|
}
|
|
131
|
-
|
|
112
|
+
done();
|
|
113
|
+
};
|
|
114
|
+
LineStream.prototype._flush = function(done) {
|
|
115
|
+
this._pushBuffer(this._chunkEncoding, 0, done);
|
|
116
|
+
};
|
|
117
|
+
LineStream.prototype._reencode = function(line, chunkEncoding) {
|
|
118
|
+
if (this.encoding && this.encoding != chunkEncoding) {
|
|
119
|
+
return Buffer.from(line, chunkEncoding).toString(this.encoding);
|
|
120
|
+
} else if (this.encoding) {
|
|
121
|
+
return line;
|
|
122
|
+
} else {
|
|
123
|
+
return Buffer.from(line, chunkEncoding);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
@@ -16,13 +16,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
21
|
-
countModelsAndTypes: () => countModelsAndTypes
|
|
22
|
-
init_countModelsAndTypes: () => init_countModelsAndTypes
|
|
19
|
+
var chunk_LGYRZ6CV_exports = {};
|
|
20
|
+
__export(chunk_LGYRZ6CV_exports, {
|
|
21
|
+
countModelsAndTypes: () => countModelsAndTypes
|
|
23
22
|
});
|
|
24
|
-
module.exports = __toCommonJS(
|
|
25
|
-
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
|
23
|
+
module.exports = __toCommonJS(chunk_LGYRZ6CV_exports);
|
|
26
24
|
function countModelsAndTypes(schemas) {
|
|
27
25
|
let modelsCount = 0;
|
|
28
26
|
let typesCount = 0;
|
|
@@ -32,7 +30,3 @@ function countModelsAndTypes(schemas) {
|
|
|
32
30
|
}
|
|
33
31
|
return { modelsCount, typesCount };
|
|
34
32
|
}
|
|
35
|
-
var init_countModelsAndTypes = (0, import_chunk_WWAWV7DQ.__esm)({
|
|
36
|
-
"src/utils/countModelsAndTypes.ts"() {
|
|
37
|
-
}
|
|
38
|
-
});
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var chunk_LVLRGTYH_exports = {};
|
|
30
|
+
__export(chunk_LVLRGTYH_exports, {
|
|
31
|
+
MigrateDeploy: () => MigrateDeploy
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(chunk_LVLRGTYH_exports);
|
|
34
|
+
var import_chunk_255BRND3 = require("./chunk-255BRND3.js");
|
|
35
|
+
var import_chunk_DDHPSYC4 = require("./chunk-DDHPSYC4.js");
|
|
36
|
+
var import_chunk_6DFJIBJX = require("./chunk-6DFJIBJX.js");
|
|
37
|
+
var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
|
|
38
|
+
var import_chunk_DJMFXNR4 = require("./chunk-DJMFXNR4.js");
|
|
39
|
+
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
40
|
+
var import_debug = __toESM(require("@prisma/debug"));
|
|
41
|
+
var import_internals = require("@prisma/internals");
|
|
42
|
+
var debug = (0, import_debug.default)("prisma:migrate:deploy");
|
|
43
|
+
var _MigrateDeploy = class _MigrateDeploy2 {
|
|
44
|
+
static new() {
|
|
45
|
+
return new _MigrateDeploy2();
|
|
46
|
+
}
|
|
47
|
+
async parse(argv, config) {
|
|
48
|
+
const args = (0, import_internals.arg)(
|
|
49
|
+
argv,
|
|
50
|
+
{
|
|
51
|
+
"--help": Boolean,
|
|
52
|
+
"-h": "--help",
|
|
53
|
+
"--schema": String,
|
|
54
|
+
"--config": String,
|
|
55
|
+
"--telemetry-information": String
|
|
56
|
+
},
|
|
57
|
+
false
|
|
58
|
+
);
|
|
59
|
+
if ((0, import_internals.isError)(args)) {
|
|
60
|
+
return this.help(args.message);
|
|
61
|
+
}
|
|
62
|
+
await (0, import_internals.checkUnsupportedDataProxy)("migrate deploy", args, config.schema, true);
|
|
63
|
+
if (args["--help"]) {
|
|
64
|
+
return this.help();
|
|
65
|
+
}
|
|
66
|
+
await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
|
|
67
|
+
const { schemaPath } = await (0, import_chunk_6DFJIBJX.getSchemaPathAndPrint)(args["--schema"], config.schema);
|
|
68
|
+
(0, import_chunk_QOPTDDIH.printDatasource)({ datasourceInfo: await (0, import_chunk_DJMFXNR4.getDatasourceInfo)({ schemaPath }) });
|
|
69
|
+
const migrate = new import_chunk_DDHPSYC4.Migrate(schemaPath);
|
|
70
|
+
try {
|
|
71
|
+
const wasDbCreated = await (0, import_chunk_DJMFXNR4.ensureDatabaseExists)("apply", schemaPath);
|
|
72
|
+
if (wasDbCreated) {
|
|
73
|
+
process.stdout.write("\n" + wasDbCreated + "\n");
|
|
74
|
+
}
|
|
75
|
+
} catch (e) {
|
|
76
|
+
process.stdout.write("\n");
|
|
77
|
+
throw e;
|
|
78
|
+
}
|
|
79
|
+
const listMigrationDirectoriesResult = await migrate.listMigrationDirectories();
|
|
80
|
+
debug({ listMigrationDirectoriesResult });
|
|
81
|
+
process.stdout.write("\n");
|
|
82
|
+
if (listMigrationDirectoriesResult.migrations.length > 0) {
|
|
83
|
+
const migrations = listMigrationDirectoriesResult.migrations;
|
|
84
|
+
process.stdout.write(
|
|
85
|
+
`${migrations.length} migration${migrations.length > 1 ? "s" : ""} found in prisma/migrations
|
|
86
|
+
`
|
|
87
|
+
);
|
|
88
|
+
} else {
|
|
89
|
+
process.stdout.write(`No migration found in prisma/migrations
|
|
90
|
+
`);
|
|
91
|
+
}
|
|
92
|
+
let migrationIds;
|
|
93
|
+
try {
|
|
94
|
+
process.stdout.write("\n");
|
|
95
|
+
const { appliedMigrationNames } = await migrate.applyMigrations();
|
|
96
|
+
migrationIds = appliedMigrationNames;
|
|
97
|
+
} finally {
|
|
98
|
+
migrate.stop();
|
|
99
|
+
}
|
|
100
|
+
process.stdout.write("\n");
|
|
101
|
+
if (migrationIds.length === 0) {
|
|
102
|
+
return (0, import_chunk_SKRR5WT4.green)(`No pending migrations to apply.`);
|
|
103
|
+
} else {
|
|
104
|
+
return `The following migration(s) have been applied:
|
|
105
|
+
|
|
106
|
+
${(0, import_chunk_255BRND3.printFilesFromMigrationIds)(
|
|
107
|
+
"migrations",
|
|
108
|
+
migrationIds,
|
|
109
|
+
{
|
|
110
|
+
"migration.sql": ""
|
|
111
|
+
}
|
|
112
|
+
)}
|
|
113
|
+
|
|
114
|
+
${(0, import_chunk_SKRR5WT4.green)("All migrations have been successfully applied.")}`;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
help(error) {
|
|
118
|
+
if (error) {
|
|
119
|
+
return new import_internals.HelpError(`
|
|
120
|
+
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
|
|
121
|
+
${_MigrateDeploy2.help}`);
|
|
122
|
+
}
|
|
123
|
+
return _MigrateDeploy2.help;
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
_MigrateDeploy.help = (0, import_internals.format)(`
|
|
127
|
+
Apply pending migrations to update the database schema in production/staging
|
|
128
|
+
|
|
129
|
+
${(0, import_chunk_SKRR5WT4.bold)("Usage")}
|
|
130
|
+
|
|
131
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate deploy [options]
|
|
132
|
+
|
|
133
|
+
${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
134
|
+
|
|
135
|
+
-h, --help Display this help message
|
|
136
|
+
--config Custom path to your Prisma config file
|
|
137
|
+
--schema Custom path to your Prisma schema
|
|
138
|
+
|
|
139
|
+
${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
140
|
+
|
|
141
|
+
Deploy your pending migrations to your production/staging database
|
|
142
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate deploy
|
|
143
|
+
|
|
144
|
+
Specify a schema
|
|
145
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate deploy --schema=./schema.prisma
|
|
146
|
+
|
|
147
|
+
`);
|
|
148
|
+
var MigrateDeploy = _MigrateDeploy;
|