@prisma/migrate 6.20.0-dev.7 → 6.20.0-dev.9
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 +2 -2
- package/dist/Migrate.js +4 -8
- package/dist/SchemaEngineCLI.js +4 -4
- package/dist/SchemaEngineWasm.js +4 -4
- package/dist/bin.js +71 -74
- package/dist/chunk-3MCWUFUJ.js +169 -0
- package/dist/{chunk-O35BTK6Y.js → chunk-7BNYLV6P.js} +7 -14
- package/dist/{chunk-F2XCBEZ4.js → chunk-AIUUIREM.js} +27 -53
- package/dist/{chunk-74LUB4XX.js → chunk-BRPS327A.js} +23 -45
- package/dist/{chunk-7TVX3D4W.js → chunk-CQ6GMT2G.js} +23 -69
- package/dist/{chunk-EJG7GKM7.js → chunk-DCXZOUQV.js} +5 -5
- package/dist/{chunk-LLO7YF56.js → chunk-DYXUXG3K.js} +7 -7
- package/dist/{chunk-GSX25HRL.js → chunk-ENVEA7LT.js} +10 -13
- package/dist/{chunk-6ORQRJLP.js → chunk-FEUKQ7J3.js} +38 -132
- package/dist/{chunk-BHJMJSM4.js → chunk-IQWOR45L.js} +28 -24
- package/dist/{chunk-R4IWP35Z.js → chunk-IVL273O6.js} +20 -20
- package/dist/{chunk-PHXLQVPT.js → chunk-L7EZFBB4.js} +40 -68
- package/dist/{chunk-3AKRTEIK.js → chunk-N4SBKLAB.js} +24 -23
- package/dist/{chunk-NGQA5JTN.js → chunk-OAHBNV3B.js} +5 -5
- package/dist/{chunk-22YP3RXZ.js → chunk-OZ26HKM7.js} +7 -7
- package/dist/{chunk-AXR7LS2N.js → chunk-PEUHUCS4.js} +4 -5
- package/dist/{chunk-TW22Y3AA.js → chunk-QAOWTYGM.js} +31 -32
- package/dist/{chunk-2FXU5NZQ.js → chunk-QOPTDDIH.js} +5 -10
- package/dist/{chunk-J33EXHZB.js → chunk-S4LY555Z.js} +26 -46
- package/dist/{chunk-NB4FRYRQ.js → chunk-TLHUBVSH.js} +6 -6
- package/dist/{chunk-Z27SI4AV.js → chunk-TRUKHPCA.js} +20 -15
- package/dist/{chunk-D4TRX77Y.js → chunk-WF7UXKO5.js} +6 -9
- package/dist/{chunk-ZTIS675B.js → chunk-XFASRSQR.js} +81 -172
- package/dist/{chunk-3WC4XD74.js → chunk-XGTVKL4L.js} +11 -4
- package/dist/{chunk-VU5BLQUI.js → chunk-ZOT2HSX5.js} +218 -22
- package/dist/commands/DbCommand.js +2 -2
- package/dist/commands/DbDrop.js +5 -5
- package/dist/commands/DbExecute.js +5 -9
- package/dist/commands/DbPull.js +10 -16
- package/dist/commands/DbPush.js +8 -12
- package/dist/commands/DbSeed.js +3 -3
- package/dist/commands/MigrateCommand.js +2 -2
- package/dist/commands/MigrateDeploy.js +7 -11
- package/dist/commands/MigrateDev.js +8 -13
- package/dist/commands/MigrateDiff.js +6 -9
- package/dist/commands/MigrateReset.js +8 -13
- package/dist/commands/MigrateResolve.js +7 -11
- package/dist/commands/MigrateStatus.js +7 -11
- package/dist/index.js +44 -48
- package/dist/internals/src/cli/getSchema.d.ts +1 -15
- package/dist/migrate/src/CLI.d.ts +1 -1
- package/dist/migrate/src/Migrate.d.ts +2 -3
- package/dist/migrate/src/SchemaEngineCLI.d.ts +4 -3
- package/dist/migrate/src/commands/DbCommand.d.ts +1 -1
- package/dist/migrate/src/commands/DbDrop.d.ts +1 -1
- package/dist/migrate/src/commands/DbExecute.d.ts +1 -1
- package/dist/migrate/src/commands/DbPull.d.ts +1 -2
- package/dist/migrate/src/commands/DbPush.d.ts +1 -1
- package/dist/migrate/src/commands/MigrateCommand.d.ts +1 -1
- package/dist/migrate/src/commands/MigrateDeploy.d.ts +1 -1
- package/dist/migrate/src/commands/MigrateDev.d.ts +1 -1
- package/dist/migrate/src/commands/MigrateDiff.d.ts +2 -1
- package/dist/migrate/src/commands/MigrateReset.d.ts +1 -1
- package/dist/migrate/src/commands/MigrateResolve.d.ts +1 -1
- package/dist/migrate/src/commands/MigrateStatus.d.ts +1 -1
- package/dist/migrate/src/utils/ensureDatabaseExists.d.ts +9 -5
- package/dist/migrate/src/utils/errors.d.ts +3 -0
- package/dist/migrate/src/utils/getDatabaseVersionSafe.d.ts +2 -1
- package/dist/migrate/src/utils/introspectSql.d.ts +2 -2
- package/dist/migrate/src/utils/printDatasource.d.ts +1 -3
- package/dist/migrate/src/utils/seed.d.ts +0 -6
- package/dist/utils/ensureDatabaseExists.js +6 -6
- package/dist/utils/errors.js +8 -7
- package/dist/utils/getDatabaseVersionSafe.js +5 -9
- package/dist/utils/introspectSql.js +5 -9
- package/dist/utils/printDatasource.js +2 -2
- package/dist/utils/printDatasources.js +31 -3
- package/dist/utils/seed.js +2 -3
- package/dist/utils/setupMSSQL.js +18 -3
- package/dist/utils/spinner.js +2 -3
- package/dist/views/handleViewsIO.js +2 -2
- package/package.json +11 -11
- package/dist/chunk-AI6DH66U.js +0 -55
- package/dist/chunk-D6LYHB65.js +0 -905
- package/dist/chunk-RR6BKMNO.js +0 -80
- package/dist/chunk-T64SUJ5L.js +0 -46
- package/dist/chunk-VV4M6AN7.js +0 -233
- package/dist/migrate/src/utils/replaceOrAddDatasource.d.ts +0 -2
- package/dist/migrate/src/utils/replaceOrAddDatasource.test.d.ts +0 -1
- package/dist/migrate/src/utils/warnDatasourceDriverAdapter.d.ts +0 -2
- package/dist/utils/replaceOrAddDatasource.js +0 -25
- package/dist/utils/replaceOrAddDatasource.test.js +0 -207
- package/dist/utils/warnDatasourceDriverAdapter.js +0 -25
|
@@ -26,20 +26,20 @@ 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(
|
|
31
|
-
MigrateDiff: () => MigrateDiff
|
|
29
|
+
var chunk_XFASRSQR_exports = {};
|
|
30
|
+
__export(chunk_XFASRSQR_exports, {
|
|
31
|
+
MigrateDiff: () => MigrateDiff,
|
|
32
|
+
getRemovedTargetParameterHint: () => getRemovedTargetParameterHint
|
|
32
33
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
34
|
+
module.exports = __toCommonJS(chunk_XFASRSQR_exports);
|
|
34
35
|
var import_chunk_VAJ4VX67 = require("./chunk-VAJ4VX67.js");
|
|
35
|
-
var
|
|
36
|
+
var import_chunk_3MCWUFUJ = require("./chunk-3MCWUFUJ.js");
|
|
36
37
|
var import_chunk_GGA2F64G = require("./chunk-GGA2F64G.js");
|
|
37
38
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
38
39
|
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
|
|
39
40
|
var import_debug = __toESM(require("@prisma/debug"));
|
|
40
41
|
var import_internals = require("@prisma/internals");
|
|
41
42
|
var import_path = __toESM(require("path"));
|
|
42
|
-
var import_config = require("@prisma/config");
|
|
43
43
|
var import_debug2 = require("@prisma/debug");
|
|
44
44
|
var import_fs = __toESM(require("fs"));
|
|
45
45
|
var import_path2 = __toESM(require("path"));
|
|
@@ -5569,10 +5569,6 @@ async function getSchemaWithPathInternal(schemaPathFromArgs, schemaPathFromConfi
|
|
|
5569
5569
|
if (prismaConfigResult.ok) {
|
|
5570
5570
|
return prismaConfigResult;
|
|
5571
5571
|
}
|
|
5572
|
-
const pkgJsonResult = await getSchemaFromPackageJson(cwd);
|
|
5573
|
-
if (pkgJsonResult.ok) {
|
|
5574
|
-
return pkgJsonResult;
|
|
5575
|
-
}
|
|
5576
5572
|
const defaultResult = await getDefaultSchema(cwd);
|
|
5577
5573
|
if (defaultResult.ok) {
|
|
5578
5574
|
return defaultResult;
|
|
@@ -5629,36 +5625,6 @@ async function readSchemaFromPrismaConfigBasedLocation(schemaPathFromConfig) {
|
|
|
5629
5625
|
}
|
|
5630
5626
|
return schemaResult;
|
|
5631
5627
|
}
|
|
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
5628
|
async function getDefaultSchema(cwd, failures = []) {
|
|
5663
5629
|
const lookupPaths = [import_path2.default.join(cwd, "schema.prisma"), import_path2.default.join(cwd, "prisma", "schema.prisma")];
|
|
5664
5630
|
for (const path3 of lookupPaths) {
|
|
@@ -5691,26 +5657,17 @@ ${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
|
5691
5657
|
-o, --output Writes to a file instead of stdout
|
|
5692
5658
|
|
|
5693
5659
|
${(0, import_chunk_SKRR5WT4.italic)("From and To inputs (1 `--from-...` and 1 `--to-...` must be provided):")}
|
|
5694
|
-
--from-url A datasource URL
|
|
5695
|
-
--to-url
|
|
5696
|
-
|
|
5697
5660
|
--from-empty Flag to assume from or to is an empty datamodel
|
|
5698
5661
|
--to-empty
|
|
5699
5662
|
|
|
5700
|
-
--from-schema
|
|
5701
|
-
--to-schema
|
|
5702
|
-
|
|
5703
|
-
--from-schema-datasource Path to a Prisma schema file, uses the ${(0, import_chunk_SKRR5WT4.italic)("datasource url")} for the diff
|
|
5704
|
-
--to-schema-datasource
|
|
5663
|
+
--from-schema Path to a Prisma schema file, uses the ${(0, import_chunk_SKRR5WT4.italic)("datamodel")} for the diff
|
|
5664
|
+
--to-schema
|
|
5705
5665
|
|
|
5706
5666
|
--from-migrations Path to the Prisma Migrate migrations directory
|
|
5707
5667
|
--to-migrations
|
|
5708
5668
|
|
|
5709
|
-
--from-
|
|
5710
|
-
--to-
|
|
5711
|
-
|
|
5712
|
-
${(0, import_chunk_SKRR5WT4.italic)("Shadow database (only required if using --from-migrations or --to-migrations):")}
|
|
5713
|
-
--shadow-database-url URL for the shadow database
|
|
5669
|
+
--from-config-datasource Flag to use the datasource from the Prisma config file
|
|
5670
|
+
--to-config-datasource
|
|
5714
5671
|
|
|
5715
5672
|
${(0, import_chunk_SKRR5WT4.bold)("Flags")}
|
|
5716
5673
|
|
|
@@ -5731,7 +5688,7 @@ The command takes a source ${(0, import_chunk_SKRR5WT4.green)(`--from-...`)} and
|
|
|
5731
5688
|
The source and destination must use the same provider,
|
|
5732
5689
|
e.g. a diff using 2 different providers like PostgreSQL and SQLite is not supported.
|
|
5733
5690
|
|
|
5734
|
-
It compares the source with the destination to generate a diff.
|
|
5691
|
+
It compares the source with the destination to generate a diff.
|
|
5735
5692
|
The diff can be interpreted as generating a migration that brings the source schema (from) to the shape of the destination schema (to).
|
|
5736
5693
|
The default output is a human readable diff, it can be rendered as SQL using \`--script\` on SQL databases.
|
|
5737
5694
|
|
|
@@ -5739,47 +5696,26 @@ See the documentation for more information ${(0, import_internals.link)("https:/
|
|
|
5739
5696
|
|
|
5740
5697
|
${helpOptions}
|
|
5741
5698
|
${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
5742
|
-
|
|
5743
|
-
From database to
|
|
5744
|
-
e.g. compare two live databases
|
|
5745
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate diff \\
|
|
5746
|
-
--from-url "$DATABASE_URL" \\
|
|
5747
|
-
--to-url "postgresql://login:password@localhost:5432/db2"
|
|
5748
|
-
|
|
5749
|
-
From a live database to a Prisma datamodel
|
|
5699
|
+
|
|
5700
|
+
From the configured database to a Prisma datamodel
|
|
5750
5701
|
e.g. roll forward after a migration failed in the middle
|
|
5751
5702
|
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate diff \\
|
|
5752
|
-
--
|
|
5753
|
-
--
|
|
5754
|
-
--to-schema-datamodel=next_datamodel.prisma \\
|
|
5755
|
-
--script
|
|
5756
|
-
|
|
5757
|
-
From a live database to a datamodel
|
|
5758
|
-
e.g. roll backward after a migration failed in the middle
|
|
5759
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate diff \\
|
|
5760
|
-
--shadow-database-url "$SHADOW_DB" \\
|
|
5761
|
-
--from-url "$PROD_DB" \\
|
|
5762
|
-
--to-schema-datamodel=previous_datamodel.prisma \\
|
|
5703
|
+
--from-config-datasource \\
|
|
5704
|
+
--to-schema=next_datamodel.prisma \\
|
|
5763
5705
|
--script
|
|
5764
5706
|
|
|
5765
|
-
From a
|
|
5707
|
+
From a peisma datamodel to the configured database
|
|
5708
|
+
e.g. roll forward after a migration failed in the middle
|
|
5766
5709
|
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate diff \\
|
|
5767
|
-
--from-
|
|
5768
|
-
--to-
|
|
5710
|
+
--from-schema=next_datamodel.prisma \\
|
|
5711
|
+
--to-config-datasource \\
|
|
5769
5712
|
--script
|
|
5770
5713
|
|
|
5771
|
-
From a Prisma
|
|
5772
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate diff \\
|
|
5773
|
-
--from-schema-datamodel=./prisma/schema.prisma \\
|
|
5774
|
-
--to-local-d1 \\
|
|
5775
|
-
--script
|
|
5776
|
-
|
|
5777
|
-
From a Prisma Migrate \`migrations\` directory to another database
|
|
5714
|
+
From a Prisma Migrate \`migrations\` directory to the configured database
|
|
5778
5715
|
e.g. generate a migration for a hotfix already applied on production
|
|
5779
5716
|
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate diff \\
|
|
5780
|
-
--shadow-database-url "$SHADOW_DB" \\
|
|
5781
5717
|
--from-migrations ./migrations \\
|
|
5782
|
-
--to-
|
|
5718
|
+
--to-config-datasource \\
|
|
5783
5719
|
--script
|
|
5784
5720
|
|
|
5785
5721
|
Execute the --script output with \`prisma db execute\` using bash pipe \`|\`
|
|
@@ -5794,7 +5730,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
5794
5730
|
--from-[...] \\
|
|
5795
5731
|
--to-[...]
|
|
5796
5732
|
`);
|
|
5797
|
-
async parse(argv, config) {
|
|
5733
|
+
async parse(argv, config, configDir) {
|
|
5798
5734
|
const args = (0, import_internals.arg)(
|
|
5799
5735
|
argv,
|
|
5800
5736
|
{
|
|
@@ -5804,54 +5740,43 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
5804
5740
|
"-o": "--output",
|
|
5805
5741
|
// From
|
|
5806
5742
|
"--from-empty": Boolean,
|
|
5807
|
-
"--from-
|
|
5808
|
-
"--from-schema
|
|
5809
|
-
"--from-url": String,
|
|
5743
|
+
"--from-config-datasource": Boolean,
|
|
5744
|
+
"--from-schema": String,
|
|
5810
5745
|
"--from-migrations": String,
|
|
5811
|
-
"--from-local-d1": Boolean,
|
|
5812
5746
|
// To
|
|
5813
5747
|
"--to-empty": Boolean,
|
|
5814
|
-
"--to-
|
|
5815
|
-
"--to-schema
|
|
5816
|
-
"--to-url": String,
|
|
5748
|
+
"--to-config-datasource": Boolean,
|
|
5749
|
+
"--to-schema": String,
|
|
5817
5750
|
"--to-migrations": String,
|
|
5818
|
-
"--to-local-d1": Boolean,
|
|
5819
5751
|
// Others
|
|
5820
|
-
"--shadow-database-url": String,
|
|
5821
5752
|
"--script": Boolean,
|
|
5822
5753
|
"--exit-code": Boolean,
|
|
5823
5754
|
"--telemetry-information": String,
|
|
5824
|
-
"--config": String
|
|
5755
|
+
"--config": String,
|
|
5756
|
+
// Removed, but parsed to show help error
|
|
5757
|
+
"--from-url": String,
|
|
5758
|
+
"--to-url": String,
|
|
5759
|
+
"--from-schema-datasource": String,
|
|
5760
|
+
"--to-schema-datasource": String,
|
|
5761
|
+
"--from-schema-datamodel": String,
|
|
5762
|
+
"--to-schema-datamodel": String,
|
|
5763
|
+
"--from-local-d1": Boolean,
|
|
5764
|
+
"--to-local-d1": Boolean
|
|
5825
5765
|
},
|
|
5826
5766
|
false
|
|
5827
5767
|
);
|
|
5828
5768
|
if ((0, import_internals.isError)(args)) {
|
|
5829
5769
|
return this.help(args.message);
|
|
5830
5770
|
}
|
|
5831
|
-
const cmd = "migrate diff";
|
|
5832
|
-
(0, import_internals.checkUnsupportedDataProxy)({
|
|
5833
|
-
cmd,
|
|
5834
|
-
urls: [args["--to-url"], args["--from-url"], args["--shadow-database-url"]]
|
|
5835
|
-
});
|
|
5836
|
-
(0, import_internals.checkUnsupportedSchemaEngineWasm)({
|
|
5837
|
-
cmd,
|
|
5838
|
-
config,
|
|
5839
|
-
args,
|
|
5840
|
-
flags: [
|
|
5841
|
-
"--from-url",
|
|
5842
|
-
"--to-url",
|
|
5843
|
-
"--from-schema-datasource",
|
|
5844
|
-
"--to-schema-datasource",
|
|
5845
|
-
"--shadow-database-url",
|
|
5846
|
-
"--to-local-d1",
|
|
5847
|
-
"--from-local-d1"
|
|
5848
|
-
]
|
|
5849
|
-
});
|
|
5850
5771
|
if (args["--help"]) {
|
|
5851
5772
|
return this.help();
|
|
5852
5773
|
}
|
|
5853
|
-
const
|
|
5854
|
-
|
|
5774
|
+
const removedTargetParameterHint = Object.keys(args).map(getRemovedTargetParameterHint).find((msg) => msg !== void 0);
|
|
5775
|
+
if (removedTargetParameterHint) {
|
|
5776
|
+
return this.help(removedTargetParameterHint);
|
|
5777
|
+
}
|
|
5778
|
+
const numberOfFromParameterProvided = Number(Boolean(args["--from-empty"])) + Number(Boolean(args["--from-config-datasource"])) + Number(Boolean(args["--from-schema"])) + Number(Boolean(args["--from-migrations"]));
|
|
5779
|
+
const numberOfToParameterProvided = Number(Boolean(args["--to-empty"])) + Number(Boolean(args["--to-config-datasource"])) + Number(Boolean(args["--to-schema"])) + Number(Boolean(args["--to-migrations"]));
|
|
5855
5780
|
if (numberOfFromParameterProvided !== 1 || numberOfToParameterProvided !== 1) {
|
|
5856
5781
|
const errorMessages = [];
|
|
5857
5782
|
if (numberOfFromParameterProvided !== 1) {
|
|
@@ -5862,52 +5787,32 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
5862
5787
|
}
|
|
5863
5788
|
return this.help(`${errorMessages.join("\n")}`);
|
|
5864
5789
|
}
|
|
5865
|
-
if (args["--shadow-database-url"] && (args["--from-local-d1"] || args["--to-local-d1"])) {
|
|
5866
|
-
return this.help(
|
|
5867
|
-
`The flag \`--shadow-database-url\` is not compatible with \`--from-local-d1\` or \`--to-local-d1\`.`
|
|
5868
|
-
);
|
|
5869
|
-
}
|
|
5870
5790
|
let from;
|
|
5871
5791
|
if (args["--from-empty"]) {
|
|
5872
5792
|
from = {
|
|
5873
5793
|
tag: "empty"
|
|
5874
5794
|
};
|
|
5875
|
-
} else if (args["--from-schema
|
|
5876
|
-
await (
|
|
5877
|
-
|
|
5878
|
-
schemaPathFromArg: args["--from-schema-datasource"],
|
|
5879
|
-
schemaPathArgumentName: "--from-schema-datasource",
|
|
5880
|
-
schemaEngineConfig: config,
|
|
5881
|
-
printLoadMessage: false
|
|
5882
|
-
});
|
|
5883
|
-
(0, import_internals.checkUnsupportedDataProxy)({ cmd: "migrate diff", schemaContext });
|
|
5884
|
-
from = {
|
|
5885
|
-
tag: "schemaDatasource",
|
|
5886
|
-
...(0, import_internals.toSchemasWithConfigDir)(schemaContext)
|
|
5887
|
-
};
|
|
5888
|
-
} else if (args["--from-schema-datamodel"]) {
|
|
5889
|
-
const schema = await getSchemaWithPath(import_path.default.resolve(args["--from-schema-datamodel"]), config.schema, {
|
|
5890
|
-
argumentName: "--from-schema-datamodel"
|
|
5795
|
+
} else if (args["--from-schema"]) {
|
|
5796
|
+
const schema = await getSchemaWithPath(import_path.default.resolve(args["--from-schema"]), config.schema, {
|
|
5797
|
+
argumentName: "--from-schema"
|
|
5891
5798
|
});
|
|
5892
5799
|
from = {
|
|
5893
5800
|
tag: "schemaDatamodel",
|
|
5894
5801
|
...(0, import_internals.toSchemasContainer)(schema.schemas)
|
|
5895
5802
|
};
|
|
5896
|
-
} else if (args["--from-url"]) {
|
|
5897
|
-
from = {
|
|
5898
|
-
tag: "url",
|
|
5899
|
-
url: args["--from-url"]
|
|
5900
|
-
};
|
|
5901
5803
|
} else if (args["--from-migrations"]) {
|
|
5902
5804
|
from = {
|
|
5903
5805
|
tag: "migrations",
|
|
5904
5806
|
...await (0, import_chunk_GGA2F64G.listMigrations)(args["--from-migrations"], config.migrations?.initShadowDb ?? "")
|
|
5905
5807
|
};
|
|
5906
|
-
} else if (args["--from-
|
|
5907
|
-
const
|
|
5808
|
+
} else if (args["--from-config-datasource"]) {
|
|
5809
|
+
const schemaContext = await (0, import_internals.loadSchemaContext)({
|
|
5810
|
+
schemaPathFromConfig: config.schema,
|
|
5811
|
+
printLoadMessage: false
|
|
5812
|
+
});
|
|
5908
5813
|
from = {
|
|
5909
|
-
tag: "
|
|
5910
|
-
|
|
5814
|
+
tag: "schemaDatasource",
|
|
5815
|
+
...(0, import_internals.toSchemasWithConfigDir)(schemaContext, configDir)
|
|
5911
5816
|
};
|
|
5912
5817
|
}
|
|
5913
5818
|
let to;
|
|
@@ -5915,49 +5820,36 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
5915
5820
|
to = {
|
|
5916
5821
|
tag: "empty"
|
|
5917
5822
|
};
|
|
5918
|
-
} else if (args["--to-schema
|
|
5919
|
-
await (
|
|
5920
|
-
|
|
5921
|
-
schemaPathFromArg: args["--to-schema-datasource"],
|
|
5922
|
-
schemaPathArgumentName: "--to-schema-datasource",
|
|
5923
|
-
printLoadMessage: false
|
|
5924
|
-
});
|
|
5925
|
-
(0, import_internals.checkUnsupportedDataProxy)({ cmd: "migrate diff", schemaContext });
|
|
5926
|
-
to = {
|
|
5927
|
-
tag: "schemaDatasource",
|
|
5928
|
-
...(0, import_internals.toSchemasWithConfigDir)(schemaContext)
|
|
5929
|
-
};
|
|
5930
|
-
} else if (args["--to-schema-datamodel"]) {
|
|
5931
|
-
const schema = await getSchemaWithPath(import_path.default.resolve(args["--to-schema-datamodel"]), config.schema, {
|
|
5932
|
-
argumentName: "--to-schema-datamodel"
|
|
5823
|
+
} else if (args["--to-schema"]) {
|
|
5824
|
+
const schema = await getSchemaWithPath(import_path.default.resolve(args["--to-schema"]), config.schema, {
|
|
5825
|
+
argumentName: "--to-schema"
|
|
5933
5826
|
});
|
|
5934
5827
|
to = {
|
|
5935
5828
|
tag: "schemaDatamodel",
|
|
5936
5829
|
...(0, import_internals.toSchemasContainer)(schema.schemas)
|
|
5937
5830
|
};
|
|
5938
|
-
} else if (args["--to-url"]) {
|
|
5939
|
-
to = {
|
|
5940
|
-
tag: "url",
|
|
5941
|
-
url: args["--to-url"]
|
|
5942
|
-
};
|
|
5943
5831
|
} else if (args["--to-migrations"]) {
|
|
5944
5832
|
to = {
|
|
5945
5833
|
tag: "migrations",
|
|
5946
5834
|
...await (0, import_chunk_GGA2F64G.listMigrations)(args["--to-migrations"], config.migrations?.initShadowDb ?? "")
|
|
5947
5835
|
};
|
|
5948
|
-
} else if (args["--to-
|
|
5949
|
-
const
|
|
5836
|
+
} else if (args["--to-config-datasource"]) {
|
|
5837
|
+
const schemaContext = await (0, import_internals.loadSchemaContext)({
|
|
5838
|
+
schemaPathFromConfig: config.schema,
|
|
5839
|
+
printLoadMessage: false
|
|
5840
|
+
});
|
|
5950
5841
|
to = {
|
|
5951
|
-
tag: "
|
|
5952
|
-
|
|
5842
|
+
tag: "schemaDatasource",
|
|
5843
|
+
...(0, import_internals.toSchemasWithConfigDir)(schemaContext, configDir)
|
|
5953
5844
|
};
|
|
5954
5845
|
}
|
|
5955
5846
|
const schemaFilter = {
|
|
5956
5847
|
externalTables: config.tables?.external ?? [],
|
|
5957
5848
|
externalEnums: config.enums?.external ?? []
|
|
5958
5849
|
};
|
|
5959
|
-
const migrate = await
|
|
5850
|
+
const migrate = await import_chunk_3MCWUFUJ.Migrate.setup({
|
|
5960
5851
|
schemaEngineConfig: config,
|
|
5852
|
+
configDir,
|
|
5961
5853
|
schemaFilter,
|
|
5962
5854
|
extensions: config["extensions"]
|
|
5963
5855
|
});
|
|
@@ -6006,3 +5898,20 @@ ${helpOptions}`);
|
|
|
6006
5898
|
return _MigrateDiff.help;
|
|
6007
5899
|
}
|
|
6008
5900
|
};
|
|
5901
|
+
function getRemovedTargetParameterHint(parameter) {
|
|
5902
|
+
switch (parameter) {
|
|
5903
|
+
case "--from-url":
|
|
5904
|
+
case "--to-url":
|
|
5905
|
+
case "--from-schema-datasource":
|
|
5906
|
+
case "--to-schema-datasource":
|
|
5907
|
+
return `\`${parameter}\` was removed. Please use \`--[from/to]-config-datasource\` in combination with a Prisma config file that contains the appropriate datasource instead.`;
|
|
5908
|
+
case "--from-schema-datamodel":
|
|
5909
|
+
case "--to-schema-datamodel":
|
|
5910
|
+
return `\`${parameter}\` was removed. Please use \`--[from/to]-schema\` instead.`;
|
|
5911
|
+
case "--from-local-d1":
|
|
5912
|
+
case "--to-local-d1":
|
|
5913
|
+
return `\`${parameter}\` was removed. Please use \`--[from/to]-config-datasource\` in combination with a Prisma config file that contains the appropriate datasource instead. The \`@prisma/adapter-d1\` package exposes a \`listLocalDatabases()\` helper function to help you locate your local D1 databases. You can use the paths returned from that function to construct your datasource URL(s).`;
|
|
5914
|
+
default:
|
|
5915
|
+
return;
|
|
5916
|
+
}
|
|
5917
|
+
}
|
|
@@ -16,8 +16,9 @@ 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_XGTVKL4L_exports = {};
|
|
20
|
+
__export(chunk_XGTVKL4L_exports, {
|
|
21
|
+
ConfigValidationError: () => ConfigValidationError,
|
|
21
22
|
DbDropNeedsForceError: () => DbDropNeedsForceError,
|
|
22
23
|
DbPushIgnoreWarningsWithFlagError: () => DbPushIgnoreWarningsWithFlagError,
|
|
23
24
|
MigrateDevEnvNonInteractiveError: () => MigrateDevEnvNonInteractiveError,
|
|
@@ -25,9 +26,15 @@ __export(chunk_3WC4XD74_exports, {
|
|
|
25
26
|
MigrateResetEnvNonInteractiveError: () => MigrateResetEnvNonInteractiveError,
|
|
26
27
|
NoSchemaFoundError: () => NoSchemaFoundError
|
|
27
28
|
});
|
|
28
|
-
module.exports = __toCommonJS(
|
|
29
|
+
module.exports = __toCommonJS(chunk_XGTVKL4L_exports);
|
|
29
30
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
30
31
|
var import_internals = require("@prisma/internals");
|
|
32
|
+
var ConfigValidationError = class extends Error {
|
|
33
|
+
constructor(message) {
|
|
34
|
+
super(message);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
(0, import_internals.setClassName)(ConfigValidationError, "ConfigValidationError");
|
|
31
38
|
var NoSchemaFoundError = class extends Error {
|
|
32
39
|
constructor() {
|
|
33
40
|
super(
|
|
@@ -36,7 +43,7 @@ var NoSchemaFoundError = class extends Error {
|
|
|
36
43
|
)} file that is required for this command.
|
|
37
44
|
You can either provide it with ${(0, import_chunk_SKRR5WT4.green)(
|
|
38
45
|
"--schema"
|
|
39
|
-
)}, set
|
|
46
|
+
)}, set its path in the \`schema\` property in your Prisma Config file, or put it into the default location ${(0, import_chunk_SKRR5WT4.green)(
|
|
40
47
|
"./prisma/schema.prisma"
|
|
41
48
|
)} ${(0, import_internals.link)("https://pris.ly/d/prisma-schema-location")}`
|
|
42
49
|
);
|