@prisma/migrate 6.19.0-integration-engines-6-19-0-28-next-8f44482e378cd05ba43deae3c6b1d441b5248e08.1 → 6.19.0-integration-next.12
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/Migrate.js +3 -3
- package/dist/bin.js +26 -27
- package/dist/{chunk-Z27SI4AV.js → chunk-43R3GFIU.js} +4 -4
- package/dist/{chunk-F2XCBEZ4.js → chunk-4LNQFWQD.js} +10 -12
- package/dist/{chunk-BHJMJSM4.js → chunk-ANMWKEMD.js} +6 -6
- package/dist/{chunk-7TVX3D4W.js → chunk-AP47ZTTC.js} +27 -65
- package/dist/{chunk-TW22Y3AA.js → chunk-CQLPPAWH.js} +7 -7
- package/dist/{chunk-ZTIS675B.js → chunk-HDTRNRXE.js} +7 -42
- package/dist/{chunk-PHXLQVPT.js → chunk-L7EZFBB4.js} +40 -68
- package/dist/{chunk-D6LYHB65.js → chunk-MOFG2YPJ.js} +5 -7
- package/dist/{chunk-3AKRTEIK.js → chunk-NG4757TP.js} +7 -7
- package/dist/{chunk-6ORQRJLP.js → chunk-OPD3GTJ2.js} +14 -45
- package/dist/{chunk-R4IWP35Z.js → chunk-Q66L2LFA.js} +6 -6
- package/dist/{chunk-NB4FRYRQ.js → chunk-SIUB4YHK.js} +5 -5
- package/dist/{chunk-J33EXHZB.js → chunk-UJA5DXI3.js} +10 -12
- package/dist/{chunk-D4TRX77Y.js → chunk-W2NKGYXF.js} +7 -9
- package/dist/{chunk-O35BTK6Y.js → chunk-XAPRGBTZ.js} +5 -5
- package/dist/commands/DbDrop.js +2 -2
- package/dist/commands/DbExecute.js +4 -4
- package/dist/commands/DbPull.js +4 -5
- package/dist/commands/DbPush.js +4 -4
- package/dist/commands/DbSeed.js +3 -3
- package/dist/commands/MigrateDeploy.js +4 -4
- package/dist/commands/MigrateDev.js +5 -5
- package/dist/commands/MigrateDiff.js +4 -4
- package/dist/commands/MigrateReset.js +5 -5
- package/dist/commands/MigrateResolve.js +4 -4
- package/dist/commands/MigrateStatus.js +4 -4
- package/dist/index.js +30 -31
- package/dist/internals/src/cli/getSchema.d.ts +1 -15
- package/dist/migrate/src/Migrate.d.ts +1 -2
- package/dist/migrate/src/utils/seed.d.ts +0 -6
- package/dist/utils/getDatabaseVersionSafe.js +4 -4
- package/dist/utils/introspectSql.js +4 -4
- package/dist/utils/seed.js +2 -3
- package/package.json +11 -11
- package/dist/chunk-RR6BKMNO.js +0 -80
- package/dist/migrate/src/utils/replaceOrAddDatasource.d.ts +0 -2
- package/dist/migrate/src/utils/replaceOrAddDatasource.test.d.ts +0 -1
- package/dist/utils/replaceOrAddDatasource.js +0 -25
- package/dist/utils/replaceOrAddDatasource.test.js +0 -207
package/dist/Migrate.js
CHANGED
|
@@ -18,12 +18,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var Migrate_exports = {};
|
|
20
20
|
__export(Migrate_exports, {
|
|
21
|
-
Migrate: () =>
|
|
21
|
+
Migrate: () => import_chunk_MOFG2YPJ.Migrate
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(Migrate_exports);
|
|
24
|
-
var
|
|
25
|
-
var import_chunk_T64SUJ5L = require("./chunk-T64SUJ5L.js");
|
|
24
|
+
var import_chunk_MOFG2YPJ = require("./chunk-MOFG2YPJ.js");
|
|
26
25
|
var import_chunk_VV4M6AN7 = require("./chunk-VV4M6AN7.js");
|
|
26
|
+
var import_chunk_T64SUJ5L = require("./chunk-T64SUJ5L.js");
|
|
27
27
|
var import_chunk_GGA2F64G = require("./chunk-GGA2F64G.js");
|
|
28
28
|
var import_chunk_23DZXSTI = require("./chunk-23DZXSTI.js");
|
|
29
29
|
var import_chunk_3WDCTXHL = require("./chunk-3WDCTXHL.js");
|
package/dist/bin.js
CHANGED
|
@@ -23,42 +23,41 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
23
23
|
mod
|
|
24
24
|
));
|
|
25
25
|
var import_chunk_NGQA5JTN = require("./chunk-NGQA5JTN.js");
|
|
26
|
-
var
|
|
27
|
-
var
|
|
28
|
-
var
|
|
26
|
+
var import_chunk_SIUB4YHK = require("./chunk-SIUB4YHK.js");
|
|
27
|
+
var import_chunk_ANMWKEMD = require("./chunk-ANMWKEMD.js");
|
|
28
|
+
var import_chunk_4LNQFWQD = require("./chunk-4LNQFWQD.js");
|
|
29
29
|
var import_chunk_C3722PDA = require("./chunk-C3722PDA.js");
|
|
30
30
|
var import_chunk_7CQBDP4H = require("./chunk-7CQBDP4H.js");
|
|
31
|
-
var
|
|
31
|
+
var import_chunk_HDTRNRXE = require("./chunk-HDTRNRXE.js");
|
|
32
32
|
var import_chunk_VAJ4VX67 = require("./chunk-VAJ4VX67.js");
|
|
33
|
-
var
|
|
33
|
+
var import_chunk_UJA5DXI3 = require("./chunk-UJA5DXI3.js");
|
|
34
34
|
var import_chunk_KRQEFTDT = require("./chunk-KRQEFTDT.js");
|
|
35
35
|
var import_chunk_UP6FVCDK = require("./chunk-UP6FVCDK.js");
|
|
36
|
-
var
|
|
37
|
-
var
|
|
36
|
+
var import_chunk_NG4757TP = require("./chunk-NG4757TP.js");
|
|
37
|
+
var import_chunk_Q66L2LFA = require("./chunk-Q66L2LFA.js");
|
|
38
38
|
var import_chunk_EJG7GKM7 = require("./chunk-EJG7GKM7.js");
|
|
39
|
-
var
|
|
40
|
-
var
|
|
39
|
+
var import_chunk_AP47ZTTC = require("./chunk-AP47ZTTC.js");
|
|
40
|
+
var import_chunk_OPD3GTJ2 = require("./chunk-OPD3GTJ2.js");
|
|
41
41
|
var import_chunk_VU5BLQUI = require("./chunk-VU5BLQUI.js");
|
|
42
42
|
var import_chunk_AHJ2N6BJ = require("./chunk-AHJ2N6BJ.js");
|
|
43
43
|
var import_chunk_JZ75RIMZ = require("./chunk-JZ75RIMZ.js");
|
|
44
|
-
var import_chunk_RR6BKMNO = require("./chunk-RR6BKMNO.js");
|
|
45
44
|
var import_chunk_RTGQXNX6 = require("./chunk-RTGQXNX6.js");
|
|
46
45
|
var import_chunk_JFKDSUIE = require("./chunk-JFKDSUIE.js");
|
|
47
46
|
var import_chunk_AI6DH66U = require("./chunk-AI6DH66U.js");
|
|
48
47
|
var import_chunk_LGYRZ6CV = require("./chunk-LGYRZ6CV.js");
|
|
49
48
|
var import_chunk_2R6DII47 = require("./chunk-2R6DII47.js");
|
|
50
|
-
var
|
|
49
|
+
var import_chunk_CQLPPAWH = require("./chunk-CQLPPAWH.js");
|
|
51
50
|
var import_chunk_FBDQVK4W = require("./chunk-FBDQVK4W.js");
|
|
52
51
|
var import_chunk_3WC4XD74 = require("./chunk-3WC4XD74.js");
|
|
53
52
|
var import_chunk_2FXU5NZQ = require("./chunk-2FXU5NZQ.js");
|
|
54
53
|
var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
|
|
55
54
|
var import_chunk_TWPTG4XS = require("./chunk-TWPTG4XS.js");
|
|
56
|
-
var
|
|
57
|
-
var
|
|
55
|
+
var import_chunk_W2NKGYXF = require("./chunk-W2NKGYXF.js");
|
|
56
|
+
var import_chunk_L7EZFBB4 = require("./chunk-L7EZFBB4.js");
|
|
58
57
|
var import_chunk_LLO7YF56 = require("./chunk-LLO7YF56.js");
|
|
59
|
-
var
|
|
60
|
-
var import_chunk_T64SUJ5L = require("./chunk-T64SUJ5L.js");
|
|
58
|
+
var import_chunk_MOFG2YPJ = require("./chunk-MOFG2YPJ.js");
|
|
61
59
|
var import_chunk_VV4M6AN7 = require("./chunk-VV4M6AN7.js");
|
|
60
|
+
var import_chunk_T64SUJ5L = require("./chunk-T64SUJ5L.js");
|
|
62
61
|
var import_chunk_GGA2F64G = require("./chunk-GGA2F64G.js");
|
|
63
62
|
var import_chunk_23DZXSTI = require("./chunk-23DZXSTI.js");
|
|
64
63
|
var import_chunk_3WDCTXHL = require("./chunk-3WDCTXHL.js");
|
|
@@ -72,7 +71,7 @@ var import_config = require("@prisma/config");
|
|
|
72
71
|
var import_debug = __toESM(require("@prisma/debug"));
|
|
73
72
|
var import_engines_version = require("@prisma/engines-version");
|
|
74
73
|
var import_internals = require("@prisma/internals");
|
|
75
|
-
var version = "6.19.0-integration-
|
|
74
|
+
var version = "6.19.0-integration-next.12";
|
|
76
75
|
process.on("uncaughtException", (e) => {
|
|
77
76
|
console.log(e);
|
|
78
77
|
});
|
|
@@ -94,19 +93,19 @@ var args = (0, import_internals.arg)(
|
|
|
94
93
|
async function main() {
|
|
95
94
|
const cli = import_chunk_NGQA5JTN.CLI.new({
|
|
96
95
|
migrate: import_chunk_LLO7YF56.MigrateCommand.new({
|
|
97
|
-
dev:
|
|
98
|
-
status:
|
|
99
|
-
resolve:
|
|
100
|
-
reset:
|
|
101
|
-
deploy:
|
|
102
|
-
diff:
|
|
96
|
+
dev: import_chunk_4LNQFWQD.MigrateDev.new(),
|
|
97
|
+
status: import_chunk_Q66L2LFA.MigrateStatus.new(),
|
|
98
|
+
resolve: import_chunk_NG4757TP.MigrateResolve.new(),
|
|
99
|
+
reset: import_chunk_UJA5DXI3.MigrateReset.new(),
|
|
100
|
+
deploy: import_chunk_ANMWKEMD.MigrateDeploy.new(),
|
|
101
|
+
diff: import_chunk_HDTRNRXE.MigrateDiff.new()
|
|
103
102
|
}),
|
|
104
103
|
db: import_chunk_EJG7GKM7.DbCommand.new({
|
|
105
|
-
execute:
|
|
106
|
-
pull:
|
|
107
|
-
push:
|
|
104
|
+
execute: import_chunk_AP47ZTTC.DbExecute.new(),
|
|
105
|
+
pull: import_chunk_OPD3GTJ2.DbPull.new(),
|
|
106
|
+
push: import_chunk_CQLPPAWH.DbPush.new(),
|
|
108
107
|
// drop: DbDrop.new(),
|
|
109
|
-
seed:
|
|
108
|
+
seed: import_chunk_W2NKGYXF.DbSeed.new()
|
|
110
109
|
})
|
|
111
110
|
});
|
|
112
111
|
const { config, error } = await (0, import_config.loadConfigFromFile)({ configFile: args["--config"] });
|
|
@@ -136,7 +135,7 @@ main().then((code) => {
|
|
|
136
135
|
cliVersion: version,
|
|
137
136
|
enginesVersion: import_engines_version.enginesVersion,
|
|
138
137
|
command: commandArray.join(" "),
|
|
139
|
-
getDatabaseVersionSafe:
|
|
138
|
+
getDatabaseVersionSafe: import_chunk_SIUB4YHK.getDatabaseVersionSafe
|
|
140
139
|
}).catch((e) => {
|
|
141
140
|
if (import_debug.default.enabled("migrate")) {
|
|
142
141
|
console.error((0, import_chunk_SKRR5WT4.red)((0, import_chunk_SKRR5WT4.bold)("Error: ")) + e.stack);
|
|
@@ -26,11 +26,11 @@ 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_43R3GFIU_exports = {};
|
|
30
|
+
__export(chunk_43R3GFIU_exports, {
|
|
31
31
|
DbDrop: () => DbDrop
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(chunk_43R3GFIU_exports);
|
|
34
34
|
var import_chunk_IHDN3L3R = require("./chunk-IHDN3L3R.js");
|
|
35
35
|
var import_chunk_FBDQVK4W = require("./chunk-FBDQVK4W.js");
|
|
36
36
|
var import_chunk_3WC4XD74 = require("./chunk-3WC4XD74.js");
|
|
@@ -94,7 +94,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
94
94
|
if (!args["--preview-feature"]) {
|
|
95
95
|
throw new import_chunk_IHDN3L3R.PreviewFlagError();
|
|
96
96
|
}
|
|
97
|
-
|
|
97
|
+
(0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
|
|
98
98
|
const schemaContext = await (0, import_internals.loadSchemaContext)({
|
|
99
99
|
schemaPathFromArg: args["--schema"],
|
|
100
100
|
schemaPathFromConfig: config.schema,
|
|
@@ -26,11 +26,11 @@ 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_4LNQFWQD_exports = {};
|
|
30
|
+
__export(chunk_4LNQFWQD_exports, {
|
|
31
31
|
MigrateDev: () => MigrateDev
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(chunk_4LNQFWQD_exports);
|
|
34
34
|
var import_chunk_C3722PDA = require("./chunk-C3722PDA.js");
|
|
35
35
|
var import_chunk_7CQBDP4H = require("./chunk-7CQBDP4H.js");
|
|
36
36
|
var import_chunk_KRQEFTDT = require("./chunk-KRQEFTDT.js");
|
|
@@ -38,8 +38,8 @@ var import_chunk_UP6FVCDK = require("./chunk-UP6FVCDK.js");
|
|
|
38
38
|
var import_chunk_3WC4XD74 = require("./chunk-3WC4XD74.js");
|
|
39
39
|
var import_chunk_2FXU5NZQ = require("./chunk-2FXU5NZQ.js");
|
|
40
40
|
var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
|
|
41
|
-
var
|
|
42
|
-
var
|
|
41
|
+
var import_chunk_L7EZFBB4 = require("./chunk-L7EZFBB4.js");
|
|
42
|
+
var import_chunk_MOFG2YPJ = require("./chunk-MOFG2YPJ.js");
|
|
43
43
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
44
44
|
var import_node_path = __toESM(require("node:path"));
|
|
45
45
|
var import_debug = __toESM(require("@prisma/debug"));
|
|
@@ -100,7 +100,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
100
100
|
if (args["--help"]) {
|
|
101
101
|
return this.help();
|
|
102
102
|
}
|
|
103
|
-
|
|
103
|
+
(0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
|
|
104
104
|
const schemaContext = await (0, import_internals.loadSchemaContext)({
|
|
105
105
|
schemaPathFromArg: args["--schema"],
|
|
106
106
|
schemaPathFromConfig: config.schema,
|
|
@@ -124,7 +124,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
124
124
|
externalTables: config.tables?.external ?? [],
|
|
125
125
|
externalEnums: config.enums?.external ?? []
|
|
126
126
|
};
|
|
127
|
-
const migrate = await
|
|
127
|
+
const migrate = await import_chunk_MOFG2YPJ.Migrate.setup({
|
|
128
128
|
schemaEngineConfig: config,
|
|
129
129
|
migrationsDirPath,
|
|
130
130
|
schemaContext,
|
|
@@ -281,17 +281,15 @@ ${(0, import_chunk_SKRR5WT4.green)("Your database is now in sync with your schem
|
|
|
281
281
|
);
|
|
282
282
|
}
|
|
283
283
|
if (!process.env.PRISMA_MIGRATE_SKIP_GENERATE && !args["--skip-generate"]) {
|
|
284
|
-
await migrate.tryToRunGenerate(
|
|
284
|
+
await migrate.tryToRunGenerate();
|
|
285
285
|
process.stdout.write("\n");
|
|
286
286
|
}
|
|
287
287
|
if (wasDbCreated && !process.env.PRISMA_MIGRATE_SKIP_SEED && !args["--skip-seed"]) {
|
|
288
288
|
try {
|
|
289
|
-
const
|
|
290
|
-
const seedCommandFromPkgJson = await (0, import_chunk_PHXLQVPT.getSeedCommandFromPackageJson)(process.cwd());
|
|
291
|
-
const seedCommand = seedCommandFromPrismaConfig ?? seedCommandFromPkgJson;
|
|
289
|
+
const seedCommand = config.migrations?.seed;
|
|
292
290
|
if (seedCommand) {
|
|
293
291
|
process.stdout.write("\n");
|
|
294
|
-
const successfulSeeding = await (0,
|
|
292
|
+
const successfulSeeding = await (0, import_chunk_L7EZFBB4.executeSeedCommand)({ commandFromConfig: seedCommand });
|
|
295
293
|
if (successfulSeeding) {
|
|
296
294
|
process.stdout.write(`
|
|
297
295
|
${process.platform === "win32" ? "" : "\u{1F331} "}The seed command has been executed.
|
|
@@ -26,15 +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_ANMWKEMD_exports = {};
|
|
30
|
+
__export(chunk_ANMWKEMD_exports, {
|
|
31
31
|
MigrateDeploy: () => MigrateDeploy
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(chunk_ANMWKEMD_exports);
|
|
34
34
|
var import_chunk_KRQEFTDT = require("./chunk-KRQEFTDT.js");
|
|
35
35
|
var import_chunk_2FXU5NZQ = require("./chunk-2FXU5NZQ.js");
|
|
36
36
|
var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
|
|
37
|
-
var
|
|
37
|
+
var import_chunk_MOFG2YPJ = require("./chunk-MOFG2YPJ.js");
|
|
38
38
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
39
39
|
var import_debug = __toESM(require("@prisma/debug"));
|
|
40
40
|
var import_internals = require("@prisma/internals");
|
|
@@ -83,7 +83,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
83
83
|
if (args["--help"]) {
|
|
84
84
|
return this.help();
|
|
85
85
|
}
|
|
86
|
-
|
|
86
|
+
(0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
|
|
87
87
|
const schemaContext = await (0, import_internals.loadSchemaContext)({
|
|
88
88
|
schemaPathFromArg: args["--schema"],
|
|
89
89
|
schemaPathFromConfig: config.schema,
|
|
@@ -97,7 +97,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
97
97
|
externalTables: config.tables?.external ?? [],
|
|
98
98
|
externalEnums: config.enums?.external ?? []
|
|
99
99
|
};
|
|
100
|
-
const migrate = await
|
|
100
|
+
const migrate = await import_chunk_MOFG2YPJ.Migrate.setup({
|
|
101
101
|
schemaEngineConfig: config,
|
|
102
102
|
migrationsDirPath,
|
|
103
103
|
schemaContext,
|
|
@@ -26,12 +26,12 @@ 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_AP47ZTTC_exports = {};
|
|
30
|
+
__export(chunk_AP47ZTTC_exports, {
|
|
31
31
|
DbExecute: () => DbExecute
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
34
|
-
var
|
|
33
|
+
module.exports = __toCommonJS(chunk_AP47ZTTC_exports);
|
|
34
|
+
var import_chunk_MOFG2YPJ = require("./chunk-MOFG2YPJ.js");
|
|
35
35
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
36
36
|
var import_consumers = __toESM(require("node:stream/consumers"));
|
|
37
37
|
var import_internals = require("@prisma/internals");
|
|
@@ -47,9 +47,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
|
47
47
|
-h, --help Display this help message
|
|
48
48
|
--config Custom path to your Prisma config file
|
|
49
49
|
|
|
50
|
-
${(0, import_chunk_SKRR5WT4.italic)("
|
|
51
|
-
--url URL of the datasource to run the command on
|
|
52
|
-
--schema Path to your Prisma schema file to take the datasource URL from
|
|
50
|
+
Datasource configuration is read from ${(0, import_chunk_SKRR5WT4.italic)("prisma.config.ts")}.
|
|
53
51
|
|
|
54
52
|
${(0, import_chunk_SKRR5WT4.italic)("Script input, only 1 must be provided:")}
|
|
55
53
|
--file Path to a file. The content will be sent as the script to be executed
|
|
@@ -68,11 +66,11 @@ var DbExecute = class _DbExecute {
|
|
|
68
66
|
static help = (0, import_internals.format)(`
|
|
69
67
|
${process.platform === "win32" ? "" : "\u{1F4DD} "}Execute native commands to your database
|
|
70
68
|
|
|
71
|
-
This command takes as input a datasource
|
|
69
|
+
This command takes as input a datasource defined in ${(0, import_chunk_SKRR5WT4.italic)("prisma.config.ts")} and a script, using ${(0, import_chunk_SKRR5WT4.green)(
|
|
72
70
|
`--stdin`
|
|
73
71
|
)} or ${(0, import_chunk_SKRR5WT4.green)(`--file`)}.
|
|
74
|
-
The input parameters are mutually exclusive, only 1
|
|
75
|
-
|
|
72
|
+
The script input parameters are mutually exclusive, only 1 must be provided.
|
|
73
|
+
|
|
76
74
|
The output of the command is connector-specific, and is not meant for returning data, but only to report success or failure.
|
|
77
75
|
|
|
78
76
|
On SQL databases, this command takes as input a SQL script.
|
|
@@ -82,23 +80,14 @@ ${(0, import_chunk_SKRR5WT4.italic)(`This command is currently not supported on
|
|
|
82
80
|
|
|
83
81
|
${helpOptions}
|
|
84
82
|
${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
85
|
-
|
|
86
|
-
Execute the content of a SQL script file to the datasource URL taken from the schema
|
|
87
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db execute
|
|
88
|
-
--file ./script.sql \\
|
|
89
|
-
--schema schema.prisma
|
|
90
83
|
|
|
91
|
-
Execute the SQL script
|
|
92
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
93
|
-
prisma db execute \\
|
|
94
|
-
--stdin \\
|
|
95
|
-
--url="$DATABASE_URL"
|
|
84
|
+
Execute the content of a SQL script file using the datasource configured in prisma.config.ts
|
|
85
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db execute --file ./script.sql
|
|
96
86
|
|
|
97
|
-
|
|
87
|
+
Execute the SQL script from stdin using the configured datasource
|
|
98
88
|
${(0, import_chunk_SKRR5WT4.dim)("$")} echo 'TRUNCATE TABLE dev;' | \\
|
|
99
89
|
prisma db execute \\
|
|
100
|
-
--stdin
|
|
101
|
-
--url="mysql://root:root@localhost/mydb"
|
|
90
|
+
--stdin
|
|
102
91
|
`);
|
|
103
92
|
async parse(argv, config) {
|
|
104
93
|
const args = (0, import_internals.arg)(
|
|
@@ -109,8 +98,6 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
109
98
|
"--config": String,
|
|
110
99
|
"--stdin": Boolean,
|
|
111
100
|
"--file": String,
|
|
112
|
-
"--schema": String,
|
|
113
|
-
"--url": String,
|
|
114
101
|
"--telemetry-information": String
|
|
115
102
|
},
|
|
116
103
|
false
|
|
@@ -121,33 +108,15 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
121
108
|
if (args["--help"]) {
|
|
122
109
|
return this.help();
|
|
123
110
|
}
|
|
124
|
-
await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: false, config });
|
|
125
111
|
const cmd = "db execute";
|
|
126
|
-
(0, import_internals.checkUnsupportedSchemaEngineWasm)({
|
|
127
|
-
cmd,
|
|
128
|
-
config,
|
|
129
|
-
args,
|
|
130
|
-
flags: ["--url"]
|
|
131
|
-
});
|
|
132
112
|
if (args["--stdin"] && args["--file"]) {
|
|
133
113
|
throw new Error(
|
|
134
|
-
`--stdin and --file cannot be used at the same time. Only 1 must be provided.
|
|
114
|
+
`--stdin and --file cannot be used at the same time. Only 1 must be provided.
|
|
135
115
|
See \`${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)("prisma db execute -h"))}\``
|
|
136
116
|
);
|
|
137
117
|
} else if (!args["--stdin"] && !args["--file"]) {
|
|
138
118
|
throw new Error(
|
|
139
119
|
`Either --stdin or --file must be provided.
|
|
140
|
-
See \`${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)("prisma db execute -h"))}\``
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
if (args["--url"] && args["--schema"]) {
|
|
144
|
-
throw new Error(
|
|
145
|
-
`--url and --schema cannot be used at the same time. Only 1 must be provided.
|
|
146
|
-
See \`${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)("prisma db execute -h"))}\``
|
|
147
|
-
);
|
|
148
|
-
} else if (!args["--url"] && !args["--schema"]) {
|
|
149
|
-
throw new Error(
|
|
150
|
-
`Either --url or --schema must be provided.
|
|
151
120
|
See \`${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)("prisma db execute -h"))}\``
|
|
152
121
|
);
|
|
153
122
|
}
|
|
@@ -167,28 +136,21 @@ See \`${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExec
|
|
|
167
136
|
if (args["--stdin"]) {
|
|
168
137
|
script = await import_consumers.default.text(process.stdin);
|
|
169
138
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
const schemaContext = await (0, import_internals.loadSchemaContext)({
|
|
179
|
-
schemaPathFromArg: args["--schema"],
|
|
180
|
-
schemaPathFromConfig: config.schema,
|
|
181
|
-
schemaEngineConfig: config,
|
|
182
|
-
printLoadMessage: false
|
|
183
|
-
});
|
|
184
|
-
(0, import_internals.checkUnsupportedDataProxy)({ cmd, schemaContext });
|
|
185
|
-
datasourceType = {
|
|
186
|
-
tag: "schema",
|
|
187
|
-
...(0, import_internals.toSchemasContainer)(schemaContext.schemaFiles),
|
|
188
|
-
configDir: schemaContext.primaryDatasourceDirectory
|
|
189
|
-
};
|
|
139
|
+
if (config.engine === "js") {
|
|
140
|
+
throw new Error('engine: "js" is not yet supported in `db execute`.');
|
|
141
|
+
}
|
|
142
|
+
if (config.engine !== "classic" || !config.datasource?.url) {
|
|
143
|
+
throw new Error(
|
|
144
|
+
`A datasource URL must be provided via prisma.config.ts.
|
|
145
|
+
See \`${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)("prisma db execute -h"))}\``
|
|
146
|
+
);
|
|
190
147
|
}
|
|
191
|
-
|
|
148
|
+
(0, import_internals.checkUnsupportedDataProxy)({ cmd, urls: [config.datasource.url] });
|
|
149
|
+
const datasourceType = {
|
|
150
|
+
tag: "url",
|
|
151
|
+
url: config.datasource.url
|
|
152
|
+
};
|
|
153
|
+
const migrate = await import_chunk_MOFG2YPJ.Migrate.setup({ schemaEngineConfig: config, extensions: config["extensions"] });
|
|
192
154
|
try {
|
|
193
155
|
await migrate.engine.dbExecute({
|
|
194
156
|
script,
|
|
@@ -26,16 +26,16 @@ 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_CQLPPAWH_exports = {};
|
|
30
|
+
__export(chunk_CQLPPAWH_exports, {
|
|
31
31
|
DbPush: () => DbPush
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(chunk_CQLPPAWH_exports);
|
|
34
34
|
var import_chunk_FBDQVK4W = require("./chunk-FBDQVK4W.js");
|
|
35
35
|
var import_chunk_3WC4XD74 = require("./chunk-3WC4XD74.js");
|
|
36
36
|
var import_chunk_2FXU5NZQ = require("./chunk-2FXU5NZQ.js");
|
|
37
37
|
var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
|
|
38
|
-
var
|
|
38
|
+
var import_chunk_MOFG2YPJ = require("./chunk-MOFG2YPJ.js");
|
|
39
39
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
40
40
|
var import_internals = require("@prisma/internals");
|
|
41
41
|
var import_prompts = __toESM(require("prompts"));
|
|
@@ -91,7 +91,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
91
91
|
if (args["--help"]) {
|
|
92
92
|
return this.help();
|
|
93
93
|
}
|
|
94
|
-
|
|
94
|
+
(0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
|
|
95
95
|
const schemaContext = await (0, import_internals.loadSchemaContext)({
|
|
96
96
|
schemaPathFromArg: args["--schema"],
|
|
97
97
|
schemaPathFromConfig: config.schema,
|
|
@@ -106,7 +106,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
106
106
|
externalTables: config.tables?.external ?? [],
|
|
107
107
|
externalEnums: config.enums?.external ?? []
|
|
108
108
|
};
|
|
109
|
-
const migrate = await
|
|
109
|
+
const migrate = await import_chunk_MOFG2YPJ.Migrate.setup({
|
|
110
110
|
schemaEngineConfig: config,
|
|
111
111
|
migrationsDirPath,
|
|
112
112
|
schemaContext,
|
|
@@ -233,7 +233,7 @@ ${rocketEmoji}${provider === "mongodb" ? migrationSuccessMongoMessage : migratio
|
|
|
233
233
|
);
|
|
234
234
|
}
|
|
235
235
|
if (!process.env.PRISMA_MIGRATE_SKIP_GENERATE && !args["--skip-generate"]) {
|
|
236
|
-
await migrate.tryToRunGenerate(
|
|
236
|
+
await migrate.tryToRunGenerate();
|
|
237
237
|
}
|
|
238
238
|
return ``;
|
|
239
239
|
}
|
|
@@ -26,20 +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_HDTRNRXE_exports = {};
|
|
30
|
+
__export(chunk_HDTRNRXE_exports, {
|
|
31
31
|
MigrateDiff: () => MigrateDiff
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(chunk_HDTRNRXE_exports);
|
|
34
34
|
var import_chunk_VAJ4VX67 = require("./chunk-VAJ4VX67.js");
|
|
35
|
-
var
|
|
35
|
+
var import_chunk_MOFG2YPJ = require("./chunk-MOFG2YPJ.js");
|
|
36
36
|
var import_chunk_GGA2F64G = require("./chunk-GGA2F64G.js");
|
|
37
37
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
38
38
|
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
|
|
39
39
|
var import_debug = __toESM(require("@prisma/debug"));
|
|
40
40
|
var import_internals = require("@prisma/internals");
|
|
41
41
|
var import_path = __toESM(require("path"));
|
|
42
|
-
var import_config = require("@prisma/config");
|
|
43
42
|
var import_debug2 = require("@prisma/debug");
|
|
44
43
|
var import_fs = __toESM(require("fs"));
|
|
45
44
|
var import_path2 = __toESM(require("path"));
|
|
@@ -5569,10 +5568,6 @@ async function getSchemaWithPathInternal(schemaPathFromArgs, schemaPathFromConfi
|
|
|
5569
5568
|
if (prismaConfigResult.ok) {
|
|
5570
5569
|
return prismaConfigResult;
|
|
5571
5570
|
}
|
|
5572
|
-
const pkgJsonResult = await getSchemaFromPackageJson(cwd);
|
|
5573
|
-
if (pkgJsonResult.ok) {
|
|
5574
|
-
return pkgJsonResult;
|
|
5575
|
-
}
|
|
5576
5571
|
const defaultResult = await getDefaultSchema(cwd);
|
|
5577
5572
|
if (defaultResult.ok) {
|
|
5578
5573
|
return defaultResult;
|
|
@@ -5629,36 +5624,6 @@ async function readSchemaFromPrismaConfigBasedLocation(schemaPathFromConfig) {
|
|
|
5629
5624
|
}
|
|
5630
5625
|
return schemaResult;
|
|
5631
5626
|
}
|
|
5632
|
-
async function getSchemaFromPackageJson(cwd) {
|
|
5633
|
-
const prismaConfig = await (0, import_config.loadConfigFromPackageJson)(cwd);
|
|
5634
|
-
debug("prismaConfig", prismaConfig);
|
|
5635
|
-
if (!prismaConfig || !prismaConfig.config?.schema) {
|
|
5636
|
-
return { ok: false, error: { kind: "PackageJsonNotConfigured" } };
|
|
5637
|
-
}
|
|
5638
|
-
const schemaPathFromPkgJson = prismaConfig.config.schema;
|
|
5639
|
-
if (typeof schemaPathFromPkgJson !== "string") {
|
|
5640
|
-
throw new Error(
|
|
5641
|
-
`Provided schema path \`${schemaPathFromPkgJson}\` from \`${import_path2.default.relative(
|
|
5642
|
-
cwd,
|
|
5643
|
-
prismaConfig.loadedFromFile
|
|
5644
|
-
)}\` must be of type string`
|
|
5645
|
-
);
|
|
5646
|
-
}
|
|
5647
|
-
const absoluteSchemaPath = import_path2.default.isAbsolute(schemaPathFromPkgJson) ? schemaPathFromPkgJson : import_path2.default.resolve(import_path2.default.dirname(prismaConfig.loadedFromFile), schemaPathFromPkgJson);
|
|
5648
|
-
const lookupResult = await readSchemaFromFileOrDirectory(absoluteSchemaPath);
|
|
5649
|
-
if (!lookupResult.ok) {
|
|
5650
|
-
throw new Error(
|
|
5651
|
-
`Could not load schema from \`${import_path2.default.relative(
|
|
5652
|
-
cwd,
|
|
5653
|
-
absoluteSchemaPath
|
|
5654
|
-
)}\` provided by "prisma.schema" config of \`${import_path2.default.relative(
|
|
5655
|
-
cwd,
|
|
5656
|
-
prismaConfig.loadedFromFile
|
|
5657
|
-
)}\`: ${renderLookupError(lookupResult.error)}`
|
|
5658
|
-
);
|
|
5659
|
-
}
|
|
5660
|
-
return lookupResult;
|
|
5661
|
-
}
|
|
5662
5627
|
async function getDefaultSchema(cwd, failures = []) {
|
|
5663
5628
|
const lookupPaths = [import_path2.default.join(cwd, "schema.prisma"), import_path2.default.join(cwd, "prisma", "schema.prisma")];
|
|
5664
5629
|
for (const path3 of lookupPaths) {
|
|
@@ -5873,7 +5838,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
5873
5838
|
tag: "empty"
|
|
5874
5839
|
};
|
|
5875
5840
|
} else if (args["--from-schema-datasource"]) {
|
|
5876
|
-
|
|
5841
|
+
(0, import_internals.loadEnvFile)({ schemaPath: args["--from-schema-datasource"], printMessage: false, config });
|
|
5877
5842
|
const schemaContext = await (0, import_internals.loadSchemaContext)({
|
|
5878
5843
|
schemaPathFromArg: args["--from-schema-datasource"],
|
|
5879
5844
|
schemaPathArgumentName: "--from-schema-datasource",
|
|
@@ -5916,7 +5881,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
5916
5881
|
tag: "empty"
|
|
5917
5882
|
};
|
|
5918
5883
|
} else if (args["--to-schema-datasource"]) {
|
|
5919
|
-
|
|
5884
|
+
(0, import_internals.loadEnvFile)({ schemaPath: args["--to-schema-datasource"], printMessage: false, config });
|
|
5920
5885
|
const schemaContext = await (0, import_internals.loadSchemaContext)({
|
|
5921
5886
|
schemaPathFromArg: args["--to-schema-datasource"],
|
|
5922
5887
|
schemaPathArgumentName: "--to-schema-datasource",
|
|
@@ -5956,7 +5921,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
5956
5921
|
externalTables: config.tables?.external ?? [],
|
|
5957
5922
|
externalEnums: config.enums?.external ?? []
|
|
5958
5923
|
};
|
|
5959
|
-
const migrate = await
|
|
5924
|
+
const migrate = await import_chunk_MOFG2YPJ.Migrate.setup({
|
|
5960
5925
|
schemaEngineConfig: config,
|
|
5961
5926
|
schemaFilter,
|
|
5962
5927
|
extensions: config["extensions"]
|