@prisma/migrate 6.6.0-dev.23 → 6.6.0-dev.25
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 -3
- package/dist/Migrate.js +6 -6
- package/dist/SchemaEngine.js +5 -5
- package/dist/bin.js +43 -43
- package/dist/{chunk-WWAWV7DQ.js → chunk-2ESYSVXG.js} +3 -27
- package/dist/{chunk-LKTTJWFT.js → chunk-2R6DII47.js} +5 -5
- package/dist/{chunk-J4DAOTRR.js → chunk-324Z6HS7.js} +41 -43
- package/dist/chunk-33LPBNDX.js +1399 -0
- package/dist/{chunk-3WTXX6CQ.js → chunk-5LKIRKDL.js} +60 -60
- package/dist/{chunk-LOGAFLCN.js → chunk-5R44VVVX.js} +29 -29
- package/dist/{chunk-RP2N6UXA.js → chunk-AI6DH66U.js} +6 -6
- package/dist/{chunk-F62CN63F.js → chunk-B4SUSDC2.js} +30 -31
- package/dist/{chunk-ODH7XYW7.js → chunk-BURHAP6O.js} +46 -48
- package/dist/{chunk-W2SZNLK4.js → chunk-EJG7GKM7.js} +37 -39
- package/dist/{chunk-5PSO7BDO.js → chunk-EJUXYFV3.js} +15 -15
- package/dist/{chunk-MREGRQDD.js → chunk-FBWTUBJC.js} +46 -45
- package/dist/{chunk-MATFO4ZW.js → chunk-G7PJKEOV.js} +33 -33
- package/dist/{chunk-PW3LNSDM.js → chunk-GPNGRJAR.js} +33 -35
- package/dist/{chunk-NAXFX7K7.js → chunk-HJFSTAJX.js} +30 -32
- package/dist/{chunk-4ZFVT4RS.js → chunk-IINN7QUV.js} +165 -190
- package/dist/{chunk-IR55GBON.js → chunk-IWC5MH4R.js} +5 -5
- package/dist/{chunk-ZOEKRXDP.js → chunk-K43RXWQY.js} +21 -18
- package/dist/{chunk-3OQIC7NW.js → chunk-KMHFSDY6.js} +43 -45
- package/dist/{chunk-255BRND3.js → chunk-KRQEFTDT.js} +6 -6
- package/dist/{chunk-VVKOFN3Y.js → chunk-LLO7YF56.js} +44 -46
- package/dist/{chunk-MKK3GSDF.js → chunk-MKS2ZJJ5.js} +5 -5
- package/dist/{chunk-VZ23KD5C.js → chunk-NGQA5JTN.js} +8 -10
- package/dist/{chunk-IY67YUOD.js → chunk-NJYZPNB4.js} +54 -56
- package/dist/{chunk-7X4MPZIO.js → chunk-NYVWWESL.js} +322 -336
- package/dist/{chunk-EGPJABTW.js → chunk-TGV6QGEF.js} +69 -69
- package/dist/{chunk-3VFKYWQZ.js → chunk-URKH6SE2.js} +73 -80
- package/dist/{chunk-DLLXDCI2.js → chunk-VAJ4VX67.js} +5 -6
- package/dist/{chunk-N5UBDQRA.js → chunk-VVP3QZ7Q.js} +21 -21
- package/dist/{chunk-DAYMMAJB.js → chunk-YBNDKPPO.js} +36 -38
- package/dist/{chunk-OCQGHQED.js → chunk-YBX7R3MT.js} +12 -12
- package/dist/{chunk-ZYT5KWQF.js → chunk-YHLTCM34.js} +323 -337
- package/dist/{chunk-A6PMXMMT.js → chunk-ZB5NPOJW.js} +13 -13
- package/dist/{chunk-V5TUSOJX.js → chunk-ZGR2WQ62.js} +38 -40
- package/dist/commands/DbCommand.js +3 -3
- package/dist/commands/DbDrop.js +3 -3
- package/dist/commands/DbExecute.js +7 -7
- package/dist/commands/DbPull.js +9 -9
- package/dist/commands/DbPush.js +7 -7
- package/dist/commands/DbSeed.js +4 -4
- package/dist/commands/MigrateCommand.js +3 -3
- package/dist/commands/MigrateDeploy.js +9 -9
- package/dist/commands/MigrateDev.js +11 -11
- package/dist/commands/MigrateDiff.js +10 -10
- package/dist/commands/MigrateReset.js +10 -10
- package/dist/commands/MigrateResolve.js +7 -7
- package/dist/commands/MigrateStatus.js +7 -7
- package/dist/index.js +46 -46
- package/dist/{multipart-parser-54WEFGGN-NLZG56KM.js → multipart-parser-ASKQAOL4-WZ47HU6G.js} +92 -125
- package/dist/{multipart-parser-NDLECNMN.js → multipart-parser-QCI3Y5IB.js} +66 -68
- package/dist/types.js +1 -1
- package/dist/{typescript-WN4QH2CP.js → typescript-2LKASCMC.js} +33 -33
- package/dist/{typescript-AILDXN3I.js → typescript-H3AVJ6KX.js} +32 -32
- package/dist/utils/byline.js +1 -1
- package/dist/utils/captureStdout.js +3 -3
- package/dist/utils/countModelsAndTypes.js +1 -1
- package/dist/utils/customColors.js +1 -1
- package/dist/utils/ensureDatabaseExists.js +1 -1
- package/dist/utils/errors.js +1 -1
- package/dist/utils/flagErrors.js +1 -1
- package/dist/utils/getDatabaseVersionSafe.js +5 -5
- package/dist/utils/getSchemaPathAndPrint.js +1 -1
- package/dist/utils/handleEvaluateDataloss.js +1 -1
- package/dist/utils/introspectSql.js +5 -5
- package/dist/utils/isSchemaEmpty.js +1 -1
- package/dist/utils/now.js +1 -1
- package/dist/utils/printDatasource.js +1 -1
- package/dist/utils/printDatasources.js +5 -5
- package/dist/utils/printFiles.js +5 -5
- package/dist/utils/printIntrospectedSchema.js +1 -1
- package/dist/utils/printMigrationId.js +1 -1
- package/dist/utils/promptForMigrationName.js +3 -3
- package/dist/utils/removeSchemaFiles.js +1 -1
- package/dist/utils/replaceOrAddDatasource.js +1 -1
- package/dist/utils/replaceOrAddDatasource.test.js +1 -1
- package/dist/utils/saveSchemaFiles.js +1 -1
- package/dist/utils/seed.js +4 -4
- package/dist/utils/setupCockroach.js +3 -3
- package/dist/utils/setupMSSQL.js +759 -675
- package/dist/utils/setupMongo.js +552 -552
- package/dist/utils/setupMysql.js +508 -563
- package/dist/utils/setupPostgres.js +3 -3
- package/dist/utils/spinner.js +4 -4
- package/dist/utils/unixSocket.js +1 -1
- package/dist/views/handleViewsIO.js +3 -3
- package/package.json +6 -6
- package/dist/chunk-YYPMC5FN.js +0 -1407
|
@@ -26,16 +26,15 @@ 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_K43RXWQY_exports = {};
|
|
30
|
+
__export(chunk_K43RXWQY_exports, {
|
|
31
31
|
EngineError: () => EngineError,
|
|
32
32
|
SchemaEngine: () => SchemaEngine
|
|
33
33
|
});
|
|
34
|
-
module.exports = __toCommonJS(
|
|
35
|
-
var
|
|
34
|
+
module.exports = __toCommonJS(chunk_K43RXWQY_exports);
|
|
35
|
+
var import_chunk_G7PJKEOV = require("./chunk-G7PJKEOV.js");
|
|
36
36
|
var import_chunk_L6KOIJJ5 = require("./chunk-L6KOIJJ5.js");
|
|
37
37
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
38
|
-
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
|
39
38
|
var import_node_path = __toESM(require("node:path"));
|
|
40
39
|
var import_debug = __toESM(require("@prisma/debug"));
|
|
41
40
|
var import_internals = require("@prisma/internals");
|
|
@@ -44,27 +43,31 @@ var debugRpc = (0, import_debug.default)("prisma:schemaEngine:rpc");
|
|
|
44
43
|
var debugStderr = (0, import_debug.default)("prisma:schemaEngine:stderr");
|
|
45
44
|
var debugStdin = (0, import_debug.default)("prisma:schemaEngine:stdin");
|
|
46
45
|
var EngineError = class extends Error {
|
|
46
|
+
code;
|
|
47
47
|
constructor(message, code) {
|
|
48
48
|
super(message);
|
|
49
|
-
(0, import_chunk_WWAWV7DQ.__publicField)(this, "code");
|
|
50
49
|
this.code = code;
|
|
51
50
|
}
|
|
52
51
|
};
|
|
53
52
|
(0, import_internals.setClassName)(EngineError, "EngineError");
|
|
54
53
|
var messageId = 1;
|
|
55
54
|
var SchemaEngine = class {
|
|
55
|
+
debug;
|
|
56
|
+
child;
|
|
57
|
+
schemaPath;
|
|
58
|
+
listeners = {};
|
|
59
|
+
/** _All_ the logs from the engine process. */
|
|
60
|
+
messages = [];
|
|
61
|
+
lastRequest;
|
|
62
|
+
/** The fields of the last engine log event with an `ERROR` level. */
|
|
63
|
+
lastError = null;
|
|
64
|
+
initPromise;
|
|
65
|
+
enabledPreviewFeatures;
|
|
66
|
+
// `latestSchema` is set to the latest schema that was used in `introspect()`
|
|
67
|
+
latestSchema;
|
|
68
|
+
// `isRunning` is set to true when the engine is initialized, and set to false when the engine is stopped
|
|
69
|
+
isRunning = false;
|
|
56
70
|
constructor({ debug = false, schemaPath, enabledPreviewFeatures }) {
|
|
57
|
-
(0, import_chunk_WWAWV7DQ.__publicField)(this, "debug");
|
|
58
|
-
(0, import_chunk_WWAWV7DQ.__publicField)(this, "child");
|
|
59
|
-
(0, import_chunk_WWAWV7DQ.__publicField)(this, "schemaPath");
|
|
60
|
-
(0, import_chunk_WWAWV7DQ.__publicField)(this, "listeners", {});
|
|
61
|
-
(0, import_chunk_WWAWV7DQ.__publicField)(this, "messages", []);
|
|
62
|
-
(0, import_chunk_WWAWV7DQ.__publicField)(this, "lastRequest");
|
|
63
|
-
(0, import_chunk_WWAWV7DQ.__publicField)(this, "lastError", null);
|
|
64
|
-
(0, import_chunk_WWAWV7DQ.__publicField)(this, "initPromise");
|
|
65
|
-
(0, import_chunk_WWAWV7DQ.__publicField)(this, "enabledPreviewFeatures");
|
|
66
|
-
(0, import_chunk_WWAWV7DQ.__publicField)(this, "latestSchema");
|
|
67
|
-
(0, import_chunk_WWAWV7DQ.__publicField)(this, "isRunning", false);
|
|
68
71
|
this.schemaPath = schemaPath;
|
|
69
72
|
if (debug) {
|
|
70
73
|
import_debug.default.enable("SchemaEngine*");
|
|
@@ -172,7 +175,7 @@ var SchemaEngine = class {
|
|
|
172
175
|
const { views } = introspectResult;
|
|
173
176
|
if (views) {
|
|
174
177
|
const schemaPath = this.schemaPath ?? import_node_path.default.join(process.cwd(), "prisma");
|
|
175
|
-
await (0,
|
|
178
|
+
await (0, import_chunk_G7PJKEOV.handleViewsIO)({ views, schemaPath });
|
|
176
179
|
}
|
|
177
180
|
return introspectResult;
|
|
178
181
|
} finally {
|
|
@@ -16,22 +16,54 @@ 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(
|
|
19
|
+
var chunk_KMHFSDY6_exports = {};
|
|
20
|
+
__export(chunk_KMHFSDY6_exports, {
|
|
21
21
|
MigrateResolve: () => MigrateResolve
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
24
|
-
var
|
|
23
|
+
module.exports = __toCommonJS(chunk_KMHFSDY6_exports);
|
|
24
|
+
var import_chunk_VVP3QZ7Q = require("./chunk-VVP3QZ7Q.js");
|
|
25
25
|
var import_chunk_GKDFIHM2 = require("./chunk-GKDFIHM2.js");
|
|
26
26
|
var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
|
|
27
27
|
var import_chunk_DJMFXNR4 = require("./chunk-DJMFXNR4.js");
|
|
28
28
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
29
|
-
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
|
30
29
|
var import_internals = require("@prisma/internals");
|
|
31
|
-
var
|
|
30
|
+
var MigrateResolve = class _MigrateResolve {
|
|
32
31
|
static new() {
|
|
33
|
-
return new
|
|
32
|
+
return new _MigrateResolve();
|
|
34
33
|
}
|
|
34
|
+
static help = (0, import_internals.format)(`
|
|
35
|
+
Resolve issues with database migrations in deployment databases:
|
|
36
|
+
- recover from failed migrations
|
|
37
|
+
- baseline databases when starting to use Prisma Migrate on existing databases
|
|
38
|
+
- reconcile hotfixes done manually on databases with your migration history
|
|
39
|
+
|
|
40
|
+
Run "prisma migrate status" to identify if you need to use resolve.
|
|
41
|
+
|
|
42
|
+
Read more about resolving migration history issues: ${(0, import_internals.link)("https://pris.ly/d/migrate-resolve")}
|
|
43
|
+
|
|
44
|
+
${(0, import_chunk_SKRR5WT4.bold)("Usage")}
|
|
45
|
+
|
|
46
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate resolve [options]
|
|
47
|
+
|
|
48
|
+
${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
49
|
+
|
|
50
|
+
-h, --help Display this help message
|
|
51
|
+
--config Custom path to your Prisma config file
|
|
52
|
+
--schema Custom path to your Prisma schema
|
|
53
|
+
--applied Record a specific migration as applied
|
|
54
|
+
--rolled-back Record a specific migration as rolled back
|
|
55
|
+
|
|
56
|
+
${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
57
|
+
|
|
58
|
+
Update migrations table, recording a specific migration as applied
|
|
59
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate resolve --applied 20201231000000_add_users_table
|
|
60
|
+
|
|
61
|
+
Update migrations table, recording a specific migration as rolled back
|
|
62
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate resolve --rolled-back 20201231000000_add_users_table
|
|
63
|
+
|
|
64
|
+
Specify a schema
|
|
65
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate resolve --rolled-back 20201231000000_add_users_table --schema=./schema.prisma
|
|
66
|
+
`);
|
|
35
67
|
async parse(argv, config) {
|
|
36
68
|
const args = (0, import_internals.arg)(
|
|
37
69
|
argv,
|
|
@@ -74,7 +106,7 @@ ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.green)((0, import_in
|
|
|
74
106
|
);
|
|
75
107
|
}
|
|
76
108
|
await (0, import_chunk_DJMFXNR4.ensureCanConnectToDatabase)(schemaPath);
|
|
77
|
-
const migrate = new
|
|
109
|
+
const migrate = new import_chunk_VVP3QZ7Q.Migrate(schemaPath);
|
|
78
110
|
try {
|
|
79
111
|
await migrate.markMigrationApplied({
|
|
80
112
|
migrationId: args["--applied"]
|
|
@@ -95,7 +127,7 @@ Migration ${args["--applied"]} marked as applied.
|
|
|
95
127
|
);
|
|
96
128
|
}
|
|
97
129
|
await (0, import_chunk_DJMFXNR4.ensureCanConnectToDatabase)(schemaPath);
|
|
98
|
-
const migrate = new
|
|
130
|
+
const migrate = new import_chunk_VVP3QZ7Q.Migrate(schemaPath);
|
|
99
131
|
try {
|
|
100
132
|
await migrate.markMigrationRolledBack({
|
|
101
133
|
migrationId: args["--rolled-back"]
|
|
@@ -113,42 +145,8 @@ Migration ${args["--rolled-back"]} marked as rolled back.
|
|
|
113
145
|
if (error) {
|
|
114
146
|
return new import_internals.HelpError(`
|
|
115
147
|
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
|
|
116
|
-
${
|
|
148
|
+
${_MigrateResolve.help}`);
|
|
117
149
|
}
|
|
118
|
-
return
|
|
150
|
+
return _MigrateResolve.help;
|
|
119
151
|
}
|
|
120
152
|
};
|
|
121
|
-
(0, import_chunk_WWAWV7DQ.__publicField)(_MigrateResolve, "help", (0, import_internals.format)(`
|
|
122
|
-
Resolve issues with database migrations in deployment databases:
|
|
123
|
-
- recover from failed migrations
|
|
124
|
-
- baseline databases when starting to use Prisma Migrate on existing databases
|
|
125
|
-
- reconcile hotfixes done manually on databases with your migration history
|
|
126
|
-
|
|
127
|
-
Run "prisma migrate status" to identify if you need to use resolve.
|
|
128
|
-
|
|
129
|
-
Read more about resolving migration history issues: ${(0, import_internals.link)("https://pris.ly/d/migrate-resolve")}
|
|
130
|
-
|
|
131
|
-
${(0, import_chunk_SKRR5WT4.bold)("Usage")}
|
|
132
|
-
|
|
133
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate resolve [options]
|
|
134
|
-
|
|
135
|
-
${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
136
|
-
|
|
137
|
-
-h, --help Display this help message
|
|
138
|
-
--config Custom path to your Prisma config file
|
|
139
|
-
--schema Custom path to your Prisma schema
|
|
140
|
-
--applied Record a specific migration as applied
|
|
141
|
-
--rolled-back Record a specific migration as rolled back
|
|
142
|
-
|
|
143
|
-
${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
144
|
-
|
|
145
|
-
Update migrations table, recording a specific migration as applied
|
|
146
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate resolve --applied 20201231000000_add_users_table
|
|
147
|
-
|
|
148
|
-
Update migrations table, recording a specific migration as rolled back
|
|
149
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate resolve --rolled-back 20201231000000_add_users_table
|
|
150
|
-
|
|
151
|
-
Specify a schema
|
|
152
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate resolve --rolled-back 20201231000000_add_users_table --schema=./schema.prisma
|
|
153
|
-
`));
|
|
154
|
-
var MigrateResolve = _MigrateResolve;
|
|
@@ -16,16 +16,16 @@ 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(
|
|
19
|
+
var chunk_KRQEFTDT_exports = {};
|
|
20
|
+
__export(chunk_KRQEFTDT_exports, {
|
|
21
21
|
printFiles: () => printFiles,
|
|
22
22
|
printFilesFromMigrationIds: () => printFilesFromMigrationIds
|
|
23
23
|
});
|
|
24
|
-
module.exports = __toCommonJS(
|
|
24
|
+
module.exports = __toCommonJS(chunk_KRQEFTDT_exports);
|
|
25
25
|
var import_chunk_UP6FVCDK = require("./chunk-UP6FVCDK.js");
|
|
26
|
-
var
|
|
27
|
-
var
|
|
28
|
-
var import_indent_string = (0,
|
|
26
|
+
var import_chunk_2R6DII47 = require("./chunk-2R6DII47.js");
|
|
27
|
+
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
|
|
28
|
+
var import_indent_string = (0, import_chunk_2ESYSVXG.__toESM)((0, import_chunk_2R6DII47.require_indent_string)());
|
|
29
29
|
function printFiles(printPath, files) {
|
|
30
30
|
const fileNames = Object.keys(files);
|
|
31
31
|
const folders = printPath.split("/");
|
|
@@ -16,59 +16,21 @@ 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(
|
|
19
|
+
var chunk_LLO7YF56_exports = {};
|
|
20
|
+
__export(chunk_LLO7YF56_exports, {
|
|
21
21
|
MigrateCommand: () => MigrateCommand
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
23
|
+
module.exports = __toCommonJS(chunk_LLO7YF56_exports);
|
|
24
24
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
25
|
-
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
|
26
25
|
var import_internals = require("@prisma/internals");
|
|
27
|
-
var
|
|
26
|
+
var MigrateCommand = class _MigrateCommand {
|
|
28
27
|
constructor(cmds) {
|
|
29
28
|
this.cmds = cmds;
|
|
30
29
|
}
|
|
31
30
|
static new(cmds) {
|
|
32
|
-
return new
|
|
31
|
+
return new _MigrateCommand(cmds);
|
|
33
32
|
}
|
|
34
|
-
|
|
35
|
-
const args = (0, import_internals.arg)(argv, {
|
|
36
|
-
"--help": Boolean,
|
|
37
|
-
"-h": "--help",
|
|
38
|
-
"--config": String,
|
|
39
|
-
"--preview-feature": Boolean,
|
|
40
|
-
"--telemetry-information": String
|
|
41
|
-
});
|
|
42
|
-
if ((0, import_internals.isError)(args)) {
|
|
43
|
-
return this.help(args.message);
|
|
44
|
-
}
|
|
45
|
-
if (args._.length === 0 || args["--help"]) {
|
|
46
|
-
return this.help();
|
|
47
|
-
}
|
|
48
|
-
const commandName = args._[0];
|
|
49
|
-
const cmd = this.cmds[commandName];
|
|
50
|
-
if (cmd) {
|
|
51
|
-
let argsForCmd;
|
|
52
|
-
if (commandName === "diff") {
|
|
53
|
-
argsForCmd = args["--preview-feature"] ? [...args._.slice(1), `--preview-feature`] : args._.slice(1);
|
|
54
|
-
} else {
|
|
55
|
-
const filteredArgs = args._.filter((item) => item !== "--preview-feature");
|
|
56
|
-
argsForCmd = filteredArgs.slice(1);
|
|
57
|
-
}
|
|
58
|
-
return cmd.parse(argsForCmd, config);
|
|
59
|
-
}
|
|
60
|
-
return (0, import_internals.unknownCommand)(_MigrateCommand2.help, commandName);
|
|
61
|
-
}
|
|
62
|
-
help(error) {
|
|
63
|
-
if (error) {
|
|
64
|
-
return new import_internals.HelpError(`
|
|
65
|
-
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
|
|
66
|
-
${_MigrateCommand2.help}`);
|
|
67
|
-
}
|
|
68
|
-
return _MigrateCommand2.help;
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
(0, import_chunk_WWAWV7DQ.__publicField)(_MigrateCommand, "help", (0, import_internals.format)(`
|
|
33
|
+
static help = (0, import_internals.format)(`
|
|
72
34
|
Update the database schema with migrations
|
|
73
35
|
|
|
74
36
|
${(0, import_chunk_SKRR5WT4.bold)("Usage")}
|
|
@@ -119,5 +81,41 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
119
81
|
--from-url "$DATABASE_URL" \\
|
|
120
82
|
--to-url "postgresql://login:password@localhost:5432/db" \\
|
|
121
83
|
--script
|
|
122
|
-
`)
|
|
123
|
-
|
|
84
|
+
`);
|
|
85
|
+
async parse(argv, config) {
|
|
86
|
+
const args = (0, import_internals.arg)(argv, {
|
|
87
|
+
"--help": Boolean,
|
|
88
|
+
"-h": "--help",
|
|
89
|
+
"--config": String,
|
|
90
|
+
"--preview-feature": Boolean,
|
|
91
|
+
"--telemetry-information": String
|
|
92
|
+
});
|
|
93
|
+
if ((0, import_internals.isError)(args)) {
|
|
94
|
+
return this.help(args.message);
|
|
95
|
+
}
|
|
96
|
+
if (args._.length === 0 || args["--help"]) {
|
|
97
|
+
return this.help();
|
|
98
|
+
}
|
|
99
|
+
const commandName = args._[0];
|
|
100
|
+
const cmd = this.cmds[commandName];
|
|
101
|
+
if (cmd) {
|
|
102
|
+
let argsForCmd;
|
|
103
|
+
if (commandName === "diff") {
|
|
104
|
+
argsForCmd = args["--preview-feature"] ? [...args._.slice(1), `--preview-feature`] : args._.slice(1);
|
|
105
|
+
} else {
|
|
106
|
+
const filteredArgs = args._.filter((item) => item !== "--preview-feature");
|
|
107
|
+
argsForCmd = filteredArgs.slice(1);
|
|
108
|
+
}
|
|
109
|
+
return cmd.parse(argsForCmd, config);
|
|
110
|
+
}
|
|
111
|
+
return (0, import_internals.unknownCommand)(_MigrateCommand.help, commandName);
|
|
112
|
+
}
|
|
113
|
+
help(error) {
|
|
114
|
+
if (error) {
|
|
115
|
+
return new import_internals.HelpError(`
|
|
116
|
+
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
|
|
117
|
+
${_MigrateCommand.help}`);
|
|
118
|
+
}
|
|
119
|
+
return _MigrateCommand.help;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
@@ -26,19 +26,19 @@ 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_MKS2ZJJ5_exports = {};
|
|
30
|
+
__export(chunk_MKS2ZJJ5_exports, {
|
|
31
31
|
getDatabaseVersionSafe: () => getDatabaseVersionSafe
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
34
|
-
var
|
|
33
|
+
module.exports = __toCommonJS(chunk_MKS2ZJJ5_exports);
|
|
34
|
+
var import_chunk_K43RXWQY = require("./chunk-K43RXWQY.js");
|
|
35
35
|
var import_debug = __toESM(require("@prisma/debug"));
|
|
36
36
|
var debug = (0, import_debug.default)("prisma:cli");
|
|
37
37
|
async function getDatabaseVersionSafe(args) {
|
|
38
38
|
let engine;
|
|
39
39
|
let dbVersion;
|
|
40
40
|
try {
|
|
41
|
-
engine = new
|
|
41
|
+
engine = new import_chunk_K43RXWQY.SchemaEngine({});
|
|
42
42
|
dbVersion = await engine.getDatabaseVersion(args);
|
|
43
43
|
} catch (e) {
|
|
44
44
|
debug(e);
|
|
@@ -16,20 +16,19 @@ 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(
|
|
19
|
+
var chunk_NGQA5JTN_exports = {};
|
|
20
|
+
__export(chunk_NGQA5JTN_exports, {
|
|
21
21
|
CLI: () => CLI
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
23
|
+
module.exports = __toCommonJS(chunk_NGQA5JTN_exports);
|
|
24
24
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
25
|
-
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
|
26
25
|
var import_internals = require("@prisma/internals");
|
|
27
|
-
var
|
|
26
|
+
var CLI = class _CLI {
|
|
28
27
|
constructor(cmds) {
|
|
29
28
|
this.cmds = cmds;
|
|
30
29
|
}
|
|
31
30
|
static new(cmds) {
|
|
32
|
-
return new
|
|
31
|
+
return new _CLI(cmds);
|
|
33
32
|
}
|
|
34
33
|
async parse(argv, config) {
|
|
35
34
|
const args = (0, import_internals.arg)(argv, {
|
|
@@ -70,10 +69,9 @@ var _CLI = class _CLI2 {
|
|
|
70
69
|
if (error) {
|
|
71
70
|
return new import_internals.HelpError(`
|
|
72
71
|
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
|
|
73
|
-
${
|
|
72
|
+
${_CLI.help}`);
|
|
74
73
|
}
|
|
75
|
-
return
|
|
74
|
+
return _CLI.help;
|
|
76
75
|
}
|
|
76
|
+
static help = (0, import_internals.format)(`This is the internal CLI for @prisma/migrate`);
|
|
77
77
|
};
|
|
78
|
-
(0, import_chunk_WWAWV7DQ.__publicField)(_CLI, "help", (0, import_internals.format)(`This is the internal CLI for @prisma/migrate`));
|
|
79
|
-
var CLI = _CLI;
|
|
@@ -26,37 +26,75 @@ 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_NJYZPNB4_exports = {};
|
|
30
|
+
__export(chunk_NJYZPNB4_exports, {
|
|
31
31
|
DbPull: () => DbPull
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
34
|
-
var
|
|
33
|
+
module.exports = __toCommonJS(chunk_NJYZPNB4_exports);
|
|
34
|
+
var import_chunk_IINN7QUV = require("./chunk-IINN7QUV.js");
|
|
35
35
|
var import_chunk_RTGQXNX6 = require("./chunk-RTGQXNX6.js");
|
|
36
|
-
var
|
|
36
|
+
var import_chunk_AI6DH66U = require("./chunk-AI6DH66U.js");
|
|
37
37
|
var import_chunk_AHJ2N6BJ = require("./chunk-AHJ2N6BJ.js");
|
|
38
38
|
var import_chunk_JZ75RIMZ = require("./chunk-JZ75RIMZ.js");
|
|
39
39
|
var import_chunk_RR6BKMNO = require("./chunk-RR6BKMNO.js");
|
|
40
40
|
var import_chunk_JFKDSUIE = require("./chunk-JFKDSUIE.js");
|
|
41
41
|
var import_chunk_LGYRZ6CV = require("./chunk-LGYRZ6CV.js");
|
|
42
|
-
var
|
|
43
|
-
var
|
|
42
|
+
var import_chunk_K43RXWQY = require("./chunk-K43RXWQY.js");
|
|
43
|
+
var import_chunk_G7PJKEOV = require("./chunk-G7PJKEOV.js");
|
|
44
44
|
var import_chunk_3WC4XD74 = require("./chunk-3WC4XD74.js");
|
|
45
45
|
var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
|
|
46
46
|
var import_chunk_DJMFXNR4 = require("./chunk-DJMFXNR4.js");
|
|
47
47
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
48
|
-
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
|
49
48
|
var import_debug = __toESM(require("@prisma/debug"));
|
|
50
49
|
var import_internals = require("@prisma/internals");
|
|
51
50
|
var import_path = __toESM(require("path"));
|
|
52
51
|
var debug = (0, import_debug.default)("prisma:db:pull");
|
|
53
|
-
var
|
|
52
|
+
var DbPull = class _DbPull {
|
|
54
53
|
static new() {
|
|
55
|
-
return new
|
|
54
|
+
return new _DbPull();
|
|
56
55
|
}
|
|
56
|
+
static help = (0, import_internals.format)(`
|
|
57
|
+
Pull the state from the database to the Prisma schema using introspection
|
|
58
|
+
|
|
59
|
+
${(0, import_chunk_SKRR5WT4.bold)("Usage")}
|
|
60
|
+
|
|
61
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db pull [flags/options]
|
|
62
|
+
|
|
63
|
+
${(0, import_chunk_SKRR5WT4.bold)("Flags")}
|
|
64
|
+
|
|
65
|
+
-h, --help Display this help message
|
|
66
|
+
--force Ignore current Prisma schema file
|
|
67
|
+
--print Print the introspected Prisma schema to stdout
|
|
68
|
+
|
|
69
|
+
${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
70
|
+
|
|
71
|
+
--config Custom path to your Prisma config file
|
|
72
|
+
--schema Custom path to your Prisma schema
|
|
73
|
+
--composite-type-depth Specify the depth for introspecting composite types (e.g. Embedded Documents in MongoDB)
|
|
74
|
+
Number, default is -1 for infinite depth, 0 = off
|
|
75
|
+
--schemas Specify the database schemas to introspect. This overrides the schemas defined in the datasource block of your Prisma schema.
|
|
76
|
+
--local-d1 Generate a Prisma schema from a local Cloudflare D1 database
|
|
77
|
+
${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
78
|
+
|
|
79
|
+
With an existing Prisma schema
|
|
80
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db pull
|
|
81
|
+
|
|
82
|
+
Or specify a Prisma schema path
|
|
83
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db pull --schema=./schema.prisma
|
|
84
|
+
|
|
85
|
+
Instead of saving the result to the filesystem, you can also print it to stdout
|
|
86
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db pull --print
|
|
87
|
+
|
|
88
|
+
Overwrite the current schema with the introspected schema instead of enriching it
|
|
89
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db pull --force
|
|
90
|
+
|
|
91
|
+
Set composite types introspection depth to 2 levels
|
|
92
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db pull --composite-type-depth=2
|
|
93
|
+
|
|
94
|
+
`);
|
|
57
95
|
urlToDatasource(url, defaultProvider) {
|
|
58
96
|
const provider = defaultProvider || (0, import_internals.protocolToConnectorType)(`${url.split(":")[0]}:`);
|
|
59
|
-
return (0,
|
|
97
|
+
return (0, import_chunk_AI6DH66U.printDatasources)([
|
|
60
98
|
{
|
|
61
99
|
config: {},
|
|
62
100
|
provider,
|
|
@@ -80,7 +118,7 @@ var _DbPull = class _DbPull2 {
|
|
|
80
118
|
"--local-d1": Boolean
|
|
81
119
|
// optional, only on cloudflare D1
|
|
82
120
|
});
|
|
83
|
-
const spinnerFactory = (0,
|
|
121
|
+
const spinnerFactory = (0, import_chunk_IINN7QUV.createSpinner)(!args["--print"]);
|
|
84
122
|
if (args instanceof Error) {
|
|
85
123
|
return this.help(args.message);
|
|
86
124
|
}
|
|
@@ -104,7 +142,7 @@ var _DbPull = class _DbPull2 {
|
|
|
104
142
|
if (!url && !schemaPath && !fromD1) {
|
|
105
143
|
throw new import_chunk_3WC4XD74.NoSchemaFoundError();
|
|
106
144
|
}
|
|
107
|
-
const { firstDatasource, schema, validationWarning } = await (0,
|
|
145
|
+
const { firstDatasource, schema, validationWarning } = await (0, import_chunk_G7PJKEOV.z)({ url, schemaPath, fromD1 }).when(
|
|
108
146
|
(input) => input.schemaPath !== null,
|
|
109
147
|
async (input) => {
|
|
110
148
|
const rawSchema = await (0, import_internals.getSchema)(input.schemaPath, config.schema);
|
|
@@ -200,7 +238,7 @@ Some information will be lost (relations, comments, mapped fields, @ignore...),
|
|
|
200
238
|
)} for more info.`);
|
|
201
239
|
}
|
|
202
240
|
}
|
|
203
|
-
const engine = new
|
|
241
|
+
const engine = new import_chunk_K43RXWQY.SchemaEngine({
|
|
204
242
|
schemaPath: schemaPath ?? void 0
|
|
205
243
|
});
|
|
206
244
|
const basedOn = !args["--url"] && schemaPath ? ` based on datasource defined in ${(0, import_chunk_SKRR5WT4.underline)(import_path.default.relative(process.cwd(), schemaPath))}` : "";
|
|
@@ -319,48 +357,8 @@ ${warnings}`;
|
|
|
319
357
|
if (error) {
|
|
320
358
|
return new import_internals.HelpError(`
|
|
321
359
|
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
|
|
322
|
-
${
|
|
360
|
+
${_DbPull.help}`);
|
|
323
361
|
}
|
|
324
|
-
return
|
|
362
|
+
return _DbPull.help;
|
|
325
363
|
}
|
|
326
364
|
};
|
|
327
|
-
(0, import_chunk_WWAWV7DQ.__publicField)(_DbPull, "help", (0, import_internals.format)(`
|
|
328
|
-
Pull the state from the database to the Prisma schema using introspection
|
|
329
|
-
|
|
330
|
-
${(0, import_chunk_SKRR5WT4.bold)("Usage")}
|
|
331
|
-
|
|
332
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db pull [flags/options]
|
|
333
|
-
|
|
334
|
-
${(0, import_chunk_SKRR5WT4.bold)("Flags")}
|
|
335
|
-
|
|
336
|
-
-h, --help Display this help message
|
|
337
|
-
--force Ignore current Prisma schema file
|
|
338
|
-
--print Print the introspected Prisma schema to stdout
|
|
339
|
-
|
|
340
|
-
${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
341
|
-
|
|
342
|
-
--config Custom path to your Prisma config file
|
|
343
|
-
--schema Custom path to your Prisma schema
|
|
344
|
-
--composite-type-depth Specify the depth for introspecting composite types (e.g. Embedded Documents in MongoDB)
|
|
345
|
-
Number, default is -1 for infinite depth, 0 = off
|
|
346
|
-
--schemas Specify the database schemas to introspect. This overrides the schemas defined in the datasource block of your Prisma schema.
|
|
347
|
-
--local-d1 Generate a Prisma schema from a local Cloudflare D1 database
|
|
348
|
-
${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
349
|
-
|
|
350
|
-
With an existing Prisma schema
|
|
351
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db pull
|
|
352
|
-
|
|
353
|
-
Or specify a Prisma schema path
|
|
354
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db pull --schema=./schema.prisma
|
|
355
|
-
|
|
356
|
-
Instead of saving the result to the filesystem, you can also print it to stdout
|
|
357
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db pull --print
|
|
358
|
-
|
|
359
|
-
Overwrite the current schema with the introspected schema instead of enriching it
|
|
360
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db pull --force
|
|
361
|
-
|
|
362
|
-
Set composite types introspection depth to 2 levels
|
|
363
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db pull --composite-type-depth=2
|
|
364
|
-
|
|
365
|
-
`));
|
|
366
|
-
var DbPull = _DbPull;
|