@prisma/migrate 6.19.0-integration-next.15 → 6.19.0-integration-engines-6-19-0-31-next-6f525e2b254a97a9c547ae5f2b29c54a171f6b23.1
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 +27 -26
- package/dist/{chunk-NG4757TP.js → chunk-3AKRTEIK.js} +7 -7
- package/dist/{chunk-OPD3GTJ2.js → chunk-6ORQRJLP.js} +45 -14
- package/dist/{chunk-AP47ZTTC.js → chunk-7TVX3D4W.js} +65 -27
- package/dist/{chunk-ANMWKEMD.js → chunk-BHJMJSM4.js} +6 -6
- package/dist/{chunk-W2NKGYXF.js → chunk-D4TRX77Y.js} +9 -7
- package/dist/{chunk-MOFG2YPJ.js → chunk-D6LYHB65.js} +7 -5
- package/dist/{chunk-4LNQFWQD.js → chunk-F2XCBEZ4.js} +12 -10
- package/dist/{chunk-UJA5DXI3.js → chunk-J33EXHZB.js} +12 -10
- package/dist/{chunk-SIUB4YHK.js → chunk-NB4FRYRQ.js} +5 -5
- package/dist/{chunk-XAPRGBTZ.js → chunk-O35BTK6Y.js} +5 -5
- package/dist/{chunk-L7EZFBB4.js → chunk-PHXLQVPT.js} +68 -40
- package/dist/{chunk-Q66L2LFA.js → chunk-R4IWP35Z.js} +6 -6
- package/dist/chunk-RR6BKMNO.js +80 -0
- package/dist/{chunk-CQLPPAWH.js → chunk-TW22Y3AA.js} +7 -7
- package/dist/{chunk-43R3GFIU.js → chunk-Z27SI4AV.js} +4 -4
- package/dist/{chunk-HDTRNRXE.js → chunk-ZTIS675B.js} +42 -7
- package/dist/commands/DbDrop.js +2 -2
- package/dist/commands/DbExecute.js +4 -4
- package/dist/commands/DbPull.js +5 -4
- 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 +31 -30
- package/dist/internals/src/cli/getSchema.d.ts +15 -1
- package/dist/migrate/src/Migrate.d.ts +2 -1
- package/dist/migrate/src/utils/replaceOrAddDatasource.d.ts +2 -0
- package/dist/migrate/src/utils/replaceOrAddDatasource.test.d.ts +1 -0
- package/dist/migrate/src/utils/seed.d.ts +6 -0
- package/dist/utils/getDatabaseVersionSafe.js +4 -4
- package/dist/utils/introspectSql.js +4 -4
- package/dist/utils/replaceOrAddDatasource.js +25 -0
- package/dist/utils/replaceOrAddDatasource.test.js +207 -0
- package/dist/utils/seed.js +3 -2
- package/package.json +11 -11
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_D6LYHB65.Migrate
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(Migrate_exports);
|
|
24
|
-
var
|
|
25
|
-
var import_chunk_VV4M6AN7 = require("./chunk-VV4M6AN7.js");
|
|
24
|
+
var import_chunk_D6LYHB65 = require("./chunk-D6LYHB65.js");
|
|
26
25
|
var import_chunk_T64SUJ5L = require("./chunk-T64SUJ5L.js");
|
|
26
|
+
var import_chunk_VV4M6AN7 = require("./chunk-VV4M6AN7.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,41 +23,42 @@ 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_NB4FRYRQ = require("./chunk-NB4FRYRQ.js");
|
|
27
|
+
var import_chunk_BHJMJSM4 = require("./chunk-BHJMJSM4.js");
|
|
28
|
+
var import_chunk_F2XCBEZ4 = require("./chunk-F2XCBEZ4.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_ZTIS675B = require("./chunk-ZTIS675B.js");
|
|
32
32
|
var import_chunk_VAJ4VX67 = require("./chunk-VAJ4VX67.js");
|
|
33
|
-
var
|
|
33
|
+
var import_chunk_J33EXHZB = require("./chunk-J33EXHZB.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_3AKRTEIK = require("./chunk-3AKRTEIK.js");
|
|
37
|
+
var import_chunk_R4IWP35Z = require("./chunk-R4IWP35Z.js");
|
|
38
38
|
var import_chunk_EJG7GKM7 = require("./chunk-EJG7GKM7.js");
|
|
39
|
-
var
|
|
40
|
-
var
|
|
39
|
+
var import_chunk_7TVX3D4W = require("./chunk-7TVX3D4W.js");
|
|
40
|
+
var import_chunk_6ORQRJLP = require("./chunk-6ORQRJLP.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");
|
|
44
45
|
var import_chunk_RTGQXNX6 = require("./chunk-RTGQXNX6.js");
|
|
45
46
|
var import_chunk_JFKDSUIE = require("./chunk-JFKDSUIE.js");
|
|
46
47
|
var import_chunk_AI6DH66U = require("./chunk-AI6DH66U.js");
|
|
47
48
|
var import_chunk_LGYRZ6CV = require("./chunk-LGYRZ6CV.js");
|
|
48
49
|
var import_chunk_2R6DII47 = require("./chunk-2R6DII47.js");
|
|
49
|
-
var
|
|
50
|
+
var import_chunk_TW22Y3AA = require("./chunk-TW22Y3AA.js");
|
|
50
51
|
var import_chunk_FBDQVK4W = require("./chunk-FBDQVK4W.js");
|
|
51
52
|
var import_chunk_3WC4XD74 = require("./chunk-3WC4XD74.js");
|
|
52
53
|
var import_chunk_2FXU5NZQ = require("./chunk-2FXU5NZQ.js");
|
|
53
54
|
var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
|
|
54
55
|
var import_chunk_TWPTG4XS = require("./chunk-TWPTG4XS.js");
|
|
55
|
-
var
|
|
56
|
-
var
|
|
56
|
+
var import_chunk_D4TRX77Y = require("./chunk-D4TRX77Y.js");
|
|
57
|
+
var import_chunk_PHXLQVPT = require("./chunk-PHXLQVPT.js");
|
|
57
58
|
var import_chunk_LLO7YF56 = require("./chunk-LLO7YF56.js");
|
|
58
|
-
var
|
|
59
|
-
var import_chunk_VV4M6AN7 = require("./chunk-VV4M6AN7.js");
|
|
59
|
+
var import_chunk_D6LYHB65 = require("./chunk-D6LYHB65.js");
|
|
60
60
|
var import_chunk_T64SUJ5L = require("./chunk-T64SUJ5L.js");
|
|
61
|
+
var import_chunk_VV4M6AN7 = require("./chunk-VV4M6AN7.js");
|
|
61
62
|
var import_chunk_GGA2F64G = require("./chunk-GGA2F64G.js");
|
|
62
63
|
var import_chunk_23DZXSTI = require("./chunk-23DZXSTI.js");
|
|
63
64
|
var import_chunk_3WDCTXHL = require("./chunk-3WDCTXHL.js");
|
|
@@ -71,7 +72,7 @@ var import_config = require("@prisma/config");
|
|
|
71
72
|
var import_debug = __toESM(require("@prisma/debug"));
|
|
72
73
|
var import_engines_version = require("@prisma/engines-version");
|
|
73
74
|
var import_internals = require("@prisma/internals");
|
|
74
|
-
var version = "6.19.0-integration-next.
|
|
75
|
+
var version = "6.19.0-integration-engines-6-19-0-31-next-6f525e2b254a97a9c547ae5f2b29c54a171f6b23.1";
|
|
75
76
|
process.on("uncaughtException", (e) => {
|
|
76
77
|
console.log(e);
|
|
77
78
|
});
|
|
@@ -93,19 +94,19 @@ var args = (0, import_internals.arg)(
|
|
|
93
94
|
async function main() {
|
|
94
95
|
const cli = import_chunk_NGQA5JTN.CLI.new({
|
|
95
96
|
migrate: import_chunk_LLO7YF56.MigrateCommand.new({
|
|
96
|
-
dev:
|
|
97
|
-
status:
|
|
98
|
-
resolve:
|
|
99
|
-
reset:
|
|
100
|
-
deploy:
|
|
101
|
-
diff:
|
|
97
|
+
dev: import_chunk_F2XCBEZ4.MigrateDev.new(),
|
|
98
|
+
status: import_chunk_R4IWP35Z.MigrateStatus.new(),
|
|
99
|
+
resolve: import_chunk_3AKRTEIK.MigrateResolve.new(),
|
|
100
|
+
reset: import_chunk_J33EXHZB.MigrateReset.new(),
|
|
101
|
+
deploy: import_chunk_BHJMJSM4.MigrateDeploy.new(),
|
|
102
|
+
diff: import_chunk_ZTIS675B.MigrateDiff.new()
|
|
102
103
|
}),
|
|
103
104
|
db: import_chunk_EJG7GKM7.DbCommand.new({
|
|
104
|
-
execute:
|
|
105
|
-
pull:
|
|
106
|
-
push:
|
|
105
|
+
execute: import_chunk_7TVX3D4W.DbExecute.new(),
|
|
106
|
+
pull: import_chunk_6ORQRJLP.DbPull.new(),
|
|
107
|
+
push: import_chunk_TW22Y3AA.DbPush.new(),
|
|
107
108
|
// drop: DbDrop.new(),
|
|
108
|
-
seed:
|
|
109
|
+
seed: import_chunk_D4TRX77Y.DbSeed.new()
|
|
109
110
|
})
|
|
110
111
|
});
|
|
111
112
|
const { config, error } = await (0, import_config.loadConfigFromFile)({ configFile: args["--config"] });
|
|
@@ -135,7 +136,7 @@ main().then((code) => {
|
|
|
135
136
|
cliVersion: version,
|
|
136
137
|
enginesVersion: import_engines_version.enginesVersion,
|
|
137
138
|
command: commandArray.join(" "),
|
|
138
|
-
getDatabaseVersionSafe:
|
|
139
|
+
getDatabaseVersionSafe: import_chunk_NB4FRYRQ.getDatabaseVersionSafe
|
|
139
140
|
}).catch((e) => {
|
|
140
141
|
if (import_debug.default.enabled("migrate")) {
|
|
141
142
|
console.error((0, import_chunk_SKRR5WT4.red)((0, import_chunk_SKRR5WT4.bold)("Error: ")) + e.stack);
|
|
@@ -16,14 +16,14 @@ 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_3AKRTEIK_exports = {};
|
|
20
|
+
__export(chunk_3AKRTEIK_exports, {
|
|
21
21
|
MigrateResolve: () => MigrateResolve
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
23
|
+
module.exports = __toCommonJS(chunk_3AKRTEIK_exports);
|
|
24
24
|
var import_chunk_2FXU5NZQ = require("./chunk-2FXU5NZQ.js");
|
|
25
25
|
var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
|
|
26
|
-
var
|
|
26
|
+
var import_chunk_D6LYHB65 = require("./chunk-D6LYHB65.js");
|
|
27
27
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
28
28
|
var import_internals = require("@prisma/internals");
|
|
29
29
|
var MigrateResolve = class _MigrateResolve {
|
|
@@ -83,7 +83,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
83
83
|
if (args["--help"]) {
|
|
84
84
|
return this.help();
|
|
85
85
|
}
|
|
86
|
-
(0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
|
|
86
|
+
await (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,
|
|
@@ -113,7 +113,7 @@ ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.green)((0, import_in
|
|
|
113
113
|
if (!adapter) {
|
|
114
114
|
await (0, import_chunk_74LUB4XX.ensureCanConnectToDatabase)(schemaContext.primaryDatasource);
|
|
115
115
|
}
|
|
116
|
-
const migrate = await
|
|
116
|
+
const migrate = await import_chunk_D6LYHB65.Migrate.setup({
|
|
117
117
|
schemaEngineConfig: config,
|
|
118
118
|
migrationsDirPath,
|
|
119
119
|
schemaContext,
|
|
@@ -139,7 +139,7 @@ Migration ${args["--applied"]} marked as applied.
|
|
|
139
139
|
);
|
|
140
140
|
}
|
|
141
141
|
await (0, import_chunk_74LUB4XX.ensureCanConnectToDatabase)(schemaContext.primaryDatasource);
|
|
142
|
-
const migrate = await
|
|
142
|
+
const migrate = await import_chunk_D6LYHB65.Migrate.setup({
|
|
143
143
|
schemaEngineConfig: config,
|
|
144
144
|
migrationsDirPath,
|
|
145
145
|
schemaContext,
|
|
@@ -26,14 +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_6ORQRJLP_exports = {};
|
|
30
|
+
__export(chunk_6ORQRJLP_exports, {
|
|
31
31
|
DbPull: () => DbPull
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(chunk_6ORQRJLP_exports);
|
|
34
34
|
var import_chunk_VU5BLQUI = require("./chunk-VU5BLQUI.js");
|
|
35
35
|
var import_chunk_AHJ2N6BJ = require("./chunk-AHJ2N6BJ.js");
|
|
36
36
|
var import_chunk_JZ75RIMZ = require("./chunk-JZ75RIMZ.js");
|
|
37
|
+
var import_chunk_RR6BKMNO = require("./chunk-RR6BKMNO.js");
|
|
37
38
|
var import_chunk_RTGQXNX6 = require("./chunk-RTGQXNX6.js");
|
|
38
39
|
var import_chunk_JFKDSUIE = require("./chunk-JFKDSUIE.js");
|
|
39
40
|
var import_chunk_AI6DH66U = require("./chunk-AI6DH66U.js");
|
|
@@ -41,7 +42,7 @@ var import_chunk_LGYRZ6CV = require("./chunk-LGYRZ6CV.js");
|
|
|
41
42
|
var import_chunk_3WC4XD74 = require("./chunk-3WC4XD74.js");
|
|
42
43
|
var import_chunk_2FXU5NZQ = require("./chunk-2FXU5NZQ.js");
|
|
43
44
|
var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
|
|
44
|
-
var
|
|
45
|
+
var import_chunk_D6LYHB65 = require("./chunk-D6LYHB65.js");
|
|
45
46
|
var import_chunk_AXR7LS2N = require("./chunk-AXR7LS2N.js");
|
|
46
47
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
47
48
|
var import_debug = __toESM(require("@prisma/debug"));
|
|
@@ -106,6 +107,7 @@ Set composite types introspection depth to 2 levels
|
|
|
106
107
|
const args = (0, import_internals.arg)(argv, {
|
|
107
108
|
"--help": Boolean,
|
|
108
109
|
"-h": "--help",
|
|
110
|
+
"--url": String,
|
|
109
111
|
"--print": Boolean,
|
|
110
112
|
"--schema": String,
|
|
111
113
|
"--config": String,
|
|
@@ -123,7 +125,8 @@ Set composite types introspection depth to 2 levels
|
|
|
123
125
|
if (args["--help"]) {
|
|
124
126
|
return this.help();
|
|
125
127
|
}
|
|
126
|
-
|
|
128
|
+
const url = args["--url"];
|
|
129
|
+
await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: !args["--print"], config });
|
|
127
130
|
const schemaContext = await (0, import_internals.loadSchemaContext)({
|
|
128
131
|
schemaPathFromArg: args["--schema"],
|
|
129
132
|
schemaPathFromConfig: config.schema,
|
|
@@ -134,13 +137,14 @@ Set composite types introspection depth to 2 levels
|
|
|
134
137
|
const cmd = "db pull";
|
|
135
138
|
(0, import_internals.checkUnsupportedDataProxy)({
|
|
136
139
|
cmd,
|
|
137
|
-
schemaContext: schemaContext
|
|
140
|
+
schemaContext: schemaContext && !url ? schemaContext : void 0,
|
|
141
|
+
urls: [url]
|
|
138
142
|
});
|
|
139
143
|
(0, import_internals.checkUnsupportedSchemaEngineWasm)({
|
|
140
144
|
cmd,
|
|
141
145
|
config,
|
|
142
146
|
args,
|
|
143
|
-
flags: ["--local-d1"]
|
|
147
|
+
flags: ["--url", "--local-d1"]
|
|
144
148
|
});
|
|
145
149
|
const adapter = config.engine === "js" ? await config.adapter() : void 0;
|
|
146
150
|
if (schemaContext && !args["--print"]) {
|
|
@@ -148,14 +152,30 @@ Set composite types introspection depth to 2 levels
|
|
|
148
152
|
(0, import_chunk_2FXU5NZQ.printDatasource)({ datasourceInfo: (0, import_chunk_74LUB4XX.parseDatasourceInfo)(schemaContext?.primaryDatasource), adapter });
|
|
149
153
|
}
|
|
150
154
|
const fromD1 = Boolean(args["--local-d1"]);
|
|
151
|
-
if (!schemaContext && !fromD1) {
|
|
155
|
+
if (!url && !schemaContext && !fromD1) {
|
|
152
156
|
throw new import_chunk_3WC4XD74.NoSchemaFoundError();
|
|
153
157
|
}
|
|
154
|
-
const { firstDatasource, schema, validationWarning } = await (0, import_chunk_AXR7LS2N.z)({ schemaContext, fromD1 }).when(
|
|
158
|
+
const { firstDatasource, schema, validationWarning } = await (0, import_chunk_AXR7LS2N.z)({ url, schemaContext, fromD1 }).when(
|
|
155
159
|
(input) => input.schemaContext !== null,
|
|
156
160
|
async (input) => {
|
|
157
161
|
const firstDatasource2 = input.schemaContext.primaryDatasource ? input.schemaContext.primaryDatasource : void 0;
|
|
158
|
-
if (input.
|
|
162
|
+
if (input.url) {
|
|
163
|
+
let providerFromSchema = firstDatasource2?.provider;
|
|
164
|
+
if (providerFromSchema === "postgres") {
|
|
165
|
+
providerFromSchema = "postgresql";
|
|
166
|
+
}
|
|
167
|
+
const providerFromUrl = (0, import_internals.protocolToConnectorType)(`${input.url.split(":")[0]}:`);
|
|
168
|
+
const schema2 = (0, import_chunk_RR6BKMNO.replaceOrAddDatasource)(
|
|
169
|
+
this.urlToDatasource(input.url, providerFromSchema),
|
|
170
|
+
input.schemaContext.schemaFiles
|
|
171
|
+
);
|
|
172
|
+
if (providerFromSchema && providerFromUrl && providerFromSchema !== providerFromUrl && Boolean(providerFromSchema === "cockroachdb" && providerFromUrl === "postgresql") === false) {
|
|
173
|
+
throw new Error(
|
|
174
|
+
`The database provider found in --url (${providerFromUrl}) is different from the provider found in the Prisma schema (${providerFromSchema}).`
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
return { firstDatasource: firstDatasource2, schema: schema2, validationWarning: void 0 };
|
|
178
|
+
} else if (input.fromD1) {
|
|
159
179
|
const d1Database = await (0, import_internals.locateLocalCloudflareD1)({ arg: "--from-local-d1" });
|
|
160
180
|
const pathToSQLiteFile = import_path.default.relative(input.schemaContext.schemaRootDir, d1Database);
|
|
161
181
|
const schema2 = [
|
|
@@ -190,6 +210,17 @@ ${this.urlToDatasource(`file:${pathToSQLiteFile}`, "sqlite")}`;
|
|
|
190
210
|
});
|
|
191
211
|
return { firstDatasource: config2.datasources[0], schema: schema2, validationWarning: void 0 };
|
|
192
212
|
}
|
|
213
|
+
).when(
|
|
214
|
+
(input) => input.url !== void 0,
|
|
215
|
+
async (input) => {
|
|
216
|
+
(0, import_internals.protocolToConnectorType)(`${input.url.split(":")[0]}:`);
|
|
217
|
+
const schema2 = [["schema.prisma", this.urlToDatasource(input.url)]];
|
|
218
|
+
const config2 = await (0, import_internals.getConfig)({
|
|
219
|
+
datamodel: schema2,
|
|
220
|
+
ignoreEnvVarErrors: true
|
|
221
|
+
});
|
|
222
|
+
return { firstDatasource: config2.datasources[0], schema: schema2, validationWarning: void 0 };
|
|
223
|
+
}
|
|
193
224
|
).run();
|
|
194
225
|
if (schemaContext) {
|
|
195
226
|
const modelRegex = /\s*model\s*(\w+)\s*{/;
|
|
@@ -204,13 +235,13 @@ Some information will be lost (relations, comments, mapped fields, @ignore...),
|
|
|
204
235
|
)} for more info.`);
|
|
205
236
|
}
|
|
206
237
|
}
|
|
207
|
-
const migrate = await
|
|
238
|
+
const migrate = await import_chunk_D6LYHB65.Migrate.setup({
|
|
208
239
|
schemaEngineConfig: config,
|
|
209
240
|
schemaContext: schemaContext ?? void 0,
|
|
210
241
|
extensions: config["extensions"]
|
|
211
242
|
});
|
|
212
243
|
const engine = migrate.engine;
|
|
213
|
-
const basedOn = schemaContext?.primaryDatasource ? ` based on datasource defined in ${(0, import_chunk_SKRR5WT4.underline)(schemaContext.loadedFromPathForLogMessages)}` : "";
|
|
244
|
+
const basedOn = !args["--url"] && schemaContext?.primaryDatasource ? ` based on datasource defined in ${(0, import_chunk_SKRR5WT4.underline)(schemaContext.loadedFromPathForLogMessages)}` : "";
|
|
214
245
|
const introspectionSpinner = spinnerFactory(`Introspecting${basedOn}`);
|
|
215
246
|
const before = Math.round(performance.now());
|
|
216
247
|
let introspectionSchema = void 0;
|
|
@@ -247,7 +278,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("To fix this, you have two options:")}
|
|
|
247
278
|
"schema.prisma"
|
|
248
279
|
)} points to a database that is not empty (it must contain at least one table).
|
|
249
280
|
|
|
250
|
-
Then you can run ${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)("prisma db pull"))} again.
|
|
281
|
+
Then you can run ${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)("prisma db pull"))} again.
|
|
251
282
|
`);
|
|
252
283
|
} else if (e.code === "P1003") {
|
|
253
284
|
throw new Error(`
|
|
@@ -266,7 +297,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("To fix this, you have two options:")}
|
|
|
266
297
|
"schema.prisma"
|
|
267
298
|
)} points to an existing database.
|
|
268
299
|
|
|
269
|
-
Then you can run ${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)("prisma db pull"))} again.
|
|
300
|
+
Then you can run ${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)("prisma db pull"))} again.
|
|
270
301
|
`);
|
|
271
302
|
} else if (e.code === "P1012") {
|
|
272
303
|
process.stdout.write("\n");
|
|
@@ -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_7TVX3D4W_exports = {};
|
|
30
|
+
__export(chunk_7TVX3D4W_exports, {
|
|
31
31
|
DbExecute: () => DbExecute
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
34
|
-
var
|
|
33
|
+
module.exports = __toCommonJS(chunk_7TVX3D4W_exports);
|
|
34
|
+
var import_chunk_D6LYHB65 = require("./chunk-D6LYHB65.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,7 +47,9 @@ ${(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
|
-
|
|
50
|
+
${(0, import_chunk_SKRR5WT4.italic)("Datasource input, only 1 must be provided:")}
|
|
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
|
|
51
53
|
|
|
52
54
|
${(0, import_chunk_SKRR5WT4.italic)("Script input, only 1 must be provided:")}
|
|
53
55
|
--file Path to a file. The content will be sent as the script to be executed
|
|
@@ -66,11 +68,11 @@ var DbExecute = class _DbExecute {
|
|
|
66
68
|
static help = (0, import_internals.format)(`
|
|
67
69
|
${process.platform === "win32" ? "" : "\u{1F4DD} "}Execute native commands to your database
|
|
68
70
|
|
|
69
|
-
This command takes as input a datasource
|
|
71
|
+
This command takes as input a datasource, using ${(0, import_chunk_SKRR5WT4.green)(`--url`)} or ${(0, import_chunk_SKRR5WT4.green)(`--schema`)} and a script, using ${(0, import_chunk_SKRR5WT4.green)(
|
|
70
72
|
`--stdin`
|
|
71
73
|
)} or ${(0, import_chunk_SKRR5WT4.green)(`--file`)}.
|
|
72
|
-
The
|
|
73
|
-
|
|
74
|
+
The input parameters are mutually exclusive, only 1 of each (datasource & script) must be provided.
|
|
75
|
+
|
|
74
76
|
The output of the command is connector-specific, and is not meant for returning data, but only to report success or failure.
|
|
75
77
|
|
|
76
78
|
On SQL databases, this command takes as input a SQL script.
|
|
@@ -80,14 +82,23 @@ ${(0, import_chunk_SKRR5WT4.italic)(`This command is currently not supported on
|
|
|
80
82
|
|
|
81
83
|
${helpOptions}
|
|
82
84
|
${(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
|
|
83
90
|
|
|
84
|
-
Execute the
|
|
85
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
91
|
+
Execute the SQL script from stdin to the datasource URL specified via the \`DATABASE_URL\` environment variable
|
|
92
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} echo 'TRUNCATE TABLE dev;' | \\
|
|
93
|
+
prisma db execute \\
|
|
94
|
+
--stdin \\
|
|
95
|
+
--url="$DATABASE_URL"
|
|
86
96
|
|
|
87
|
-
|
|
97
|
+
Like previous example, but exposing the datasource url credentials to your terminal history
|
|
88
98
|
${(0, import_chunk_SKRR5WT4.dim)("$")} echo 'TRUNCATE TABLE dev;' | \\
|
|
89
99
|
prisma db execute \\
|
|
90
|
-
--stdin
|
|
100
|
+
--stdin \\
|
|
101
|
+
--url="mysql://root:root@localhost/mydb"
|
|
91
102
|
`);
|
|
92
103
|
async parse(argv, config) {
|
|
93
104
|
const args = (0, import_internals.arg)(
|
|
@@ -98,6 +109,8 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
98
109
|
"--config": String,
|
|
99
110
|
"--stdin": Boolean,
|
|
100
111
|
"--file": String,
|
|
112
|
+
"--schema": String,
|
|
113
|
+
"--url": String,
|
|
101
114
|
"--telemetry-information": String
|
|
102
115
|
},
|
|
103
116
|
false
|
|
@@ -108,15 +121,33 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
108
121
|
if (args["--help"]) {
|
|
109
122
|
return this.help();
|
|
110
123
|
}
|
|
124
|
+
await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: false, config });
|
|
111
125
|
const cmd = "db execute";
|
|
126
|
+
(0, import_internals.checkUnsupportedSchemaEngineWasm)({
|
|
127
|
+
cmd,
|
|
128
|
+
config,
|
|
129
|
+
args,
|
|
130
|
+
flags: ["--url"]
|
|
131
|
+
});
|
|
112
132
|
if (args["--stdin"] && args["--file"]) {
|
|
113
133
|
throw new Error(
|
|
114
|
-
`--stdin and --file cannot be used at the same time. Only 1 must be provided.
|
|
134
|
+
`--stdin and --file cannot be used at the same time. Only 1 must be provided.
|
|
115
135
|
See \`${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)("prisma db execute -h"))}\``
|
|
116
136
|
);
|
|
117
137
|
} else if (!args["--stdin"] && !args["--file"]) {
|
|
118
138
|
throw new Error(
|
|
119
139
|
`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.
|
|
120
151
|
See \`${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)("prisma db execute -h"))}\``
|
|
121
152
|
);
|
|
122
153
|
}
|
|
@@ -136,21 +167,28 @@ See \`${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExec
|
|
|
136
167
|
if (args["--stdin"]) {
|
|
137
168
|
script = await import_consumers.default.text(process.stdin);
|
|
138
169
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
170
|
+
let datasourceType;
|
|
171
|
+
if (args["--url"]) {
|
|
172
|
+
(0, import_internals.checkUnsupportedDataProxy)({ cmd, urls: [args["--url"]] });
|
|
173
|
+
datasourceType = {
|
|
174
|
+
tag: "url",
|
|
175
|
+
url: args["--url"]
|
|
176
|
+
};
|
|
177
|
+
} else {
|
|
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
|
+
};
|
|
147
190
|
}
|
|
148
|
-
|
|
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"] });
|
|
191
|
+
const migrate = await import_chunk_D6LYHB65.Migrate.setup({ schemaEngineConfig: config, extensions: config["extensions"] });
|
|
154
192
|
try {
|
|
155
193
|
await migrate.engine.dbExecute({
|
|
156
194
|
script,
|
|
@@ -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_BHJMJSM4_exports = {};
|
|
30
|
+
__export(chunk_BHJMJSM4_exports, {
|
|
31
31
|
MigrateDeploy: () => MigrateDeploy
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(chunk_BHJMJSM4_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_D6LYHB65 = require("./chunk-D6LYHB65.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
|
-
(0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
|
|
86
|
+
await (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_D6LYHB65.Migrate.setup({
|
|
101
101
|
schemaEngineConfig: config,
|
|
102
102
|
migrationsDirPath,
|
|
103
103
|
schemaContext,
|
|
@@ -16,12 +16,12 @@ 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_D4TRX77Y_exports = {};
|
|
20
|
+
__export(chunk_D4TRX77Y_exports, {
|
|
21
21
|
DbSeed: () => DbSeed
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
24
|
-
var
|
|
23
|
+
module.exports = __toCommonJS(chunk_D4TRX77Y_exports);
|
|
24
|
+
var import_chunk_PHXLQVPT = require("./chunk-PHXLQVPT.js");
|
|
25
25
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
26
26
|
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
|
|
27
27
|
var import_internals = require("@prisma/internals");
|
|
@@ -213,11 +213,13 @@ ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db seed -- --arg1 value1 --arg2 va
|
|
|
213
213
|
if (args["--help"]) {
|
|
214
214
|
return this.help();
|
|
215
215
|
}
|
|
216
|
-
(0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
|
|
217
|
-
const
|
|
216
|
+
await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
|
|
217
|
+
const seedCommandFromPrismaConfig = config.migrations?.seed;
|
|
218
|
+
const seedCommandFromPkgJson = await (0, import_chunk_PHXLQVPT.getSeedCommandFromPackageJson)(process.cwd());
|
|
219
|
+
const seedCommand = seedCommandFromPrismaConfig ?? seedCommandFromPkgJson;
|
|
218
220
|
if (!seedCommand) return ``;
|
|
219
221
|
const extraArgs = args._.join(" ");
|
|
220
|
-
const successfulSeeding = await (0,
|
|
222
|
+
const successfulSeeding = await (0, import_chunk_PHXLQVPT.executeSeedCommand)({ commandFromConfig: seedCommand, extraArgs });
|
|
221
223
|
if (successfulSeeding) {
|
|
222
224
|
return `
|
|
223
225
|
${process.platform === "win32" ? "" : "\u{1F331} "}The seed command has been executed.`;
|
|
@@ -26,13 +26,13 @@ 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_D6LYHB65_exports = {};
|
|
30
|
+
__export(chunk_D6LYHB65_exports, {
|
|
31
31
|
Migrate: () => Migrate
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
34
|
-
var import_chunk_VV4M6AN7 = require("./chunk-VV4M6AN7.js");
|
|
33
|
+
module.exports = __toCommonJS(chunk_D6LYHB65_exports);
|
|
35
34
|
var import_chunk_T64SUJ5L = require("./chunk-T64SUJ5L.js");
|
|
35
|
+
var import_chunk_VV4M6AN7 = require("./chunk-VV4M6AN7.js");
|
|
36
36
|
var import_chunk_GGA2F64G = require("./chunk-GGA2F64G.js");
|
|
37
37
|
var import_chunk_23DZXSTI = require("./chunk-23DZXSTI.js");
|
|
38
38
|
var import_chunk_22YP3RXZ = require("./chunk-22YP3RXZ.js");
|
|
@@ -874,8 +874,9 @@ var Migrate = class _Migrate {
|
|
|
874
874
|
unexecutable
|
|
875
875
|
};
|
|
876
876
|
}
|
|
877
|
-
async tryToRunGenerate() {
|
|
877
|
+
async tryToRunGenerate(datasourceInfo) {
|
|
878
878
|
if (!this.schemaContext) throw new Error("this.schemaContext is undefined");
|
|
879
|
+
const skipEngines = (0, import_internals.isPrismaPostgres)(datasourceInfo.url);
|
|
879
880
|
const message = [];
|
|
880
881
|
process.stdout.write("\n");
|
|
881
882
|
log_update_default(`Running generate... ${(0, import_chunk_SKRR5WT4.dim)("(Use --skip-generate to skip the generators)")}`);
|
|
@@ -883,6 +884,7 @@ var Migrate = class _Migrate {
|
|
|
883
884
|
schemaContext: this.schemaContext,
|
|
884
885
|
printDownloadProgress: true,
|
|
885
886
|
version: import_engines_version.enginesVersion,
|
|
887
|
+
noEngine: skipEngines,
|
|
886
888
|
registry: import_client_generator_registry.defaultRegistry.toInternal()
|
|
887
889
|
});
|
|
888
890
|
for (const generator of generators) {
|
|
@@ -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_F2XCBEZ4_exports = {};
|
|
30
|
+
__export(chunk_F2XCBEZ4_exports, {
|
|
31
31
|
MigrateDev: () => MigrateDev
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(chunk_F2XCBEZ4_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_PHXLQVPT = require("./chunk-PHXLQVPT.js");
|
|
42
|
+
var import_chunk_D6LYHB65 = require("./chunk-D6LYHB65.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
|
-
(0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
|
|
103
|
+
await (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_D6LYHB65.Migrate.setup({
|
|
128
128
|
schemaEngineConfig: config,
|
|
129
129
|
migrationsDirPath,
|
|
130
130
|
schemaContext,
|
|
@@ -281,15 +281,17 @@ ${(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(datasourceInfo);
|
|
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
|
|
289
|
+
const seedCommandFromPrismaConfig = config.migrations?.seed;
|
|
290
|
+
const seedCommandFromPkgJson = await (0, import_chunk_PHXLQVPT.getSeedCommandFromPackageJson)(process.cwd());
|
|
291
|
+
const seedCommand = seedCommandFromPrismaConfig ?? seedCommandFromPkgJson;
|
|
290
292
|
if (seedCommand) {
|
|
291
293
|
process.stdout.write("\n");
|
|
292
|
-
const successfulSeeding = await (0,
|
|
294
|
+
const successfulSeeding = await (0, import_chunk_PHXLQVPT.executeSeedCommand)({ commandFromConfig: seedCommand });
|
|
293
295
|
if (successfulSeeding) {
|
|
294
296
|
process.stdout.write(`
|
|
295
297
|
${process.platform === "win32" ? "" : "\u{1F331} "}The seed command has been executed.
|