@prisma/migrate 6.20.0-integration-next.3 → 6.20.0-integration-merge-release-workflows.2
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 +6 -6
- package/dist/SchemaEngineCLI.js +4 -4
- package/dist/SchemaEngineWasm.js +4 -4
- package/dist/bin.js +31 -30
- package/dist/{chunk-GH6IOZTT.js → chunk-22YP3RXZ.js} +7 -7
- package/dist/{chunk-4BAGKFIV.js → chunk-3AKRTEIK.js} +11 -10
- package/dist/{chunk-FBPXMCYK.js → chunk-6ORQRJLP.js} +109 -28
- package/dist/{chunk-EVUHOCOP.js → chunk-7TVX3D4W.js} +65 -27
- package/dist/{chunk-PEUHUCS4.js → chunk-AXR7LS2N.js} +5 -4
- package/dist/{chunk-EERZNF42.js → chunk-BHJMJSM4.js} +7 -6
- package/dist/{chunk-WF7UXKO5.js → chunk-D4TRX77Y.js} +9 -6
- package/dist/{chunk-V3D2XB5I.js → chunk-D6LYHB65.js} +29 -37
- package/dist/{chunk-BP3VX5NQ.js → chunk-F2XCBEZ4.js} +13 -10
- package/dist/{chunk-SYWL5XS4.js → chunk-GSX25HRL.js} +5 -5
- package/dist/{chunk-SFX5KEGP.js → chunk-J33EXHZB.js} +12 -9
- package/dist/{chunk-PQ3UMDEP.js → chunk-NB4FRYRQ.js} +5 -5
- package/dist/{chunk-BB43AVYJ.js → chunk-O35BTK6Y.js} +13 -9
- package/dist/{chunk-FRY7T46S.js → chunk-OP2BDF75.js} +11 -10
- package/dist/{chunk-L7EZFBB4.js → chunk-PHXLQVPT.js} +68 -40
- package/dist/{chunk-XA2JOJS2.js → chunk-QVMYNWAN.js} +70 -157
- package/dist/{chunk-Z7WLEGCP.js → chunk-R4IWP35Z.js} +9 -8
- package/dist/chunk-RR6BKMNO.js +80 -0
- package/dist/{chunk-6FL2LODV.js → chunk-TW22Y3AA.js} +7 -6
- package/dist/{chunk-T2ACIU5M.js → chunk-VU5BLQUI.js} +8 -14
- package/dist/{chunk-JX2HIV7V.js → chunk-VV4M6AN7.js} +10 -10
- package/dist/{chunk-GY34KW2I.js → chunk-Z27SI4AV.js} +4 -6
- package/dist/{chunk-QCMPSEBY.js → chunk-ZTIS675B.js} +205 -138
- package/dist/commands/DbDrop.js +2 -2
- package/dist/commands/DbExecute.js +7 -7
- package/dist/commands/DbPull.js +9 -8
- package/dist/commands/DbPush.js +7 -7
- package/dist/commands/DbSeed.js +3 -3
- package/dist/commands/MigrateDeploy.js +7 -7
- package/dist/commands/MigrateDev.js +8 -8
- package/dist/commands/MigrateDiff.js +7 -8
- package/dist/commands/MigrateReset.js +8 -8
- package/dist/commands/MigrateResolve.js +7 -7
- package/dist/commands/MigrateStatus.js +7 -7
- package/dist/index.js +37 -36
- package/dist/internals/src/cli/getSchema.d.ts +15 -1
- package/dist/migrate/src/Migrate.d.ts +2 -1
- package/dist/migrate/src/commands/MigrateDiff.d.ts +0 -1
- package/dist/migrate/src/utils/introspectSql.d.ts +1 -2
- 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 +7 -7
- package/dist/utils/introspectSql.js +7 -7
- package/dist/utils/replaceOrAddDatasource.js +25 -0
- package/dist/utils/replaceOrAddDatasource.test.js +207 -0
- package/dist/utils/seed.js +3 -2
- package/dist/utils/setupCockroach.js +2 -2
- package/dist/utils/setupMSSQL.js +30480 -31090
- package/dist/utils/setupMongo.js +768 -2048
- package/dist/utils/setupPostgres.js +2 -2
- package/dist/utils/spinner.js +3 -3
- package/dist/views/handleViewsIO.js +2 -2
- package/package.json +11 -11
- package/dist/open-GFNXULGD.js +0 -593
package/dist/Migrate.js
CHANGED
|
@@ -18,18 +18,18 @@ 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_JX2HIV7V = require("./chunk-JX2HIV7V.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");
|
|
30
|
-
var
|
|
31
|
-
var
|
|
32
|
-
var
|
|
30
|
+
var import_chunk_22YP3RXZ = require("./chunk-22YP3RXZ.js");
|
|
31
|
+
var import_chunk_GSX25HRL = require("./chunk-GSX25HRL.js");
|
|
32
|
+
var import_chunk_AXR7LS2N = require("./chunk-AXR7LS2N.js");
|
|
33
33
|
var import_chunk_L6KOIJJ5 = require("./chunk-L6KOIJJ5.js");
|
|
34
34
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
35
35
|
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
|
package/dist/SchemaEngineCLI.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 SchemaEngineCLI_exports = {};
|
|
20
20
|
__export(SchemaEngineCLI_exports, {
|
|
21
|
-
EngineError: () =>
|
|
22
|
-
SchemaEngineCLI: () =>
|
|
21
|
+
EngineError: () => import_chunk_GSX25HRL.EngineError,
|
|
22
|
+
SchemaEngineCLI: () => import_chunk_GSX25HRL.SchemaEngineCLI
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(SchemaEngineCLI_exports);
|
|
25
|
-
var
|
|
26
|
-
var
|
|
25
|
+
var import_chunk_GSX25HRL = require("./chunk-GSX25HRL.js");
|
|
26
|
+
var import_chunk_AXR7LS2N = require("./chunk-AXR7LS2N.js");
|
|
27
27
|
var import_chunk_L6KOIJJ5 = require("./chunk-L6KOIJJ5.js");
|
|
28
28
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
29
29
|
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
|
package/dist/SchemaEngineWasm.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 SchemaEngineWasm_exports = {};
|
|
20
20
|
__export(SchemaEngineWasm_exports, {
|
|
21
|
-
SchemaEngineWasm: () =>
|
|
21
|
+
SchemaEngineWasm: () => import_chunk_22YP3RXZ.SchemaEngineWasm
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(SchemaEngineWasm_exports);
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
var
|
|
24
|
+
var import_chunk_22YP3RXZ = require("./chunk-22YP3RXZ.js");
|
|
25
|
+
var import_chunk_GSX25HRL = require("./chunk-GSX25HRL.js");
|
|
26
|
+
var import_chunk_AXR7LS2N = require("./chunk-AXR7LS2N.js");
|
|
27
27
|
var import_chunk_L6KOIJJ5 = require("./chunk-L6KOIJJ5.js");
|
|
28
28
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
29
29
|
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
|
package/dist/bin.js
CHANGED
|
@@ -23,47 +23,48 @@ 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
|
|
41
|
-
var
|
|
39
|
+
var import_chunk_7TVX3D4W = require("./chunk-7TVX3D4W.js");
|
|
40
|
+
var import_chunk_6ORQRJLP = require("./chunk-6ORQRJLP.js");
|
|
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_JX2HIV7V = require("./chunk-JX2HIV7V.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");
|
|
64
|
-
var
|
|
65
|
-
var
|
|
66
|
-
var
|
|
65
|
+
var import_chunk_22YP3RXZ = require("./chunk-22YP3RXZ.js");
|
|
66
|
+
var import_chunk_GSX25HRL = require("./chunk-GSX25HRL.js");
|
|
67
|
+
var import_chunk_AXR7LS2N = require("./chunk-AXR7LS2N.js");
|
|
67
68
|
var import_chunk_L6KOIJJ5 = require("./chunk-L6KOIJJ5.js");
|
|
68
69
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
69
70
|
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.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.20.0-integration-
|
|
75
|
+
var version = "6.20.0-integration-merge-release-workflows.2";
|
|
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);
|
|
@@ -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_22YP3RXZ_exports = {};
|
|
30
|
+
__export(chunk_22YP3RXZ_exports, {
|
|
31
31
|
SchemaEngineWasm: () => SchemaEngineWasm
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
34
|
-
var
|
|
35
|
-
var
|
|
33
|
+
module.exports = __toCommonJS(chunk_22YP3RXZ_exports);
|
|
34
|
+
var import_chunk_GSX25HRL = require("./chunk-GSX25HRL.js");
|
|
35
|
+
var import_chunk_AXR7LS2N = require("./chunk-AXR7LS2N.js");
|
|
36
36
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
37
37
|
var import_debug = __toESM(require("@prisma/debug"));
|
|
38
38
|
var import_internals = require("@prisma/internals");
|
|
@@ -83,7 +83,7 @@ var SchemaEngineWasm = class _SchemaEngineWasm {
|
|
|
83
83
|
const { message, stack } = (0, import_internals.getWasmError)(e);
|
|
84
84
|
throw new import_internals.RustPanic(serializePanic(message), stack, command, import_internals.ErrorArea.LIFT_CLI);
|
|
85
85
|
} else if ("code" in error) {
|
|
86
|
-
throw new
|
|
86
|
+
throw new import_chunk_GSX25HRL.EngineError((0, import_chunk_SKRR5WT4.red)(`${error.code}
|
|
87
87
|
|
|
88
88
|
${(0, import_internals.relativizePathInPSLError)(error.message)}
|
|
89
89
|
`), error.code);
|
|
@@ -189,7 +189,7 @@ ${(0, import_internals.relativizePathInPSLError)(error.message)}
|
|
|
189
189
|
});
|
|
190
190
|
const { views } = introspectResult;
|
|
191
191
|
if (views) {
|
|
192
|
-
await (0,
|
|
192
|
+
await (0, import_chunk_AXR7LS2N.handleViewsIO)({ views, viewsDirectoryPath });
|
|
193
193
|
}
|
|
194
194
|
return introspectResult;
|
|
195
195
|
}
|
|
@@ -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 {
|
|
@@ -31,7 +31,7 @@ var MigrateResolve = class _MigrateResolve {
|
|
|
31
31
|
return new _MigrateResolve();
|
|
32
32
|
}
|
|
33
33
|
static help = (0, import_internals.format)(`
|
|
34
|
-
Resolve issues with database migrations in deployment databases:
|
|
34
|
+
Resolve issues with database migrations in deployment databases:
|
|
35
35
|
- recover from failed migrations
|
|
36
36
|
- baseline databases when starting to use Prisma Migrate on existing databases
|
|
37
37
|
- reconcile hotfixes done manually on databases with your migration history
|
|
@@ -39,11 +39,11 @@ Resolve issues with database migrations in deployment databases:
|
|
|
39
39
|
Run "prisma migrate status" to identify if you need to use resolve.
|
|
40
40
|
|
|
41
41
|
Read more about resolving migration history issues: ${(0, import_internals.link)("https://pris.ly/d/migrate-resolve")}
|
|
42
|
-
|
|
42
|
+
|
|
43
43
|
${(0, import_chunk_SKRR5WT4.bold)("Usage")}
|
|
44
44
|
|
|
45
45
|
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate resolve [options]
|
|
46
|
-
|
|
46
|
+
|
|
47
47
|
${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
48
48
|
|
|
49
49
|
-h, --help Display this help message
|
|
@@ -54,7 +54,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
|
54
54
|
|
|
55
55
|
${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
56
56
|
|
|
57
|
-
Update migrations table, recording a specific migration as applied
|
|
57
|
+
Update migrations table, recording a specific migration as applied
|
|
58
58
|
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate resolve --applied 20201231000000_add_users_table
|
|
59
59
|
|
|
60
60
|
Update migrations table, recording a specific migration as rolled back
|
|
@@ -83,6 +83,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
83
83
|
if (args["--help"]) {
|
|
84
84
|
return this.help();
|
|
85
85
|
}
|
|
86
|
+
await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
|
|
86
87
|
const schemaContext = await (0, import_internals.loadSchemaContext)({
|
|
87
88
|
schemaPathFromArg: args["--schema"],
|
|
88
89
|
schemaPathFromConfig: config.schema,
|
|
@@ -112,7 +113,7 @@ ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.green)((0, import_in
|
|
|
112
113
|
if (!adapter) {
|
|
113
114
|
await (0, import_chunk_74LUB4XX.ensureCanConnectToDatabase)(schemaContext.primaryDatasource);
|
|
114
115
|
}
|
|
115
|
-
const migrate = await
|
|
116
|
+
const migrate = await import_chunk_D6LYHB65.Migrate.setup({
|
|
116
117
|
schemaEngineConfig: config,
|
|
117
118
|
migrationsDirPath,
|
|
118
119
|
schemaContext,
|
|
@@ -138,7 +139,7 @@ Migration ${args["--applied"]} marked as applied.
|
|
|
138
139
|
);
|
|
139
140
|
}
|
|
140
141
|
await (0, import_chunk_74LUB4XX.ensureCanConnectToDatabase)(schemaContext.primaryDatasource);
|
|
141
|
-
const migrate = await
|
|
142
|
+
const migrate = await import_chunk_D6LYHB65.Migrate.setup({
|
|
142
143
|
schemaEngineConfig: config,
|
|
143
144
|
migrationsDirPath,
|
|
144
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(
|
|
34
|
-
var
|
|
33
|
+
module.exports = __toCommonJS(chunk_6ORQRJLP_exports);
|
|
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,8 @@ 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");
|
|
46
|
+
var import_chunk_AXR7LS2N = require("./chunk-AXR7LS2N.js");
|
|
45
47
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
46
48
|
var import_debug = __toESM(require("@prisma/debug"));
|
|
47
49
|
var import_internals = require("@prisma/internals");
|
|
@@ -105,21 +107,26 @@ Set composite types introspection depth to 2 levels
|
|
|
105
107
|
const args = (0, import_internals.arg)(argv, {
|
|
106
108
|
"--help": Boolean,
|
|
107
109
|
"-h": "--help",
|
|
110
|
+
"--url": String,
|
|
108
111
|
"--print": Boolean,
|
|
109
112
|
"--schema": String,
|
|
110
113
|
"--config": String,
|
|
111
114
|
"--schemas": String,
|
|
112
115
|
"--force": Boolean,
|
|
113
|
-
"--composite-type-depth": Number
|
|
116
|
+
"--composite-type-depth": Number,
|
|
114
117
|
// optional, only on mongodb
|
|
118
|
+
"--local-d1": Boolean
|
|
119
|
+
// optional, only on cloudflare D1
|
|
115
120
|
});
|
|
116
|
-
const spinnerFactory = (0,
|
|
121
|
+
const spinnerFactory = (0, import_chunk_VU5BLQUI.createSpinner)(!args["--print"]);
|
|
117
122
|
if (args instanceof Error) {
|
|
118
123
|
return this.help(args.message);
|
|
119
124
|
}
|
|
120
125
|
if (args["--help"]) {
|
|
121
126
|
return this.help();
|
|
122
127
|
}
|
|
128
|
+
const url = args["--url"];
|
|
129
|
+
await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: !args["--print"], config });
|
|
123
130
|
const schemaContext = await (0, import_internals.loadSchemaContext)({
|
|
124
131
|
schemaPathFromArg: args["--schema"],
|
|
125
132
|
schemaPathFromConfig: config.schema,
|
|
@@ -130,39 +137,111 @@ Set composite types introspection depth to 2 levels
|
|
|
130
137
|
const cmd = "db pull";
|
|
131
138
|
(0, import_internals.checkUnsupportedDataProxy)({
|
|
132
139
|
cmd,
|
|
133
|
-
schemaContext: schemaContext
|
|
140
|
+
schemaContext: schemaContext && !url ? schemaContext : void 0,
|
|
141
|
+
urls: [url]
|
|
142
|
+
});
|
|
143
|
+
(0, import_internals.checkUnsupportedSchemaEngineWasm)({
|
|
144
|
+
cmd,
|
|
145
|
+
config,
|
|
146
|
+
args,
|
|
147
|
+
flags: ["--url", "--local-d1"]
|
|
134
148
|
});
|
|
135
149
|
const adapter = config.engine === "js" ? await config.adapter() : void 0;
|
|
136
150
|
if (schemaContext && !args["--print"]) {
|
|
137
151
|
(0, import_internals.printSchemaLoadedMessage)(schemaContext.loadedFromPathForLogMessages);
|
|
138
152
|
(0, import_chunk_2FXU5NZQ.printDatasource)({ datasourceInfo: (0, import_chunk_74LUB4XX.parseDatasourceInfo)(schemaContext?.primaryDatasource), adapter });
|
|
139
153
|
}
|
|
140
|
-
|
|
154
|
+
const fromD1 = Boolean(args["--local-d1"]);
|
|
155
|
+
if (!url && !schemaContext && !fromD1) {
|
|
141
156
|
throw new import_chunk_3WC4XD74.NoSchemaFoundError();
|
|
142
157
|
}
|
|
143
|
-
const firstDatasource = schemaContext.
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
158
|
+
const { firstDatasource, schema, validationWarning } = await (0, import_chunk_AXR7LS2N.z)({ url, schemaContext, fromD1 }).when(
|
|
159
|
+
(input) => input.schemaContext !== null,
|
|
160
|
+
async (input) => {
|
|
161
|
+
const firstDatasource2 = input.schemaContext.primaryDatasource ? input.schemaContext.primaryDatasource : void 0;
|
|
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) {
|
|
179
|
+
const d1Database = await (0, import_internals.locateLocalCloudflareD1)({ arg: "--from-local-d1" });
|
|
180
|
+
const pathToSQLiteFile = import_path.default.relative(input.schemaContext.schemaRootDir, d1Database);
|
|
181
|
+
const schema2 = [
|
|
182
|
+
["schema.prisma", this.urlToDatasource(`file:${pathToSQLiteFile}`, "sqlite")]
|
|
183
|
+
];
|
|
184
|
+
const config2 = await (0, import_internals.getConfig)({
|
|
185
|
+
datamodel: schema2,
|
|
186
|
+
ignoreEnvVarErrors: true
|
|
187
|
+
});
|
|
188
|
+
return { firstDatasource: config2.datasources[0], schema: schema2, validationWarning: void 0 };
|
|
189
|
+
} else {
|
|
190
|
+
await (0, import_internals.getConfig)({
|
|
191
|
+
datamodel: input.schemaContext.schemaFiles,
|
|
192
|
+
ignoreEnvVarErrors: false
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
return { firstDatasource: firstDatasource2, schema: input.schemaContext.schemaFiles, validationWarning: void 0 };
|
|
196
|
+
}
|
|
197
|
+
).when(
|
|
198
|
+
(input) => input.fromD1 === true,
|
|
199
|
+
async (_) => {
|
|
200
|
+
const d1Database = await (0, import_internals.locateLocalCloudflareD1)({ arg: "--from-local-d1" });
|
|
201
|
+
const pathToSQLiteFile = import_path.default.relative(process.cwd(), d1Database);
|
|
202
|
+
const schemaContent = `generator client {
|
|
203
|
+
provider = "prisma-client-js"
|
|
204
|
+
}
|
|
205
|
+
${this.urlToDatasource(`file:${pathToSQLiteFile}`, "sqlite")}`;
|
|
206
|
+
const schema2 = [["schema.prisma", schemaContent]];
|
|
207
|
+
const config2 = await (0, import_internals.getConfig)({
|
|
208
|
+
datamodel: schema2,
|
|
209
|
+
ignoreEnvVarErrors: true
|
|
210
|
+
});
|
|
211
|
+
return { firstDatasource: config2.datasources[0], schema: schema2, validationWarning: void 0 };
|
|
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
|
+
}
|
|
224
|
+
).run();
|
|
225
|
+
if (schemaContext) {
|
|
226
|
+
const modelRegex = /\s*model\s*(\w+)\s*{/;
|
|
227
|
+
const isReintrospection = schemaContext.schemaFiles.some(([_, schema2]) => !!modelRegex.exec(schema2));
|
|
228
|
+
if (isReintrospection && !args["--force"] && firstDatasource?.provider === "mongodb") {
|
|
229
|
+
throw new Error(`Iterating on one schema using re-introspection with db pull is currently not supported with MongoDB provider.
|
|
152
230
|
You can explicitly ignore and override your current local schema file with ${(0, import_chunk_SKRR5WT4.green)(
|
|
153
|
-
|
|
154
|
-
|
|
231
|
+
(0, import_internals.getCommandWithExecutor)("prisma db pull --force")
|
|
232
|
+
)}
|
|
155
233
|
Some information will be lost (relations, comments, mapped fields, @ignore...), follow ${(0, import_internals.link)(
|
|
156
|
-
|
|
157
|
-
|
|
234
|
+
"https://github.com/prisma/prisma/issues/9585"
|
|
235
|
+
)} for more info.`);
|
|
236
|
+
}
|
|
158
237
|
}
|
|
159
|
-
const migrate = await
|
|
238
|
+
const migrate = await import_chunk_D6LYHB65.Migrate.setup({
|
|
160
239
|
schemaEngineConfig: config,
|
|
161
|
-
schemaContext,
|
|
240
|
+
schemaContext: schemaContext ?? void 0,
|
|
162
241
|
extensions: config["extensions"]
|
|
163
242
|
});
|
|
164
243
|
const engine = migrate.engine;
|
|
165
|
-
const basedOn =
|
|
244
|
+
const basedOn = !args["--url"] && schemaContext?.primaryDatasource ? ` based on datasource defined in ${(0, import_chunk_SKRR5WT4.underline)(schemaContext.loadedFromPathForLogMessages)}` : "";
|
|
166
245
|
const introspectionSpinner = spinnerFactory(`Introspecting${basedOn}`);
|
|
167
246
|
const before = Math.round(performance.now());
|
|
168
247
|
let introspectionSchema = void 0;
|
|
@@ -199,7 +278,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("To fix this, you have two options:")}
|
|
|
199
278
|
"schema.prisma"
|
|
200
279
|
)} points to a database that is not empty (it must contain at least one table).
|
|
201
280
|
|
|
202
|
-
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.
|
|
203
282
|
`);
|
|
204
283
|
} else if (e.code === "P1003") {
|
|
205
284
|
throw new Error(`
|
|
@@ -218,7 +297,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("To fix this, you have two options:")}
|
|
|
218
297
|
"schema.prisma"
|
|
219
298
|
)} points to an existing database.
|
|
220
299
|
|
|
221
|
-
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.
|
|
222
301
|
`);
|
|
223
302
|
} else if (e.code === "P1012") {
|
|
224
303
|
process.stdout.write("\n");
|
|
@@ -258,12 +337,14 @@ Or run this command with the ${(0, import_chunk_SKRR5WT4.green)(
|
|
|
258
337
|
modelsAndTypesMessage = `${modelsCountMessage}`;
|
|
259
338
|
}
|
|
260
339
|
const modelsAndTypesCountMessage = modelsCount + typesCount > 1 ? `${modelsAndTypesMessage} and wrote them` : `${modelsAndTypesMessage} and wrote it`;
|
|
340
|
+
const renderValidationWarning = validationWarning ? `
|
|
341
|
+
${(0, import_chunk_SKRR5WT4.yellow)(validationWarning)}` : "";
|
|
261
342
|
const introspectedSchemaPath = schemaContext?.loadedFromPathForLogMessages || introspectionSchema.files[0].path;
|
|
262
343
|
introspectionSpinner.success(`Introspected ${modelsAndTypesCountMessage} into ${(0, import_chunk_SKRR5WT4.underline)(
|
|
263
344
|
import_path.default.relative(process.cwd(), introspectedSchemaPath)
|
|
264
345
|
)} in ${(0, import_chunk_SKRR5WT4.bold)((0, import_internals.formatms)(Math.round(performance.now()) - before))}
|
|
265
346
|
${(0, import_chunk_SKRR5WT4.yellow)(introspectionWarningsMessage)}
|
|
266
|
-
${`Run ${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)("prisma generate"))} to generate Prisma Client.`}`);
|
|
347
|
+
${`Run ${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)("prisma generate"))} to generate Prisma Client.`}${renderValidationWarning}`);
|
|
267
348
|
}
|
|
268
349
|
return "";
|
|
269
350
|
}
|