@prisma/migrate 6.4.0-dev.6 → 6.4.0-dev.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CLI.js +3 -3
- package/dist/Migrate.js +4 -4
- package/dist/SchemaEngine.js +4 -4
- package/dist/bin.js +61 -47
- package/dist/{chunk-HAJNCOW7.js → chunk-26XQQ4AG.js} +25 -23
- package/dist/{chunk-I63N54YI.js → chunk-2RSEPJFX.js} +15 -13
- package/dist/{chunk-77RYI3ZW.js → chunk-4B2LXK4R.js} +14 -12
- package/dist/{chunk-CK5VLKFM.js → chunk-4UJBOCZJ.js} +7 -6
- package/dist/{chunk-43RWRQLU.js → chunk-5HZLCY6X.js} +14 -12
- package/dist/{chunk-KZEXQFQA.js → chunk-6WCHFXD2.js} +77 -43
- package/dist/{chunk-AMRGQNRR.js → chunk-75EIHNAH.js} +6 -6
- package/dist/{chunk-Q3SQU7C6.js → chunk-7S3Q4MCN.js} +4 -4
- package/dist/{chunk-G66QFMM5.js → chunk-AOX7CJAS.js} +14 -12
- package/dist/{chunk-GRGGAY6L.js → chunk-CUDKD32S.js} +159 -5
- package/dist/{chunk-CNAS3YE2.js → chunk-DUCG3NRP.js} +76 -42
- package/dist/{chunk-JESW2ENL.js → chunk-FF3526PX.js} +14 -12
- package/dist/{chunk-JZ6FKTWG.js → chunk-FUSFURVP.js} +6 -6
- package/dist/{chunk-CSUAUCRR.js → chunk-GCTCQLOF.js} +15 -13
- package/dist/{chunk-7QAR4NT3.js → chunk-K44VNAFW.js} +15 -13
- package/dist/{chunk-EYA6AFSF.js → chunk-M5YNQ2NP.js} +5 -5
- package/dist/{chunk-NJUAN6V2.js → chunk-O4BT6W33.js} +7 -6
- package/dist/{chunk-ZKWJDQMB.js → chunk-UVNSK22K.js} +7 -7
- package/dist/{chunk-WJT3IOMB.js → chunk-X6XGFLEF.js} +11 -9
- package/dist/{chunk-E2XKFV2C.js → chunk-YD7GG4WS.js} +8 -6
- package/dist/{chunk-JTNVQIRB.js → chunk-YWWOSXMY.js} +6 -6
- package/dist/commands/DbCommand.js +3 -3
- package/dist/commands/DbDrop.js +3 -3
- package/dist/commands/DbExecute.js +5 -5
- package/dist/commands/DbPull.js +5 -5
- package/dist/commands/DbPush.js +6 -6
- package/dist/commands/DbSeed.js +3 -3
- package/dist/commands/MigrateCommand.js +3 -3
- package/dist/commands/MigrateDeploy.js +6 -6
- package/dist/commands/MigrateDev.js +6 -6
- package/dist/commands/MigrateDiff.js +5 -5
- package/dist/commands/MigrateReset.js +6 -6
- package/dist/commands/MigrateResolve.js +6 -6
- package/dist/commands/MigrateStatus.js +6 -6
- package/dist/index.js +54 -54
- package/dist/internals/src/cli/checkUnsupportedDataProxy.d.ts +2 -1
- package/dist/internals/src/cli/getSchema.d.ts +20 -37
- package/dist/internals/src/cli/hashes.d.ts +2 -1
- package/dist/internals/src/cli/types.d.ts +2 -1
- package/dist/internals/src/index.d.ts +2 -1
- package/dist/internals/src/utils/loadEnvFile.d.ts +4 -2
- package/dist/internals/src/utils/toSchemasContainer.d.ts +1 -1
- package/dist/migrate/src/CLI.d.ts +2 -1
- package/dist/migrate/src/commands/DbCommand.d.ts +2 -1
- package/dist/migrate/src/commands/DbDrop.d.ts +2 -1
- package/dist/migrate/src/commands/DbExecute.d.ts +2 -1
- package/dist/migrate/src/commands/DbPull.d.ts +2 -1
- package/dist/migrate/src/commands/DbPush.d.ts +2 -1
- package/dist/migrate/src/commands/DbSeed.d.ts +2 -1
- package/dist/migrate/src/commands/MigrateCommand.d.ts +2 -1
- package/dist/migrate/src/commands/MigrateDeploy.d.ts +2 -1
- package/dist/migrate/src/commands/MigrateDev.d.ts +2 -1
- package/dist/migrate/src/commands/MigrateDiff.d.ts +2 -1
- package/dist/migrate/src/commands/MigrateReset.d.ts +2 -1
- package/dist/migrate/src/commands/MigrateResolve.d.ts +2 -1
- package/dist/migrate/src/commands/MigrateStatus.d.ts +2 -1
- package/dist/migrate/src/utils/getSchemaPathAndPrint.d.ts +3 -3
- package/dist/migrate/src/utils/setupPostgres.d.ts +1 -1
- package/dist/utils/getDatabaseVersionSafe.js +4 -4
- package/dist/utils/getSchemaPathAndPrint.js +4 -4
- package/dist/utils/introspectSql.js +3 -3
- package/dist/utils/setupPostgres.js +4 -8
- package/dist/utils/spinner.js +3 -3
- package/package.json +7 -6
|
@@ -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_5HZLCY6X_exports = {};
|
|
30
|
+
__export(chunk_5HZLCY6X_exports, {
|
|
31
31
|
MigrateDeploy: () => MigrateDeploy,
|
|
32
32
|
init_MigrateDeploy: () => init_MigrateDeploy
|
|
33
33
|
});
|
|
34
|
-
module.exports = __toCommonJS(
|
|
34
|
+
module.exports = __toCommonJS(chunk_5HZLCY6X_exports);
|
|
35
35
|
var import_chunk_WOOPRG54 = require("./chunk-WOOPRG54.js");
|
|
36
|
-
var
|
|
37
|
-
var
|
|
36
|
+
var import_chunk_UVNSK22K = require("./chunk-UVNSK22K.js");
|
|
37
|
+
var import_chunk_M5YNQ2NP = require("./chunk-M5YNQ2NP.js");
|
|
38
38
|
var import_chunk_Q7ACZDDT = require("./chunk-Q7ACZDDT.js");
|
|
39
39
|
var import_chunk_XJQP3B4W = require("./chunk-XJQP3B4W.js");
|
|
40
40
|
var import_chunk_6TE2RIPN = require("./chunk-6TE2RIPN.js");
|
|
@@ -45,9 +45,9 @@ var debug, _MigrateDeploy, MigrateDeploy;
|
|
|
45
45
|
var init_MigrateDeploy = (0, import_chunk_WWAWV7DQ.__esm)({
|
|
46
46
|
"src/commands/MigrateDeploy.ts"() {
|
|
47
47
|
(0, import_chunk_6TE2RIPN.init_colors)();
|
|
48
|
-
(0,
|
|
48
|
+
(0, import_chunk_UVNSK22K.init_Migrate)();
|
|
49
49
|
(0, import_chunk_XJQP3B4W.init_ensureDatabaseExists)();
|
|
50
|
-
(0,
|
|
50
|
+
(0, import_chunk_M5YNQ2NP.init_getSchemaPathAndPrint)();
|
|
51
51
|
(0, import_chunk_Q7ACZDDT.init_printDatasource)();
|
|
52
52
|
(0, import_chunk_WOOPRG54.init_printFiles)();
|
|
53
53
|
debug = (0, import_debug.default)("prisma:migrate:deploy");
|
|
@@ -55,13 +55,14 @@ var init_MigrateDeploy = (0, import_chunk_WWAWV7DQ.__esm)({
|
|
|
55
55
|
static new() {
|
|
56
56
|
return new _MigrateDeploy2();
|
|
57
57
|
}
|
|
58
|
-
async parse(argv) {
|
|
58
|
+
async parse(argv, config) {
|
|
59
59
|
const args = (0, import_internals.arg)(
|
|
60
60
|
argv,
|
|
61
61
|
{
|
|
62
62
|
"--help": Boolean,
|
|
63
63
|
"-h": "--help",
|
|
64
64
|
"--schema": String,
|
|
65
|
+
"--config": String,
|
|
65
66
|
"--telemetry-information": String
|
|
66
67
|
},
|
|
67
68
|
false
|
|
@@ -69,14 +70,14 @@ var init_MigrateDeploy = (0, import_chunk_WWAWV7DQ.__esm)({
|
|
|
69
70
|
if ((0, import_internals.isError)(args)) {
|
|
70
71
|
return this.help(args.message);
|
|
71
72
|
}
|
|
72
|
-
await (0, import_internals.checkUnsupportedDataProxy)("migrate deploy", args, true);
|
|
73
|
+
await (0, import_internals.checkUnsupportedDataProxy)("migrate deploy", args, config.schema, true);
|
|
73
74
|
if (args["--help"]) {
|
|
74
75
|
return this.help();
|
|
75
76
|
}
|
|
76
|
-
await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true });
|
|
77
|
-
const { schemaPath } = await (0,
|
|
77
|
+
await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
|
|
78
|
+
const { schemaPath } = await (0, import_chunk_M5YNQ2NP.getSchemaPathAndPrint)(args["--schema"], config.schema);
|
|
78
79
|
(0, import_chunk_Q7ACZDDT.printDatasource)({ datasourceInfo: await (0, import_chunk_XJQP3B4W.getDatasourceInfo)({ schemaPath }) });
|
|
79
|
-
const migrate = new
|
|
80
|
+
const migrate = new import_chunk_UVNSK22K.Migrate(schemaPath);
|
|
80
81
|
try {
|
|
81
82
|
const wasDbCreated = await (0, import_chunk_XJQP3B4W.ensureDatabaseExists)("apply", schemaPath);
|
|
82
83
|
if (wasDbCreated) {
|
|
@@ -143,6 +144,7 @@ ${(0, import_chunk_6TE2RIPN.bold)("Usage")}
|
|
|
143
144
|
${(0, import_chunk_6TE2RIPN.bold)("Options")}
|
|
144
145
|
|
|
145
146
|
-h, --help Display this help message
|
|
147
|
+
--config Custom path to your Prisma config file
|
|
146
148
|
--schema Custom path to your Prisma schema
|
|
147
149
|
|
|
148
150
|
${(0, import_chunk_6TE2RIPN.bold)("Examples")}
|
|
@@ -26,16 +26,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_6WCHFXD2_exports = {};
|
|
30
|
+
__export(chunk_6WCHFXD2_exports, {
|
|
31
31
|
MigrateDiff: () => MigrateDiff,
|
|
32
32
|
init_MigrateDiff: () => init_MigrateDiff
|
|
33
33
|
});
|
|
34
|
-
module.exports = __toCommonJS(
|
|
34
|
+
module.exports = __toCommonJS(chunk_6WCHFXD2_exports);
|
|
35
35
|
var import_chunk_A6PMXMMT = require("./chunk-A6PMXMMT.js");
|
|
36
36
|
var import_chunk_XRTNIFND = require("./chunk-XRTNIFND.js");
|
|
37
37
|
var import_chunk_TKAGMA5K = require("./chunk-TKAGMA5K.js");
|
|
38
|
-
var
|
|
38
|
+
var import_chunk_UVNSK22K = require("./chunk-UVNSK22K.js");
|
|
39
39
|
var import_chunk_CQQQ436N = require("./chunk-CQQQ436N.js");
|
|
40
40
|
var import_chunk_6TE2RIPN = require("./chunk-6TE2RIPN.js");
|
|
41
41
|
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
|
@@ -6164,6 +6164,7 @@ var require_dist = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
|
6164
6164
|
__export2(index_exports, {
|
|
6165
6165
|
CompositeFilesResolver: () => CompositeFilesResolver,
|
|
6166
6166
|
InMemoryFilesResolver: () => InMemoryFilesResolver,
|
|
6167
|
+
ensureType: () => ensureType2,
|
|
6167
6168
|
loadRelatedSchemaFiles: () => loadRelatedSchemaFiles,
|
|
6168
6169
|
loadSchemaFiles: () => loadSchemaFiles2,
|
|
6169
6170
|
realFsResolver: () => realFsResolver,
|
|
@@ -6394,6 +6395,24 @@ var require_dist = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
|
6394
6395
|
}
|
|
6395
6396
|
return void 0;
|
|
6396
6397
|
}
|
|
6398
|
+
var import_promises3 = __toESM22((0, import_chunk_WWAWV7DQ.__require)("node:fs/promises"));
|
|
6399
|
+
async function ensureType2(entryPath, expectedType) {
|
|
6400
|
+
try {
|
|
6401
|
+
const pathStat = await import_promises3.default.stat(entryPath);
|
|
6402
|
+
if (expectedType === "file" && pathStat.isFile()) {
|
|
6403
|
+
return void 0;
|
|
6404
|
+
}
|
|
6405
|
+
if (expectedType === "directory" && pathStat.isDirectory()) {
|
|
6406
|
+
return void 0;
|
|
6407
|
+
}
|
|
6408
|
+
return { kind: "WrongType", path: entryPath, expectedTypes: [expectedType] };
|
|
6409
|
+
} catch (e) {
|
|
6410
|
+
if (e.code === "ENOENT") {
|
|
6411
|
+
return { kind: "NotFound", path: entryPath, expectedType };
|
|
6412
|
+
}
|
|
6413
|
+
throw e;
|
|
6414
|
+
}
|
|
6415
|
+
}
|
|
6397
6416
|
}
|
|
6398
6417
|
});
|
|
6399
6418
|
async function findUp(name, {
|
|
@@ -11543,7 +11562,7 @@ var require_package = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
|
11543
11562
|
"../internals/package.json"(exports, module2) {
|
|
11544
11563
|
module2.exports = {
|
|
11545
11564
|
name: "@prisma/internals",
|
|
11546
|
-
version: "6.4.0-dev.
|
|
11565
|
+
version: "6.4.0-dev.61",
|
|
11547
11566
|
description: "This package is intended for Prisma's internal use",
|
|
11548
11567
|
main: "dist/index.js",
|
|
11549
11568
|
types: "dist/index.d.ts",
|
|
@@ -11623,12 +11642,13 @@ var require_package = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
|
11623
11642
|
yarn: "1.22.22"
|
|
11624
11643
|
},
|
|
11625
11644
|
dependencies: {
|
|
11645
|
+
"@prisma/config": "workspace:*",
|
|
11626
11646
|
"@prisma/debug": "workspace:*",
|
|
11627
11647
|
"@prisma/engines": "workspace:*",
|
|
11628
11648
|
"@prisma/fetch-engine": "workspace:*",
|
|
11629
11649
|
"@prisma/generator-helper": "workspace:*",
|
|
11630
11650
|
"@prisma/get-platform": "workspace:*",
|
|
11631
|
-
"@prisma/prisma-schema-wasm": "6.4.0-
|
|
11651
|
+
"@prisma/prisma-schema-wasm": "6.4.0-29.a9055b89e58b4b5bfb59600785423b1db3d0e75d",
|
|
11632
11652
|
"@prisma/schema-files-loader": "workspace:*",
|
|
11633
11653
|
arg: "5.0.2",
|
|
11634
11654
|
prompts: "2.4.2"
|
|
@@ -11910,8 +11930,8 @@ var init_engine_commands = (0, import_chunk_WWAWV7DQ.__esm)({
|
|
|
11910
11930
|
init_getConfig();
|
|
11911
11931
|
}
|
|
11912
11932
|
});
|
|
11913
|
-
async function getSchemaWithPath(schemaPathFromArgs, { cwd = process.cwd(), argumentName = "--schema" } = {}) {
|
|
11914
|
-
const result = await getSchemaWithPathInternal(schemaPathFromArgs, { cwd, argumentName });
|
|
11933
|
+
async function getSchemaWithPath(schemaPathFromArgs, schemaPathFromConfig, { cwd = process.cwd(), argumentName = "--schema" } = {}) {
|
|
11934
|
+
const result = await getSchemaWithPathInternal(schemaPathFromArgs, schemaPathFromConfig, { cwd, argumentName });
|
|
11915
11935
|
if (result.ok) {
|
|
11916
11936
|
return result.schema;
|
|
11917
11937
|
}
|
|
@@ -11919,7 +11939,7 @@ async function getSchemaWithPath(schemaPathFromArgs, { cwd = process.cwd(), argu
|
|
|
11919
11939
|
}
|
|
11920
11940
|
async function readSchemaFromSingleFile(schemaPath) {
|
|
11921
11941
|
debug2("Reading schema from single file", schemaPath);
|
|
11922
|
-
const typeError = await ensureType(schemaPath, "file");
|
|
11942
|
+
const typeError = await (0, import_schema_files_loader.ensureType)(schemaPath, "file");
|
|
11923
11943
|
if (typeError) {
|
|
11924
11944
|
return { ok: false, error: typeError };
|
|
11925
11945
|
}
|
|
@@ -11932,7 +11952,7 @@ async function readSchemaFromSingleFile(schemaPath) {
|
|
|
11932
11952
|
}
|
|
11933
11953
|
async function readSchemaFromDirectory(schemaPath) {
|
|
11934
11954
|
debug2("Reading schema from multiple files", schemaPath);
|
|
11935
|
-
const typeError = await ensureType(schemaPath, "directory");
|
|
11955
|
+
const typeError = await (0, import_schema_files_loader.ensureType)(schemaPath, "directory");
|
|
11936
11956
|
if (typeError) {
|
|
11937
11957
|
return { ok: false, error: typeError };
|
|
11938
11958
|
}
|
|
@@ -11948,23 +11968,6 @@ async function readSchemaFromDirectory(schemaPath) {
|
|
|
11948
11968
|
}
|
|
11949
11969
|
return { ok: true, schema: { schemaPath, schemaRootDir: schemaPath, schemas: files } };
|
|
11950
11970
|
}
|
|
11951
|
-
async function ensureType(entryPath, expectedType) {
|
|
11952
|
-
try {
|
|
11953
|
-
const pathStat = await stat(entryPath);
|
|
11954
|
-
if (expectedType === "file" && pathStat.isFile()) {
|
|
11955
|
-
return void 0;
|
|
11956
|
-
}
|
|
11957
|
-
if (expectedType === "directory" && pathStat.isDirectory()) {
|
|
11958
|
-
return void 0;
|
|
11959
|
-
}
|
|
11960
|
-
return { kind: "WrongType", path: entryPath, expectedTypes: [expectedType] };
|
|
11961
|
-
} catch (e) {
|
|
11962
|
-
if (e.code === "ENOENT") {
|
|
11963
|
-
return { kind: "NotFound", path: entryPath, expectedType };
|
|
11964
|
-
}
|
|
11965
|
-
throw e;
|
|
11966
|
-
}
|
|
11967
|
-
}
|
|
11968
11971
|
async function readSchemaFromFileOrDirectory(schemaPath) {
|
|
11969
11972
|
let stats;
|
|
11970
11973
|
try {
|
|
@@ -11983,7 +11986,7 @@ async function readSchemaFromFileOrDirectory(schemaPath) {
|
|
|
11983
11986
|
}
|
|
11984
11987
|
return { ok: false, error: { kind: "WrongType", path: schemaPath, expectedTypes: ["file", "directory"] } };
|
|
11985
11988
|
}
|
|
11986
|
-
async function getSchemaWithPathInternal(schemaPathFromArgs, { cwd, argumentName }) {
|
|
11989
|
+
async function getSchemaWithPathInternal(schemaPathFromArgs, schemaPathFromConfig, { cwd, argumentName }) {
|
|
11987
11990
|
if (schemaPathFromArgs) {
|
|
11988
11991
|
const absPath = import_path.default.resolve(cwd, schemaPathFromArgs);
|
|
11989
11992
|
const customSchemaResult = await readSchemaFromFileOrDirectory(absPath);
|
|
@@ -11997,6 +12000,10 @@ async function getSchemaWithPathInternal(schemaPathFromArgs, { cwd, argumentName
|
|
|
11997
12000
|
}
|
|
11998
12001
|
return customSchemaResult;
|
|
11999
12002
|
}
|
|
12003
|
+
const prismaConfigResult = await readSchemaFromPrismaConfigBasedLocation(schemaPathFromConfig);
|
|
12004
|
+
if (prismaConfigResult.ok) {
|
|
12005
|
+
return prismaConfigResult;
|
|
12006
|
+
}
|
|
12000
12007
|
const pkgJsonResult = await getSchemaFromPackageJson(cwd);
|
|
12001
12008
|
if (pkgJsonResult.ok) {
|
|
12002
12009
|
return pkgJsonResult;
|
|
@@ -12052,6 +12059,31 @@ async function getPrismaConfigFromPackageJson(cwd) {
|
|
|
12052
12059
|
packagePath: pkgJson.path
|
|
12053
12060
|
};
|
|
12054
12061
|
}
|
|
12062
|
+
async function readSchemaFromPrismaConfigBasedLocation(schemaPathFromConfig) {
|
|
12063
|
+
if (!schemaPathFromConfig) {
|
|
12064
|
+
return {
|
|
12065
|
+
ok: false,
|
|
12066
|
+
error: { kind: "PrismaConfigNotConfigured" }
|
|
12067
|
+
};
|
|
12068
|
+
}
|
|
12069
|
+
let schemaResult;
|
|
12070
|
+
if (schemaPathFromConfig.kind === "single") {
|
|
12071
|
+
schemaResult = await readSchemaFromSingleFile(schemaPathFromConfig.filePath);
|
|
12072
|
+
if (!schemaResult.ok) {
|
|
12073
|
+
throw new Error(
|
|
12074
|
+
`Could not load schema from file \`${schemaPathFromConfig.filePath}\` provided by "prisma.config.ts"\`: ${renderLookupError(schemaResult.error)}`
|
|
12075
|
+
);
|
|
12076
|
+
}
|
|
12077
|
+
} else {
|
|
12078
|
+
schemaResult = await readSchemaFromDirectory(schemaPathFromConfig.folderPath);
|
|
12079
|
+
if (!schemaResult.ok) {
|
|
12080
|
+
throw new Error(
|
|
12081
|
+
`Could not load schema from folder \`${schemaPathFromConfig.folderPath}\` provided by "prisma.config.ts"\`: ${renderLookupError(schemaResult.error)}`
|
|
12082
|
+
);
|
|
12083
|
+
}
|
|
12084
|
+
}
|
|
12085
|
+
return schemaResult;
|
|
12086
|
+
}
|
|
12055
12087
|
async function getSchemaFromPackageJson(cwd) {
|
|
12056
12088
|
const prismaConfig = await getPrismaConfigFromPackageJson(cwd);
|
|
12057
12089
|
debug2("prismaConfig", prismaConfig);
|
|
@@ -12165,7 +12197,7 @@ var init_MigrateDiff = (0, import_chunk_WWAWV7DQ.__esm)({
|
|
|
12165
12197
|
import_fs_jetpack = (0, import_chunk_WWAWV7DQ.__toESM)(require_main());
|
|
12166
12198
|
(0, import_chunk_6TE2RIPN.init_colors)();
|
|
12167
12199
|
init_getSchema();
|
|
12168
|
-
(0,
|
|
12200
|
+
(0, import_chunk_UVNSK22K.init_Migrate)();
|
|
12169
12201
|
(0, import_chunk_TKAGMA5K.init_captureStdout)();
|
|
12170
12202
|
debug3 = (0, import_debug3.default)("prisma:migrate:diff");
|
|
12171
12203
|
helpOptions = (0, import_internals.format)(
|
|
@@ -12176,6 +12208,7 @@ var init_MigrateDiff = (0, import_chunk_WWAWV7DQ.__esm)({
|
|
|
12176
12208
|
${(0, import_chunk_6TE2RIPN.bold)("Options")}
|
|
12177
12209
|
|
|
12178
12210
|
-h, --help Display this help message
|
|
12211
|
+
--config Custom path to your Prisma config file
|
|
12179
12212
|
-o, --output Writes to a file instead of stdout
|
|
12180
12213
|
|
|
12181
12214
|
${(0, import_chunk_6TE2RIPN.italic)("From and To inputs (1 `--from-...` and 1 `--to-...` must be provided):")}
|
|
@@ -12209,7 +12242,7 @@ ${(0, import_chunk_6TE2RIPN.bold)("Flags")}
|
|
|
12209
12242
|
static new() {
|
|
12210
12243
|
return new _MigrateDiff2();
|
|
12211
12244
|
}
|
|
12212
|
-
async parse(argv) {
|
|
12245
|
+
async parse(argv, config) {
|
|
12213
12246
|
const args = (0, import_internals.arg)(
|
|
12214
12247
|
argv,
|
|
12215
12248
|
{
|
|
@@ -12235,14 +12268,15 @@ ${(0, import_chunk_6TE2RIPN.bold)("Flags")}
|
|
|
12235
12268
|
"--shadow-database-url": String,
|
|
12236
12269
|
"--script": Boolean,
|
|
12237
12270
|
"--exit-code": Boolean,
|
|
12238
|
-
"--telemetry-information": String
|
|
12271
|
+
"--telemetry-information": String,
|
|
12272
|
+
"--config": String
|
|
12239
12273
|
},
|
|
12240
12274
|
false
|
|
12241
12275
|
);
|
|
12242
12276
|
if ((0, import_internals.isError)(args)) {
|
|
12243
12277
|
return this.help(args.message);
|
|
12244
12278
|
}
|
|
12245
|
-
await (0, import_internals.checkUnsupportedDataProxy)("migrate diff", args, false);
|
|
12279
|
+
await (0, import_internals.checkUnsupportedDataProxy)("migrate diff", args, config.schema, false);
|
|
12246
12280
|
if (args["--help"]) {
|
|
12247
12281
|
return this.help();
|
|
12248
12282
|
}
|
|
@@ -12269,17 +12303,17 @@ ${(0, import_chunk_6TE2RIPN.bold)("Flags")}
|
|
|
12269
12303
|
tag: "empty"
|
|
12270
12304
|
};
|
|
12271
12305
|
} else if (args["--from-schema-datasource"]) {
|
|
12272
|
-
await (0, import_internals.loadEnvFile)({ schemaPath: args["--from-schema-datasource"], printMessage: false });
|
|
12273
|
-
const schema = await getSchemaWithPath(import_path2.default.resolve(args["--from-schema-datasource"]), {
|
|
12306
|
+
await (0, import_internals.loadEnvFile)({ schemaPath: args["--from-schema-datasource"], printMessage: false, config });
|
|
12307
|
+
const schema = await getSchemaWithPath(import_path2.default.resolve(args["--from-schema-datasource"]), config.schema, {
|
|
12274
12308
|
argumentName: "--from-schema-datasource"
|
|
12275
12309
|
});
|
|
12276
|
-
const
|
|
12310
|
+
const engineConfig = await (0, import_internals.getConfig)({ datamodel: schema.schemas });
|
|
12277
12311
|
from = {
|
|
12278
12312
|
tag: "schemaDatasource",
|
|
12279
|
-
...(0, import_internals.toSchemasWithConfigDir)(schema,
|
|
12313
|
+
...(0, import_internals.toSchemasWithConfigDir)(schema, engineConfig)
|
|
12280
12314
|
};
|
|
12281
12315
|
} else if (args["--from-schema-datamodel"]) {
|
|
12282
|
-
const schema = await getSchemaWithPath(import_path2.default.resolve(args["--from-schema-datamodel"]), {
|
|
12316
|
+
const schema = await getSchemaWithPath(import_path2.default.resolve(args["--from-schema-datamodel"]), config.schema, {
|
|
12283
12317
|
argumentName: "--from-schema-datamodel"
|
|
12284
12318
|
});
|
|
12285
12319
|
from = {
|
|
@@ -12309,17 +12343,17 @@ ${(0, import_chunk_6TE2RIPN.bold)("Flags")}
|
|
|
12309
12343
|
tag: "empty"
|
|
12310
12344
|
};
|
|
12311
12345
|
} else if (args["--to-schema-datasource"]) {
|
|
12312
|
-
await (0, import_internals.loadEnvFile)({ schemaPath: args["--to-schema-datasource"], printMessage: false });
|
|
12313
|
-
const schema = await getSchemaWithPath(import_path2.default.resolve(args["--to-schema-datasource"]), {
|
|
12346
|
+
await (0, import_internals.loadEnvFile)({ schemaPath: args["--to-schema-datasource"], printMessage: false, config });
|
|
12347
|
+
const schema = await getSchemaWithPath(import_path2.default.resolve(args["--to-schema-datasource"]), config.schema, {
|
|
12314
12348
|
argumentName: "--to-schema-datasource"
|
|
12315
12349
|
});
|
|
12316
|
-
const
|
|
12350
|
+
const engineConfig = await (0, import_internals.getConfig)({ datamodel: schema.schemas });
|
|
12317
12351
|
to = {
|
|
12318
12352
|
tag: "schemaDatasource",
|
|
12319
|
-
...(0, import_internals.toSchemasWithConfigDir)(schema,
|
|
12353
|
+
...(0, import_internals.toSchemasWithConfigDir)(schema, engineConfig)
|
|
12320
12354
|
};
|
|
12321
12355
|
} else if (args["--to-schema-datamodel"]) {
|
|
12322
|
-
const schema = await getSchemaWithPath(import_path2.default.resolve(args["--to-schema-datamodel"]), {
|
|
12356
|
+
const schema = await getSchemaWithPath(import_path2.default.resolve(args["--to-schema-datamodel"]), config.schema, {
|
|
12323
12357
|
argumentName: "--to-schema-datamodel"
|
|
12324
12358
|
});
|
|
12325
12359
|
to = {
|
|
@@ -12343,7 +12377,7 @@ ${(0, import_chunk_6TE2RIPN.bold)("Flags")}
|
|
|
12343
12377
|
url: `file:${d1Database}`
|
|
12344
12378
|
};
|
|
12345
12379
|
}
|
|
12346
|
-
const migrate = new
|
|
12380
|
+
const migrate = new import_chunk_UVNSK22K.Migrate();
|
|
12347
12381
|
const captureStdout = new import_chunk_TKAGMA5K.CaptureStdout();
|
|
12348
12382
|
const outputPath = args["--output"];
|
|
12349
12383
|
const isOutputDefined = Boolean(outputPath);
|
|
@@ -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_75EIHNAH_exports = {};
|
|
20
|
+
__export(chunk_75EIHNAH_exports, {
|
|
21
21
|
introspectSql: () => introspectSql
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
24
|
-
var
|
|
23
|
+
module.exports = __toCommonJS(chunk_75EIHNAH_exports);
|
|
24
|
+
var import_chunk_7S3Q4MCN = require("./chunk-7S3Q4MCN.js");
|
|
25
25
|
var import_internals = require("@prisma/internals");
|
|
26
|
-
(0,
|
|
26
|
+
(0, import_chunk_7S3Q4MCN.init_SchemaEngine)();
|
|
27
27
|
var supportedProviders = ["postgresql", "cockroachdb", "mysql", "sqlite"];
|
|
28
28
|
async function introspectSql(schemaPath, queries) {
|
|
29
29
|
const schema = await (0, import_internals.getSchemaWithPath)(schemaPath);
|
|
@@ -42,7 +42,7 @@ async function introspectSql(schemaPath, queries) {
|
|
|
42
42
|
if (!url) {
|
|
43
43
|
throw new Error(`Could not get url from datasource ${firstDatasource.name} in ${schema.schemaPath}`);
|
|
44
44
|
}
|
|
45
|
-
const schemaEngine = new
|
|
45
|
+
const schemaEngine = new import_chunk_7S3Q4MCN.SchemaEngine({ schemaPath: schema.schemaPath });
|
|
46
46
|
const results = [];
|
|
47
47
|
const errors = [];
|
|
48
48
|
try {
|
|
@@ -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_7S3Q4MCN_exports = {};
|
|
30
|
+
__export(chunk_7S3Q4MCN_exports, {
|
|
31
31
|
EngineError: () => EngineError,
|
|
32
32
|
SchemaEngine: () => SchemaEngine,
|
|
33
33
|
init_SchemaEngine: () => init_SchemaEngine
|
|
34
34
|
});
|
|
35
|
-
module.exports = __toCommonJS(
|
|
35
|
+
module.exports = __toCommonJS(chunk_7S3Q4MCN_exports);
|
|
36
36
|
var import_chunk_CQQQ436N = require("./chunk-CQQQ436N.js");
|
|
37
37
|
var import_chunk_AAATUOV6 = require("./chunk-AAATUOV6.js");
|
|
38
38
|
var import_chunk_6TE2RIPN = require("./chunk-6TE2RIPN.js");
|
|
@@ -260,7 +260,7 @@ var init_SchemaEngine = (0, import_chunk_WWAWV7DQ.__esm)({
|
|
|
260
260
|
try {
|
|
261
261
|
result = JSON.parse(response);
|
|
262
262
|
} catch (e) {
|
|
263
|
-
console.error(`Could not parse Schema engine response: ${response.slice(0, 200)}`);
|
|
263
|
+
console.error(`Could not parse Schema engine response: ${response.slice(0, 200)}. Error: ${e.message}`);
|
|
264
264
|
}
|
|
265
265
|
if (result) {
|
|
266
266
|
if (result.id && (result.result !== void 0 || result.error !== void 0)) {
|
|
@@ -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_AOX7CJAS_exports = {};
|
|
30
|
+
__export(chunk_AOX7CJAS_exports, {
|
|
31
31
|
DbExecute: () => DbExecute,
|
|
32
32
|
init_DbExecute: () => init_DbExecute
|
|
33
33
|
});
|
|
34
|
-
module.exports = __toCommonJS(
|
|
35
|
-
var
|
|
34
|
+
module.exports = __toCommonJS(chunk_AOX7CJAS_exports);
|
|
35
|
+
var import_chunk_UVNSK22K = require("./chunk-UVNSK22K.js");
|
|
36
36
|
var import_chunk_6TE2RIPN = require("./chunk-6TE2RIPN.js");
|
|
37
37
|
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
|
38
38
|
var import_internals = require("@prisma/internals");
|
|
@@ -72,7 +72,7 @@ var init_DbExecute = (0, import_chunk_WWAWV7DQ.__esm)({
|
|
|
72
72
|
"src/commands/DbExecute.ts"() {
|
|
73
73
|
import_get_stdin = (0, import_chunk_WWAWV7DQ.__toESM)(require_get_stdin());
|
|
74
74
|
(0, import_chunk_6TE2RIPN.init_colors)();
|
|
75
|
-
(0,
|
|
75
|
+
(0, import_chunk_UVNSK22K.init_Migrate)();
|
|
76
76
|
helpOptions = (0, import_internals.format)(
|
|
77
77
|
`${(0, import_chunk_6TE2RIPN.bold)("Usage")}
|
|
78
78
|
|
|
@@ -81,6 +81,7 @@ ${(0, import_chunk_6TE2RIPN.dim)("$")} prisma db execute [options]
|
|
|
81
81
|
${(0, import_chunk_6TE2RIPN.bold)("Options")}
|
|
82
82
|
|
|
83
83
|
-h, --help Display this help message
|
|
84
|
+
--config Custom path to your Prisma config file
|
|
84
85
|
|
|
85
86
|
${(0, import_chunk_6TE2RIPN.italic)("Datasource input, only 1 must be provided:")}
|
|
86
87
|
--url URL of the datasource to run the command on
|
|
@@ -97,12 +98,13 @@ ${(0, import_chunk_6TE2RIPN.bold)("Flags")}
|
|
|
97
98
|
static new() {
|
|
98
99
|
return new _DbExecute2();
|
|
99
100
|
}
|
|
100
|
-
async parse(argv) {
|
|
101
|
+
async parse(argv, config) {
|
|
101
102
|
const args = (0, import_internals.arg)(
|
|
102
103
|
argv,
|
|
103
104
|
{
|
|
104
105
|
"--help": Boolean,
|
|
105
106
|
"-h": "--help",
|
|
107
|
+
"--config": String,
|
|
106
108
|
"--stdin": Boolean,
|
|
107
109
|
"--file": String,
|
|
108
110
|
"--schema": String,
|
|
@@ -114,11 +116,11 @@ ${(0, import_chunk_6TE2RIPN.bold)("Flags")}
|
|
|
114
116
|
if ((0, import_internals.isError)(args)) {
|
|
115
117
|
return this.help(args.message);
|
|
116
118
|
}
|
|
117
|
-
await (0, import_internals.checkUnsupportedDataProxy)("db execute", args, !args["--url"]);
|
|
119
|
+
await (0, import_internals.checkUnsupportedDataProxy)("db execute", args, config.schema, !args["--url"]);
|
|
118
120
|
if (args["--help"]) {
|
|
119
121
|
return this.help();
|
|
120
122
|
}
|
|
121
|
-
await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: false });
|
|
123
|
+
await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: false, config });
|
|
122
124
|
if (args["--stdin"] && args["--file"]) {
|
|
123
125
|
throw new Error(
|
|
124
126
|
`--stdin and --file cannot be used at the same time. Only 1 must be provided.
|
|
@@ -164,14 +166,14 @@ See \`${(0, import_chunk_6TE2RIPN.green)((0, import_internals.getCommandWithExec
|
|
|
164
166
|
url: args["--url"]
|
|
165
167
|
};
|
|
166
168
|
} else {
|
|
167
|
-
const schemaWithPath = await (0, import_internals.getSchemaWithPath)(args["--schema"]);
|
|
168
|
-
const
|
|
169
|
+
const schemaWithPath = await (0, import_internals.getSchemaWithPath)(args["--schema"], config.schema);
|
|
170
|
+
const engineConfig = await (0, import_internals.getConfig)({ datamodel: schemaWithPath.schemas });
|
|
169
171
|
datasourceType = {
|
|
170
172
|
tag: "schema",
|
|
171
|
-
...(0, import_internals.toSchemasWithConfigDir)(schemaWithPath,
|
|
173
|
+
...(0, import_internals.toSchemasWithConfigDir)(schemaWithPath, engineConfig)
|
|
172
174
|
};
|
|
173
175
|
}
|
|
174
|
-
const migrate = new
|
|
176
|
+
const migrate = new import_chunk_UVNSK22K.Migrate();
|
|
175
177
|
try {
|
|
176
178
|
await migrate.engine.dbExecute({
|
|
177
179
|
script,
|