@prisma/migrate 6.19.0-integration-engines-6-19-0-1-push-qtpkxwkvolmz-389b05cecb76e4e93db0ae07c19800226f238242.1 → 6.19.0-integration-next.5
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-ZTIS675B.js → chunk-55CU3CV4.js} +7 -42
- package/dist/{chunk-3AKRTEIK.js → chunk-AVDCAVMB.js} +7 -7
- package/dist/{chunk-O35BTK6Y.js → chunk-EDBWBKKM.js} +5 -5
- package/dist/{chunk-F2XCBEZ4.js → chunk-F4ENFSD2.js} +9 -11
- package/dist/{chunk-6ORQRJLP.js → chunk-I2VUHLTD.js} +14 -45
- package/dist/{chunk-PHXLQVPT.js → chunk-L7EZFBB4.js} +40 -68
- package/dist/{chunk-J33EXHZB.js → chunk-NX7CVZ33.js} +9 -11
- package/dist/{chunk-7TVX3D4W.js → chunk-RF72HHCJ.js} +6 -6
- package/dist/{chunk-D6LYHB65.js → chunk-RMMTCJSW.js} +4 -4
- package/dist/{chunk-TW22Y3AA.js → chunk-TIVQQZRQ.js} +6 -6
- package/dist/{chunk-BHJMJSM4.js → chunk-TVLHBYPV.js} +6 -6
- package/dist/{chunk-D4TRX77Y.js → chunk-W2NKGYXF.js} +7 -9
- package/dist/{chunk-R4IWP35Z.js → chunk-YB32XZV6.js} +6 -6
- package/dist/{chunk-NB4FRYRQ.js → chunk-ZBQSD3YW.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/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_RMMTCJSW.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_RMMTCJSW = require("./chunk-RMMTCJSW.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_ZBQSD3YW = require("./chunk-ZBQSD3YW.js");
|
|
27
|
+
var import_chunk_TVLHBYPV = require("./chunk-TVLHBYPV.js");
|
|
28
|
+
var import_chunk_F4ENFSD2 = require("./chunk-F4ENFSD2.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_55CU3CV4 = require("./chunk-55CU3CV4.js");
|
|
32
32
|
var import_chunk_VAJ4VX67 = require("./chunk-VAJ4VX67.js");
|
|
33
|
-
var
|
|
33
|
+
var import_chunk_NX7CVZ33 = require("./chunk-NX7CVZ33.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_AVDCAVMB = require("./chunk-AVDCAVMB.js");
|
|
37
|
+
var import_chunk_YB32XZV6 = require("./chunk-YB32XZV6.js");
|
|
38
38
|
var import_chunk_EJG7GKM7 = require("./chunk-EJG7GKM7.js");
|
|
39
|
-
var
|
|
40
|
-
var
|
|
39
|
+
var import_chunk_RF72HHCJ = require("./chunk-RF72HHCJ.js");
|
|
40
|
+
var import_chunk_I2VUHLTD = require("./chunk-I2VUHLTD.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_TIVQQZRQ = require("./chunk-TIVQQZRQ.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_RMMTCJSW = require("./chunk-RMMTCJSW.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.5";
|
|
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_F4ENFSD2.MigrateDev.new(),
|
|
97
|
+
status: import_chunk_YB32XZV6.MigrateStatus.new(),
|
|
98
|
+
resolve: import_chunk_AVDCAVMB.MigrateResolve.new(),
|
|
99
|
+
reset: import_chunk_NX7CVZ33.MigrateReset.new(),
|
|
100
|
+
deploy: import_chunk_TVLHBYPV.MigrateDeploy.new(),
|
|
101
|
+
diff: import_chunk_55CU3CV4.MigrateDiff.new()
|
|
103
102
|
}),
|
|
104
103
|
db: import_chunk_EJG7GKM7.DbCommand.new({
|
|
105
|
-
execute:
|
|
106
|
-
pull:
|
|
107
|
-
push:
|
|
104
|
+
execute: import_chunk_RF72HHCJ.DbExecute.new(),
|
|
105
|
+
pull: import_chunk_I2VUHLTD.DbPull.new(),
|
|
106
|
+
push: import_chunk_TIVQQZRQ.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_ZBQSD3YW.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,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_55CU3CV4_exports = {};
|
|
30
|
+
__export(chunk_55CU3CV4_exports, {
|
|
31
31
|
MigrateDiff: () => MigrateDiff
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(chunk_55CU3CV4_exports);
|
|
34
34
|
var import_chunk_VAJ4VX67 = require("./chunk-VAJ4VX67.js");
|
|
35
|
-
var
|
|
35
|
+
var import_chunk_RMMTCJSW = require("./chunk-RMMTCJSW.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_RMMTCJSW.Migrate.setup({
|
|
5960
5925
|
schemaEngineConfig: config,
|
|
5961
5926
|
schemaFilter,
|
|
5962
5927
|
extensions: config["extensions"]
|
|
@@ -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_AVDCAVMB_exports = {};
|
|
20
|
+
__export(chunk_AVDCAVMB_exports, {
|
|
21
21
|
MigrateResolve: () => MigrateResolve
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
23
|
+
module.exports = __toCommonJS(chunk_AVDCAVMB_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_RMMTCJSW = require("./chunk-RMMTCJSW.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
|
-
|
|
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,
|
|
@@ -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_RMMTCJSW.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_RMMTCJSW.Migrate.setup({
|
|
143
143
|
schemaEngineConfig: config,
|
|
144
144
|
migrationsDirPath,
|
|
145
145
|
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_EDBWBKKM_exports = {};
|
|
20
|
+
__export(chunk_EDBWBKKM_exports, {
|
|
21
21
|
introspectSql: () => introspectSql
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
24
|
-
var
|
|
23
|
+
module.exports = __toCommonJS(chunk_EDBWBKKM_exports);
|
|
24
|
+
var import_chunk_RMMTCJSW = require("./chunk-RMMTCJSW.js");
|
|
25
25
|
var import_internals = require("@prisma/internals");
|
|
26
26
|
var supportedProviders = ["postgresql", "cockroachdb", "mysql", "sqlite"];
|
|
27
27
|
async function introspectSql(schemaContext, queries) {
|
|
@@ -41,7 +41,7 @@ async function introspectSql(schemaContext, queries) {
|
|
|
41
41
|
`Could not get url from datasource ${firstDatasource.name} in ${schemaContext.loadedFromPathForLogMessages}`
|
|
42
42
|
);
|
|
43
43
|
}
|
|
44
|
-
const migrate = await
|
|
44
|
+
const migrate = await import_chunk_RMMTCJSW.Migrate.setup({ schemaContext });
|
|
45
45
|
const schemaEngine = migrate.engine;
|
|
46
46
|
const results = [];
|
|
47
47
|
const errors = [];
|
|
@@ -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_F4ENFSD2_exports = {};
|
|
30
|
+
__export(chunk_F4ENFSD2_exports, {
|
|
31
31
|
MigrateDev: () => MigrateDev
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(chunk_F4ENFSD2_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_RMMTCJSW = require("./chunk-RMMTCJSW.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_RMMTCJSW.Migrate.setup({
|
|
128
128
|
schemaEngineConfig: config,
|
|
129
129
|
migrationsDirPath,
|
|
130
130
|
schemaContext,
|
|
@@ -286,12 +286,10 @@ ${(0, import_chunk_SKRR5WT4.green)("Your database is now in sync with your schem
|
|
|
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,14 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_I2VUHLTD_exports = {};
|
|
30
|
+
__export(chunk_I2VUHLTD_exports, {
|
|
31
31
|
DbPull: () => DbPull
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(chunk_I2VUHLTD_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");
|
|
38
37
|
var import_chunk_RTGQXNX6 = require("./chunk-RTGQXNX6.js");
|
|
39
38
|
var import_chunk_JFKDSUIE = require("./chunk-JFKDSUIE.js");
|
|
40
39
|
var import_chunk_AI6DH66U = require("./chunk-AI6DH66U.js");
|
|
@@ -42,7 +41,7 @@ var import_chunk_LGYRZ6CV = require("./chunk-LGYRZ6CV.js");
|
|
|
42
41
|
var import_chunk_3WC4XD74 = require("./chunk-3WC4XD74.js");
|
|
43
42
|
var import_chunk_2FXU5NZQ = require("./chunk-2FXU5NZQ.js");
|
|
44
43
|
var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
|
|
45
|
-
var
|
|
44
|
+
var import_chunk_RMMTCJSW = require("./chunk-RMMTCJSW.js");
|
|
46
45
|
var import_chunk_AXR7LS2N = require("./chunk-AXR7LS2N.js");
|
|
47
46
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
48
47
|
var import_debug = __toESM(require("@prisma/debug"));
|
|
@@ -107,7 +106,6 @@ Set composite types introspection depth to 2 levels
|
|
|
107
106
|
const args = (0, import_internals.arg)(argv, {
|
|
108
107
|
"--help": Boolean,
|
|
109
108
|
"-h": "--help",
|
|
110
|
-
"--url": String,
|
|
111
109
|
"--print": Boolean,
|
|
112
110
|
"--schema": String,
|
|
113
111
|
"--config": String,
|
|
@@ -125,8 +123,7 @@ Set composite types introspection depth to 2 levels
|
|
|
125
123
|
if (args["--help"]) {
|
|
126
124
|
return this.help();
|
|
127
125
|
}
|
|
128
|
-
|
|
129
|
-
await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: !args["--print"], config });
|
|
126
|
+
(0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: !args["--print"], config });
|
|
130
127
|
const schemaContext = await (0, import_internals.loadSchemaContext)({
|
|
131
128
|
schemaPathFromArg: args["--schema"],
|
|
132
129
|
schemaPathFromConfig: config.schema,
|
|
@@ -137,14 +134,13 @@ Set composite types introspection depth to 2 levels
|
|
|
137
134
|
const cmd = "db pull";
|
|
138
135
|
(0, import_internals.checkUnsupportedDataProxy)({
|
|
139
136
|
cmd,
|
|
140
|
-
schemaContext: schemaContext
|
|
141
|
-
urls: [url]
|
|
137
|
+
schemaContext: schemaContext ?? void 0
|
|
142
138
|
});
|
|
143
139
|
(0, import_internals.checkUnsupportedSchemaEngineWasm)({
|
|
144
140
|
cmd,
|
|
145
141
|
config,
|
|
146
142
|
args,
|
|
147
|
-
flags: ["--
|
|
143
|
+
flags: ["--local-d1"]
|
|
148
144
|
});
|
|
149
145
|
const adapter = config.engine === "js" ? await config.adapter() : void 0;
|
|
150
146
|
if (schemaContext && !args["--print"]) {
|
|
@@ -152,30 +148,14 @@ Set composite types introspection depth to 2 levels
|
|
|
152
148
|
(0, import_chunk_2FXU5NZQ.printDatasource)({ datasourceInfo: (0, import_chunk_74LUB4XX.parseDatasourceInfo)(schemaContext?.primaryDatasource), adapter });
|
|
153
149
|
}
|
|
154
150
|
const fromD1 = Boolean(args["--local-d1"]);
|
|
155
|
-
if (!
|
|
151
|
+
if (!schemaContext && !fromD1) {
|
|
156
152
|
throw new import_chunk_3WC4XD74.NoSchemaFoundError();
|
|
157
153
|
}
|
|
158
|
-
const { firstDatasource, schema, validationWarning } = await (0, import_chunk_AXR7LS2N.z)({
|
|
154
|
+
const { firstDatasource, schema, validationWarning } = await (0, import_chunk_AXR7LS2N.z)({ schemaContext, fromD1 }).when(
|
|
159
155
|
(input) => input.schemaContext !== null,
|
|
160
156
|
async (input) => {
|
|
161
157
|
const firstDatasource2 = input.schemaContext.primaryDatasource ? input.schemaContext.primaryDatasource : void 0;
|
|
162
|
-
if (input.
|
|
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) {
|
|
158
|
+
if (input.fromD1) {
|
|
179
159
|
const d1Database = await (0, import_internals.locateLocalCloudflareD1)({ arg: "--from-local-d1" });
|
|
180
160
|
const pathToSQLiteFile = import_path.default.relative(input.schemaContext.schemaRootDir, d1Database);
|
|
181
161
|
const schema2 = [
|
|
@@ -210,17 +190,6 @@ ${this.urlToDatasource(`file:${pathToSQLiteFile}`, "sqlite")}`;
|
|
|
210
190
|
});
|
|
211
191
|
return { firstDatasource: config2.datasources[0], schema: schema2, validationWarning: void 0 };
|
|
212
192
|
}
|
|
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
193
|
).run();
|
|
225
194
|
if (schemaContext) {
|
|
226
195
|
const modelRegex = /\s*model\s*(\w+)\s*{/;
|
|
@@ -235,13 +204,13 @@ Some information will be lost (relations, comments, mapped fields, @ignore...),
|
|
|
235
204
|
)} for more info.`);
|
|
236
205
|
}
|
|
237
206
|
}
|
|
238
|
-
const migrate = await
|
|
207
|
+
const migrate = await import_chunk_RMMTCJSW.Migrate.setup({
|
|
239
208
|
schemaEngineConfig: config,
|
|
240
209
|
schemaContext: schemaContext ?? void 0,
|
|
241
210
|
extensions: config["extensions"]
|
|
242
211
|
});
|
|
243
212
|
const engine = migrate.engine;
|
|
244
|
-
const basedOn =
|
|
213
|
+
const basedOn = schemaContext?.primaryDatasource ? ` based on datasource defined in ${(0, import_chunk_SKRR5WT4.underline)(schemaContext.loadedFromPathForLogMessages)}` : "";
|
|
245
214
|
const introspectionSpinner = spinnerFactory(`Introspecting${basedOn}`);
|
|
246
215
|
const before = Math.round(performance.now());
|
|
247
216
|
let introspectionSchema = void 0;
|
|
@@ -278,7 +247,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("To fix this, you have two options:")}
|
|
|
278
247
|
"schema.prisma"
|
|
279
248
|
)} points to a database that is not empty (it must contain at least one table).
|
|
280
249
|
|
|
281
|
-
Then you can run ${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)("prisma db pull"))} again.
|
|
250
|
+
Then you can run ${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)("prisma db pull"))} again.
|
|
282
251
|
`);
|
|
283
252
|
} else if (e.code === "P1003") {
|
|
284
253
|
throw new Error(`
|
|
@@ -297,7 +266,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("To fix this, you have two options:")}
|
|
|
297
266
|
"schema.prisma"
|
|
298
267
|
)} points to an existing database.
|
|
299
268
|
|
|
300
|
-
Then you can run ${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)("prisma db pull"))} again.
|
|
269
|
+
Then you can run ${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)("prisma db pull"))} again.
|
|
301
270
|
`);
|
|
302
271
|
} else if (e.code === "P1012") {
|
|
303
272
|
process.stdout.write("\n");
|