@prisma/migrate 6.6.0-dev.10 → 6.6.0-dev.101
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 +9 -6
- package/dist/SchemaEngine.js +0 -28
- package/dist/SchemaEngineCLI.js +29 -0
- package/dist/{utils/getSchemaPathAndPrint.js → SchemaEngineWasm.js} +8 -8
- package/dist/bin.js +52 -50
- package/dist/chunk-23DZXSTI.js +62 -0
- package/dist/{chunk-WWAWV7DQ.js → chunk-2ESYSVXG.js} +3 -27
- package/dist/{chunk-LKTTJWFT.js → chunk-2R6DII47.js} +5 -5
- package/dist/chunk-33LPBNDX.js +1399 -0
- package/dist/{chunk-MKK3GSDF.js → chunk-344G2PKM.js} +9 -9
- package/dist/{chunk-V3ZMNXZC.js → chunk-5LKIRKDL.js} +307 -382
- package/dist/{chunk-LOGAFLCN.js → chunk-5R44VVVX.js} +29 -29
- package/dist/{chunk-DJMFXNR4.js → chunk-74LUB4XX.js} +56 -57
- package/dist/{chunk-GG54LOYV.js → chunk-A4FQW4A5.js} +54 -50
- package/dist/{chunk-RP2N6UXA.js → chunk-AI6DH66U.js} +6 -6
- package/dist/{chunk-A6PMXMMT.js → chunk-AUGZZ6RT.js} +105 -13
- package/dist/{chunk-G2XUUMKH.js → chunk-B4SUSDC2.js} +31 -39
- package/dist/{chunk-N3KYWSX2.js → chunk-CCFFDJW6.js} +63 -49
- package/dist/{chunk-N4XTKFY6.js → chunk-CLSF7VUT.js} +42 -38
- package/dist/{chunk-IR55GBON.js → chunk-CU5UT2ED.js} +19 -18
- package/dist/{chunk-CQZFVAXC.js → chunk-CYEVXXRH.js} +51 -47
- package/dist/{chunk-W2SZNLK4.js → chunk-EJG7GKM7.js} +37 -39
- package/dist/{chunk-5PSO7BDO.js → chunk-EJUXYFV3.js} +15 -15
- package/dist/{chunk-KS7IEA6Z.js → chunk-HIDSEBVV.js} +55 -54
- package/dist/{chunk-ZOEKRXDP.js → chunk-I3LT2PO3.js} +35 -57
- package/dist/{chunk-MCWCB2AX.js → chunk-IINN7QUV.js} +170 -643
- package/dist/chunk-IK3BVD3Y.js +233 -0
- package/dist/{chunk-255BRND3.js → chunk-KRQEFTDT.js} +6 -6
- package/dist/{chunk-HCBZB4XC.js → chunk-KW633S3Y.js} +56 -52
- package/dist/{chunk-VVKOFN3Y.js → chunk-LLO7YF56.js} +44 -46
- package/dist/{chunk-VZ23KD5C.js → chunk-NGQA5JTN.js} +8 -10
- package/dist/{chunk-MATFO4ZW.js → chunk-OEWQACEH.js} +38 -39
- package/dist/chunk-PQKZ53DW.js +76 -0
- package/dist/{chunk-5GVIOOXU.js → chunk-QTXX5BQZ.js} +393 -533
- package/dist/{chunk-EGPJABTW.js → chunk-QVMYNWAN.js} +257 -103
- package/dist/{chunk-2B4IAB6L.js → chunk-RPOUM5FT.js} +392 -532
- package/dist/{chunk-V5TUSOJX.js → chunk-SQKGZVG3.js} +45 -45
- package/dist/chunk-URKH6SE2.js +479 -0
- package/dist/{chunk-DLLXDCI2.js → chunk-VAJ4VX67.js} +5 -6
- package/dist/{chunk-WI2A2TQE.js → chunk-XO3EJLOT.js} +100 -92
- package/dist/{chunk-Q3ZLC44N.js → chunk-YBS5GSRF.js} +64 -69
- package/dist/{chunk-OCQGHQED.js → chunk-YBX7R3MT.js} +12 -12
- package/dist/chunk-YSWLN2IJ.js +890 -0
- package/dist/commands/DbCommand.js +3 -3
- package/dist/commands/DbDrop.js +4 -5
- package/dist/commands/DbExecute.js +10 -7
- package/dist/commands/DbPull.js +17 -12
- package/dist/commands/DbPush.js +12 -10
- package/dist/commands/DbSeed.js +4 -5
- package/dist/commands/MigrateCommand.js +3 -3
- package/dist/commands/MigrateDeploy.js +14 -12
- package/dist/commands/MigrateDev.js +17 -15
- package/dist/commands/MigrateDiff.js +13 -10
- package/dist/commands/MigrateReset.js +16 -14
- package/dist/commands/MigrateResolve.js +12 -10
- package/dist/commands/MigrateStatus.js +12 -10
- package/dist/index.js +58 -57
- package/dist/internals/src/Generator.d.ts +23 -5
- package/dist/internals/src/WasmSchemaEngineLoader.d.ts +5 -0
- package/dist/internals/src/cli/checkUnsupportedDataProxy.d.ts +12 -17
- package/dist/internals/src/cli/checkUnsupportedSchemaEngineWasm.d.ts +22 -0
- package/dist/internals/src/cli/directoryConfig.d.ts +7 -0
- package/dist/internals/src/cli/getSchema.d.ts +3 -28
- package/dist/internals/src/cli/hashes.d.ts +1 -2
- package/dist/internals/src/cli/schemaContext.d.ts +59 -0
- package/dist/internals/src/client/getClientEngineType.d.ts +1 -1
- package/dist/internals/src/convertCredentials.d.ts +1 -1
- package/dist/internals/src/engine-commands/getConfig.d.ts +1 -5
- package/dist/internals/src/engine-commands/getDmmf.d.ts +3 -6
- package/dist/internals/src/engine-commands/lintSchema.d.ts +1 -1
- package/dist/internals/src/errorReporting.d.ts +0 -1
- package/dist/internals/src/get-generators/getGenerators.d.ts +22 -9
- package/dist/internals/src/get-generators/utils/binaryTypeToEngineType.d.ts +1 -1
- package/dist/internals/src/get-generators/utils/engineTypeToBinaryType.d.ts +1 -1
- package/dist/internals/src/get-generators/utils/fixBinaryTargets.d.ts +1 -1
- package/dist/internals/src/get-generators/utils/getBinaryPathsByVersion.d.ts +1 -1
- package/dist/internals/src/get-generators/utils/getEngineVersionForGenerator.d.ts +1 -1
- package/dist/internals/src/get-generators/utils/printGeneratorConfig.d.ts +1 -1
- package/dist/internals/src/index.d.ts +10 -8
- package/dist/internals/src/migrateTypes.d.ts +63 -0
- package/dist/internals/src/panic.d.ts +1 -4
- package/dist/internals/src/resolvePkg.d.ts +7 -0
- package/dist/internals/src/types.d.ts +1 -1
- package/dist/internals/src/utils/extractPreviewFeatures.d.ts +2 -2
- package/dist/internals/src/utils/getEnvPaths.d.ts +1 -1
- package/dist/internals/src/utils/parseEnvValue.d.ts +1 -1
- package/dist/internals/src/utils/schemaFileInput.d.ts +0 -4
- package/dist/internals/src/utils/toSchemasContainer.d.ts +2 -3
- package/dist/internals/src/wasm.d.ts +3 -1
- package/dist/migrate/src/Migrate.d.ts +18 -7
- package/dist/migrate/src/SchemaEngine.d.ts +20 -50
- package/dist/migrate/src/SchemaEngineCLI.d.ts +139 -0
- package/dist/migrate/src/SchemaEngineWasm.d.ts +134 -0
- package/dist/migrate/src/commands/DbExecute.d.ts +1 -1
- package/dist/migrate/src/commands/DbPull.d.ts +1 -1
- package/dist/migrate/src/commands/DbPush.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 +1 -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/index.d.ts +2 -2
- package/dist/migrate/src/types.d.ts +19 -19
- package/dist/migrate/src/utils/createMigration.d.ts +21 -0
- package/dist/migrate/src/utils/ensureDatabaseExists.d.ts +4 -6
- package/dist/migrate/src/utils/introspectSql.d.ts +3 -2
- package/dist/migrate/src/utils/listMigrations.d.ts +9 -0
- package/dist/migrate/src/utils/printDatasources.d.ts +1 -1
- package/dist/migrate/src/utils/seed.d.ts +0 -2
- package/dist/migrate/src/views/handleViewsIO.d.ts +2 -2
- package/dist/{multipart-parser-54WEFGGN-NLZG56KM.js → multipart-parser-ASKQAOL4-WZ47HU6G.js} +92 -125
- package/dist/{multipart-parser-NDLECNMN.js → multipart-parser-QCI3Y5IB.js} +66 -68
- package/dist/types.js +1 -1
- package/dist/{typescript-WN4QH2CP.js → typescript-2LKASCMC.js} +33 -33
- package/dist/{typescript-AILDXN3I.js → typescript-H3AVJ6KX.js} +32 -32
- package/dist/utils/byline.js +1 -1
- package/dist/utils/captureStdout.js +3 -3
- package/dist/utils/countModelsAndTypes.js +1 -1
- package/dist/utils/createMigration.js +27 -0
- package/dist/utils/customColors.js +1 -1
- package/dist/utils/ensureDatabaseExists.js +7 -7
- package/dist/utils/errors.js +1 -1
- package/dist/utils/flagErrors.js +1 -1
- package/dist/utils/getDatabaseVersionSafe.js +10 -5
- package/dist/utils/handleEvaluateDataloss.js +1 -1
- package/dist/utils/introspectSql.js +10 -5
- package/dist/utils/isSchemaEmpty.js +1 -1
- package/dist/utils/listMigrations.js +25 -0
- package/dist/utils/now.js +1 -1
- package/dist/utils/printDatasource.js +1 -1
- package/dist/utils/printDatasources.js +5 -5
- package/dist/utils/printFiles.js +5 -5
- package/dist/utils/printIntrospectedSchema.js +1 -1
- package/dist/utils/printMigrationId.js +1 -1
- package/dist/utils/promptForMigrationName.js +3 -3
- package/dist/utils/removeSchemaFiles.js +1 -1
- package/dist/utils/replaceOrAddDatasource.js +1 -1
- package/dist/utils/replaceOrAddDatasource.test.js +1 -1
- package/dist/utils/saveSchemaFiles.js +1 -1
- package/dist/utils/seed.js +4 -7
- package/dist/utils/setupCockroach.js +3 -3
- package/dist/utils/setupMSSQL.js +1478 -707
- package/dist/utils/setupMongo.js +553 -552
- package/dist/utils/setupMysql.js +508 -563
- package/dist/utils/setupPostgres.js +3 -3
- package/dist/utils/spinner.js +4 -3
- package/dist/utils/test-handlePanic.js +1 -30
- package/dist/utils/unixSocket.js +1 -1
- package/dist/views/handleViewsIO.js +3 -3
- package/package.json +12 -11
- package/dist/chunk-GKDFIHM2.js +0 -45
- package/dist/chunk-J46BJQHT.js +0 -268
- package/dist/chunk-KOF4LGTS.js +0 -1817
- package/dist/chunk-YYPMC5FN.js +0 -1407
- package/dist/internals/src/get-generators/generatorResolvers/generatorResolvers.d.ts +0 -15
- package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/auto-installation/findPrismaClientDir.d.ts +0 -6
- package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/auto-installation/getPackageCmd.d.ts +0 -9
- package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/auto-installation/runPackageCmd.d.ts +0 -8
- package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkTypeScriptVersion.d.ts +0 -6
- package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/check-dependencies/isYarnUsed.d.ts +0 -1
- package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/check-dependencies/resolve.d.ts +0 -20
- package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/check-dependencies/semverLt.d.ts +0 -7
- package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/prismaClientResolver.d.ts +0 -20
- package/dist/internals/src/get-generators/utils/check-feature-flags/checkFeatureFlags.d.ts +0 -8
- package/dist/migrate/src/utils/getSchemaPathAndPrint.d.ts +0 -10
|
@@ -26,37 +26,75 @@ 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_XO3EJLOT_exports = {};
|
|
30
|
+
__export(chunk_XO3EJLOT_exports, {
|
|
31
31
|
DbPull: () => DbPull
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
34
|
-
var
|
|
35
|
-
var import_chunk_RTGQXNX6 = require("./chunk-RTGQXNX6.js");
|
|
36
|
-
var import_chunk_RP2N6UXA = require("./chunk-RP2N6UXA.js");
|
|
37
|
-
var import_chunk_AHJ2N6BJ = require("./chunk-AHJ2N6BJ.js");
|
|
33
|
+
module.exports = __toCommonJS(chunk_XO3EJLOT_exports);
|
|
34
|
+
var import_chunk_IINN7QUV = require("./chunk-IINN7QUV.js");
|
|
38
35
|
var import_chunk_JZ75RIMZ = require("./chunk-JZ75RIMZ.js");
|
|
39
36
|
var import_chunk_RR6BKMNO = require("./chunk-RR6BKMNO.js");
|
|
37
|
+
var import_chunk_RTGQXNX6 = require("./chunk-RTGQXNX6.js");
|
|
40
38
|
var import_chunk_JFKDSUIE = require("./chunk-JFKDSUIE.js");
|
|
39
|
+
var import_chunk_AI6DH66U = require("./chunk-AI6DH66U.js");
|
|
40
|
+
var import_chunk_AHJ2N6BJ = require("./chunk-AHJ2N6BJ.js");
|
|
41
41
|
var import_chunk_LGYRZ6CV = require("./chunk-LGYRZ6CV.js");
|
|
42
|
-
var import_chunk_ZOEKRXDP = require("./chunk-ZOEKRXDP.js");
|
|
43
|
-
var import_chunk_MATFO4ZW = require("./chunk-MATFO4ZW.js");
|
|
44
42
|
var import_chunk_3WC4XD74 = require("./chunk-3WC4XD74.js");
|
|
45
43
|
var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
|
|
46
|
-
var
|
|
44
|
+
var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
|
|
45
|
+
var import_chunk_YSWLN2IJ = require("./chunk-YSWLN2IJ.js");
|
|
46
|
+
var import_chunk_OEWQACEH = require("./chunk-OEWQACEH.js");
|
|
47
47
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
48
|
-
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
|
49
48
|
var import_debug = __toESM(require("@prisma/debug"));
|
|
50
49
|
var import_internals = require("@prisma/internals");
|
|
51
50
|
var import_path = __toESM(require("path"));
|
|
52
51
|
var debug = (0, import_debug.default)("prisma:db:pull");
|
|
53
|
-
var
|
|
52
|
+
var DbPull = class _DbPull {
|
|
54
53
|
static new() {
|
|
55
|
-
return new
|
|
54
|
+
return new _DbPull();
|
|
56
55
|
}
|
|
56
|
+
static help = (0, import_internals.format)(`
|
|
57
|
+
Pull the state from the database to the Prisma schema using introspection
|
|
58
|
+
|
|
59
|
+
${(0, import_chunk_SKRR5WT4.bold)("Usage")}
|
|
60
|
+
|
|
61
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db pull [flags/options]
|
|
62
|
+
|
|
63
|
+
${(0, import_chunk_SKRR5WT4.bold)("Flags")}
|
|
64
|
+
|
|
65
|
+
-h, --help Display this help message
|
|
66
|
+
--force Ignore current Prisma schema file
|
|
67
|
+
--print Print the introspected Prisma schema to stdout
|
|
68
|
+
|
|
69
|
+
${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
70
|
+
|
|
71
|
+
--config Custom path to your Prisma config file
|
|
72
|
+
--schema Custom path to your Prisma schema
|
|
73
|
+
--composite-type-depth Specify the depth for introspecting composite types (e.g. Embedded Documents in MongoDB)
|
|
74
|
+
Number, default is -1 for infinite depth, 0 = off
|
|
75
|
+
--schemas Specify the database schemas to introspect. This overrides the schemas defined in the datasource block of your Prisma schema.
|
|
76
|
+
--local-d1 Generate a Prisma schema from a local Cloudflare D1 database
|
|
77
|
+
${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
78
|
+
|
|
79
|
+
With an existing Prisma schema
|
|
80
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db pull
|
|
81
|
+
|
|
82
|
+
Or specify a Prisma schema path
|
|
83
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db pull --schema=./schema.prisma
|
|
84
|
+
|
|
85
|
+
Instead of saving the result to the filesystem, you can also print it to stdout
|
|
86
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db pull --print
|
|
87
|
+
|
|
88
|
+
Overwrite the current schema with the introspected schema instead of enriching it
|
|
89
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db pull --force
|
|
90
|
+
|
|
91
|
+
Set composite types introspection depth to 2 levels
|
|
92
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db pull --composite-type-depth=2
|
|
93
|
+
|
|
94
|
+
`);
|
|
57
95
|
urlToDatasource(url, defaultProvider) {
|
|
58
96
|
const provider = defaultProvider || (0, import_internals.protocolToConnectorType)(`${url.split(":")[0]}:`);
|
|
59
|
-
return (0,
|
|
97
|
+
return (0, import_chunk_AI6DH66U.printDatasources)([
|
|
60
98
|
{
|
|
61
99
|
config: {},
|
|
62
100
|
provider,
|
|
@@ -80,47 +118,57 @@ var _DbPull = class _DbPull2 {
|
|
|
80
118
|
"--local-d1": Boolean
|
|
81
119
|
// optional, only on cloudflare D1
|
|
82
120
|
});
|
|
83
|
-
const spinnerFactory = (0,
|
|
121
|
+
const spinnerFactory = (0, import_chunk_IINN7QUV.createSpinner)(!args["--print"]);
|
|
84
122
|
if (args instanceof Error) {
|
|
85
123
|
return this.help(args.message);
|
|
86
124
|
}
|
|
87
|
-
await (0, import_internals.checkUnsupportedDataProxy)("db pull", args, config.schema, !args["--url"]);
|
|
88
125
|
if (args["--help"]) {
|
|
89
126
|
return this.help();
|
|
90
127
|
}
|
|
91
128
|
const url = args["--url"];
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
129
|
+
await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: !args["--print"], config });
|
|
130
|
+
const schemaContext = await (0, import_internals.loadSchemaContext)({
|
|
131
|
+
schemaPathFromArg: args["--schema"],
|
|
132
|
+
schemaPathFromConfig: config.schema,
|
|
133
|
+
printLoadMessage: false,
|
|
134
|
+
allowNull: true
|
|
135
|
+
});
|
|
136
|
+
const cmd = "db pull";
|
|
137
|
+
(0, import_internals.checkUnsupportedDataProxy)({
|
|
138
|
+
cmd,
|
|
139
|
+
schemaContext: schemaContext && !url ? schemaContext : void 0,
|
|
140
|
+
urls: [url]
|
|
141
|
+
});
|
|
142
|
+
(0, import_internals.checkUnsupportedSchemaEngineWasm)({
|
|
143
|
+
cmd,
|
|
144
|
+
config,
|
|
145
|
+
args,
|
|
146
|
+
flags: ["--url", "--local-d1"]
|
|
147
|
+
});
|
|
148
|
+
if (schemaContext && !args["--print"]) {
|
|
149
|
+
process.stdout.write((0, import_chunk_SKRR5WT4.dim)(`Prisma schema loaded from ${schemaContext.loadedFromPathForLogMessages}`) + "\n");
|
|
150
|
+
(0, import_chunk_QOPTDDIH.printDatasource)({ datasourceInfo: (0, import_chunk_74LUB4XX.parseDatasourceInfo)(schemaContext?.primaryDatasource) });
|
|
102
151
|
}
|
|
103
152
|
const fromD1 = Boolean(args["--local-d1"]);
|
|
104
|
-
if (!url && !
|
|
153
|
+
if (!url && !schemaContext && !fromD1) {
|
|
105
154
|
throw new import_chunk_3WC4XD74.NoSchemaFoundError();
|
|
106
155
|
}
|
|
107
|
-
const
|
|
108
|
-
|
|
156
|
+
const adapter = await config.migrate?.adapter(process.env);
|
|
157
|
+
const { firstDatasource, schema, validationWarning } = await (0, import_chunk_OEWQACEH.z)({ url, schemaContext, fromD1 }).when(
|
|
158
|
+
(input) => input.schemaContext !== null,
|
|
109
159
|
async (input) => {
|
|
110
|
-
const
|
|
111
|
-
const
|
|
112
|
-
datamodel: rawSchema,
|
|
113
|
-
ignoreEnvVarErrors: true
|
|
114
|
-
});
|
|
115
|
-
const previewFeatures = engineConfig.generators.find(({ name }) => name === "client")?.previewFeatures;
|
|
116
|
-
const firstDatasource2 = engineConfig.datasources[0] ? engineConfig.datasources[0] : void 0;
|
|
160
|
+
const previewFeatures = input.schemaContext.generators.find(({ name }) => name === "client")?.previewFeatures;
|
|
161
|
+
const firstDatasource2 = input.schemaContext.primaryDatasource ? input.schemaContext.primaryDatasource : void 0;
|
|
117
162
|
if (input.url) {
|
|
118
163
|
let providerFromSchema = firstDatasource2?.provider;
|
|
119
164
|
if (providerFromSchema === "postgres") {
|
|
120
165
|
providerFromSchema = "postgresql";
|
|
121
166
|
}
|
|
122
167
|
const providerFromUrl = (0, import_internals.protocolToConnectorType)(`${input.url.split(":")[0]}:`);
|
|
123
|
-
const schema2 = (0, import_chunk_RR6BKMNO.replaceOrAddDatasource)(
|
|
168
|
+
const schema2 = (0, import_chunk_RR6BKMNO.replaceOrAddDatasource)(
|
|
169
|
+
this.urlToDatasource(input.url, providerFromSchema),
|
|
170
|
+
input.schemaContext.schemaFiles
|
|
171
|
+
);
|
|
124
172
|
if (providerFromSchema && providerFromUrl && providerFromSchema !== providerFromUrl && Boolean(providerFromSchema === "cockroachdb" && providerFromUrl === "postgresql") === false) {
|
|
125
173
|
throw new Error(
|
|
126
174
|
`The database provider found in --url (${providerFromUrl}) is different from the provider found in the Prisma schema (${providerFromSchema}).`
|
|
@@ -129,7 +177,7 @@ var _DbPull = class _DbPull2 {
|
|
|
129
177
|
return { firstDatasource: firstDatasource2, schema: schema2, validationWarning: void 0 };
|
|
130
178
|
} else if (input.fromD1) {
|
|
131
179
|
const d1Database = await (0, import_internals.locateLocalCloudflareD1)({ arg: "--from-local-d1" });
|
|
132
|
-
const pathToSQLiteFile = import_path.default.relative(
|
|
180
|
+
const pathToSQLiteFile = import_path.default.relative(input.schemaContext.schemaRootDir, d1Database);
|
|
133
181
|
const schema2 = [
|
|
134
182
|
["schema.prisma", this.urlToDatasource(`file:${pathToSQLiteFile}`, "sqlite")]
|
|
135
183
|
];
|
|
@@ -151,11 +199,11 @@ var _DbPull = class _DbPull2 {
|
|
|
151
199
|
}
|
|
152
200
|
} else {
|
|
153
201
|
await (0, import_internals.getConfig)({
|
|
154
|
-
datamodel:
|
|
202
|
+
datamodel: input.schemaContext.schemaFiles,
|
|
155
203
|
ignoreEnvVarErrors: false
|
|
156
204
|
});
|
|
157
205
|
}
|
|
158
|
-
return { firstDatasource: firstDatasource2, schema:
|
|
206
|
+
return { firstDatasource: firstDatasource2, schema: input.schemaContext.schemaFiles, validationWarning: void 0 };
|
|
159
207
|
}
|
|
160
208
|
).when(
|
|
161
209
|
(input) => input.fromD1 === true,
|
|
@@ -186,10 +234,9 @@ ${this.urlToDatasource(`file:${pathToSQLiteFile}`, "sqlite")}`;
|
|
|
186
234
|
return { firstDatasource: config2.datasources[0], schema: schema2, validationWarning: void 0 };
|
|
187
235
|
}
|
|
188
236
|
).run();
|
|
189
|
-
if (
|
|
190
|
-
const schemas = await (0, import_internals.getSchema)(args["--schema"], config.schema);
|
|
237
|
+
if (schemaContext) {
|
|
191
238
|
const modelRegex = /\s*model\s*(\w+)\s*{/;
|
|
192
|
-
const isReintrospection =
|
|
239
|
+
const isReintrospection = schemaContext.schemaFiles.some(([_, schema2]) => !!modelRegex.exec(schema2));
|
|
193
240
|
if (isReintrospection && !args["--force"] && firstDatasource?.provider === "mongodb") {
|
|
194
241
|
throw new Error(`Iterating on one schema using re-introspection with db pull is currently not supported with MongoDB provider.
|
|
195
242
|
You can explicitly ignore and override your current local schema file with ${(0, import_chunk_SKRR5WT4.green)(
|
|
@@ -200,18 +247,19 @@ Some information will be lost (relations, comments, mapped fields, @ignore...),
|
|
|
200
247
|
)} for more info.`);
|
|
201
248
|
}
|
|
202
249
|
}
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
}
|
|
206
|
-
const basedOn = !args["--url"] && schemaPath ? ` based on datasource defined in ${(0, import_chunk_SKRR5WT4.underline)(import_path.default.relative(process.cwd(), schemaPath))}` : "";
|
|
250
|
+
const migrate = await import_chunk_YSWLN2IJ.Migrate.setup({ adapter, schemaContext: schemaContext ?? void 0 });
|
|
251
|
+
const engine = migrate.engine;
|
|
252
|
+
const basedOn = !args["--url"] && schemaContext?.primaryDatasource ? ` based on datasource defined in ${(0, import_chunk_SKRR5WT4.underline)(schemaContext.loadedFromPathForLogMessages)}` : "";
|
|
207
253
|
const introspectionSpinner = spinnerFactory(`Introspecting${basedOn}`);
|
|
208
254
|
const before = Math.round(performance.now());
|
|
209
255
|
let introspectionSchema = void 0;
|
|
210
256
|
let introspectionWarnings;
|
|
211
257
|
try {
|
|
258
|
+
const directoryConfig = (0, import_internals.inferDirectoryConfig)(schemaContext);
|
|
212
259
|
const introspectionResult = await engine.introspect({
|
|
213
260
|
schema: (0, import_internals.toSchemasContainer)(schema),
|
|
214
|
-
baseDirectoryPath:
|
|
261
|
+
baseDirectoryPath: schemaContext?.schemaRootDir ?? process.cwd(),
|
|
262
|
+
viewsDirectoryPath: directoryConfig.viewsDirPath,
|
|
215
263
|
force: args["--force"],
|
|
216
264
|
compositeTypeDepth: args["--composite-type-depth"],
|
|
217
265
|
namespaces: args["--schemas"]?.split(",")
|
|
@@ -283,7 +331,6 @@ Or run this command with the ${(0, import_chunk_SKRR5WT4.green)(
|
|
|
283
331
|
console.error(introspectionWarningsMessage.replace(/(\n)/gm, "\n// "));
|
|
284
332
|
}
|
|
285
333
|
} else {
|
|
286
|
-
schemaPath = schemaPath || "schema.prisma";
|
|
287
334
|
if (args["--force"]) {
|
|
288
335
|
await (0, import_chunk_JZ75RIMZ.removeSchemaFiles)(schema);
|
|
289
336
|
}
|
|
@@ -300,8 +347,9 @@ Or run this command with the ${(0, import_chunk_SKRR5WT4.green)(
|
|
|
300
347
|
const modelsAndTypesCountMessage = modelsCount + typesCount > 1 ? `${modelsAndTypesMessage} and wrote them` : `${modelsAndTypesMessage} and wrote it`;
|
|
301
348
|
const renderValidationWarning = validationWarning ? `
|
|
302
349
|
${(0, import_chunk_SKRR5WT4.yellow)(validationWarning)}` : "";
|
|
350
|
+
const introspectedSchemaPath = schemaContext?.loadedFromPathForLogMessages || introspectionSchema.files[0].path;
|
|
303
351
|
introspectionSpinner.success(`Introspected ${modelsAndTypesCountMessage} into ${(0, import_chunk_SKRR5WT4.underline)(
|
|
304
|
-
import_path.default.relative(process.cwd(),
|
|
352
|
+
import_path.default.relative(process.cwd(), introspectedSchemaPath)
|
|
305
353
|
)} in ${(0, import_chunk_SKRR5WT4.bold)((0, import_internals.formatms)(Math.round(performance.now()) - before))}
|
|
306
354
|
${(0, import_chunk_SKRR5WT4.yellow)(introspectionWarningsMessage)}
|
|
307
355
|
${`Run ${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)("prisma generate"))} to generate Prisma Client.`}${renderValidationWarning}`);
|
|
@@ -319,48 +367,8 @@ ${warnings}`;
|
|
|
319
367
|
if (error) {
|
|
320
368
|
return new import_internals.HelpError(`
|
|
321
369
|
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
|
|
322
|
-
${
|
|
370
|
+
${_DbPull.help}`);
|
|
323
371
|
}
|
|
324
|
-
return
|
|
372
|
+
return _DbPull.help;
|
|
325
373
|
}
|
|
326
374
|
};
|
|
327
|
-
(0, import_chunk_WWAWV7DQ.__publicField)(_DbPull, "help", (0, import_internals.format)(`
|
|
328
|
-
Pull the state from the database to the Prisma schema using introspection
|
|
329
|
-
|
|
330
|
-
${(0, import_chunk_SKRR5WT4.bold)("Usage")}
|
|
331
|
-
|
|
332
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db pull [flags/options]
|
|
333
|
-
|
|
334
|
-
${(0, import_chunk_SKRR5WT4.bold)("Flags")}
|
|
335
|
-
|
|
336
|
-
-h, --help Display this help message
|
|
337
|
-
--force Ignore current Prisma schema file
|
|
338
|
-
--print Print the introspected Prisma schema to stdout
|
|
339
|
-
|
|
340
|
-
${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
341
|
-
|
|
342
|
-
--config Custom path to your Prisma config file
|
|
343
|
-
--schema Custom path to your Prisma schema
|
|
344
|
-
--composite-type-depth Specify the depth for introspecting composite types (e.g. Embedded Documents in MongoDB)
|
|
345
|
-
Number, default is -1 for infinite depth, 0 = off
|
|
346
|
-
--schemas Specify the database schemas to introspect. This overrides the schemas defined in the datasource block of your Prisma schema.
|
|
347
|
-
--local-d1 Generate a Prisma schema from a local Cloudflare D1 database
|
|
348
|
-
${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
349
|
-
|
|
350
|
-
With an existing Prisma schema
|
|
351
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db pull
|
|
352
|
-
|
|
353
|
-
Or specify a Prisma schema path
|
|
354
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db pull --schema=./schema.prisma
|
|
355
|
-
|
|
356
|
-
Instead of saving the result to the filesystem, you can also print it to stdout
|
|
357
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db pull --print
|
|
358
|
-
|
|
359
|
-
Overwrite the current schema with the introspected schema instead of enriching it
|
|
360
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db pull --force
|
|
361
|
-
|
|
362
|
-
Set composite types introspection depth to 2 levels
|
|
363
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db pull --composite-type-depth=2
|
|
364
|
-
|
|
365
|
-
`));
|
|
366
|
-
var DbPull = _DbPull;
|
|
@@ -26,31 +26,58 @@ 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_YBS5GSRF_exports = {};
|
|
30
|
+
__export(chunk_YBS5GSRF_exports, {
|
|
31
31
|
MigrateDev: () => MigrateDev
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
34
|
-
var
|
|
33
|
+
module.exports = __toCommonJS(chunk_YBS5GSRF_exports);
|
|
34
|
+
var import_chunk_YBX7R3MT = require("./chunk-YBX7R3MT.js");
|
|
35
35
|
var import_chunk_7CQBDP4H = require("./chunk-7CQBDP4H.js");
|
|
36
|
-
var import_chunk_V3ZMNXZC = require("./chunk-V3ZMNXZC.js");
|
|
37
|
-
var import_chunk_255BRND3 = require("./chunk-255BRND3.js");
|
|
38
|
-
var import_chunk_UP6FVCDK = require("./chunk-UP6FVCDK.js");
|
|
39
|
-
var import_chunk_KOF4LGTS = require("./chunk-KOF4LGTS.js");
|
|
40
36
|
var import_chunk_3WC4XD74 = require("./chunk-3WC4XD74.js");
|
|
41
|
-
var
|
|
37
|
+
var import_chunk_5LKIRKDL = require("./chunk-5LKIRKDL.js");
|
|
38
|
+
var import_chunk_KRQEFTDT = require("./chunk-KRQEFTDT.js");
|
|
39
|
+
var import_chunk_UP6FVCDK = require("./chunk-UP6FVCDK.js");
|
|
42
40
|
var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
|
|
43
|
-
var
|
|
41
|
+
var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
|
|
42
|
+
var import_chunk_YSWLN2IJ = require("./chunk-YSWLN2IJ.js");
|
|
44
43
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
45
|
-
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
|
46
44
|
var import_debug = __toESM(require("@prisma/debug"));
|
|
47
45
|
var import_internals = require("@prisma/internals");
|
|
48
46
|
var import_prompts = __toESM(require("prompts"));
|
|
49
47
|
var debug = (0, import_debug.default)("prisma:migrate:dev");
|
|
50
|
-
var
|
|
48
|
+
var MigrateDev = class _MigrateDev {
|
|
51
49
|
static new() {
|
|
52
|
-
return new
|
|
50
|
+
return new _MigrateDev();
|
|
53
51
|
}
|
|
52
|
+
static help = (0, import_internals.format)(`
|
|
53
|
+
${process.platform === "win32" ? "" : "\u{1F3CB}\uFE0F "}Create a migration from changes in Prisma schema, apply it to the database, trigger generators (e.g. Prisma Client)
|
|
54
|
+
|
|
55
|
+
${(0, import_chunk_SKRR5WT4.bold)("Usage")}
|
|
56
|
+
|
|
57
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate dev [options]
|
|
58
|
+
|
|
59
|
+
${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
60
|
+
|
|
61
|
+
-h, --help Display this help message
|
|
62
|
+
--config Custom path to your Prisma config file
|
|
63
|
+
--schema Custom path to your Prisma schema
|
|
64
|
+
-n, --name Name the migration
|
|
65
|
+
--create-only Create a new migration but do not apply it
|
|
66
|
+
The migration will be empty if there are no changes in Prisma schema
|
|
67
|
+
--skip-generate Skip triggering generators (e.g. Prisma Client)
|
|
68
|
+
--skip-seed Skip triggering seed
|
|
69
|
+
|
|
70
|
+
${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
71
|
+
|
|
72
|
+
Create a migration from changes in Prisma schema, apply it to the database, trigger generators (e.g. Prisma Client)
|
|
73
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate dev
|
|
74
|
+
|
|
75
|
+
Specify a schema
|
|
76
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate dev --schema=./schema.prisma
|
|
77
|
+
|
|
78
|
+
Create a migration without applying it
|
|
79
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate dev --create-only
|
|
80
|
+
`);
|
|
54
81
|
async parse(argv, config) {
|
|
55
82
|
const args = (0, import_internals.arg)(argv, {
|
|
56
83
|
"--help": Boolean,
|
|
@@ -69,27 +96,29 @@ var _MigrateDev = class _MigrateDev2 {
|
|
|
69
96
|
if ((0, import_internals.isError)(args)) {
|
|
70
97
|
return this.help(args.message);
|
|
71
98
|
}
|
|
72
|
-
await (0, import_internals.checkUnsupportedDataProxy)("migrate dev", args, config.schema, true);
|
|
73
99
|
if (args["--help"]) {
|
|
74
100
|
return this.help();
|
|
75
101
|
}
|
|
76
102
|
await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
|
|
77
|
-
const
|
|
78
|
-
|
|
103
|
+
const schemaContext = await (0, import_internals.loadSchemaContext)({
|
|
104
|
+
schemaPathFromArg: args["--schema"],
|
|
105
|
+
schemaPathFromConfig: config.schema
|
|
106
|
+
});
|
|
107
|
+
const { migrationsDirPath } = (0, import_internals.inferDirectoryConfig)(schemaContext);
|
|
108
|
+
(0, import_internals.checkUnsupportedDataProxy)({ cmd: "migrate dev", schemaContext });
|
|
109
|
+
const datasourceInfo = (0, import_chunk_74LUB4XX.parseDatasourceInfo)(schemaContext.primaryDatasource);
|
|
79
110
|
(0, import_chunk_QOPTDDIH.printDatasource)({ datasourceInfo });
|
|
80
111
|
process.stdout.write("\n");
|
|
81
|
-
(0, import_internals.validate)({
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (wasDbCreated) {
|
|
90
|
-
process.stdout.write(wasDbCreated + "\n\n");
|
|
112
|
+
(0, import_internals.validate)({ schemas: schemaContext.schemaFiles });
|
|
113
|
+
const adapter = await config.migrate?.adapter(process.env);
|
|
114
|
+
let wasDbCreated;
|
|
115
|
+
if (!adapter) {
|
|
116
|
+
wasDbCreated = await (0, import_chunk_74LUB4XX.ensureDatabaseExists)(schemaContext.primaryDatasource);
|
|
117
|
+
if (wasDbCreated) {
|
|
118
|
+
process.stdout.write(wasDbCreated + "\n\n");
|
|
119
|
+
}
|
|
91
120
|
}
|
|
92
|
-
const migrate =
|
|
121
|
+
const migrate = await import_chunk_YSWLN2IJ.Migrate.setup({ adapter, migrationsDirPath, schemaContext });
|
|
93
122
|
let devDiagnostic;
|
|
94
123
|
try {
|
|
95
124
|
devDiagnostic = await migrate.devDiagnostic();
|
|
@@ -121,7 +150,7 @@ ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)("All data will
|
|
|
121
150
|
`
|
|
122
151
|
The following migration(s) have been applied:
|
|
123
152
|
|
|
124
|
-
${(0,
|
|
153
|
+
${(0, import_chunk_KRQEFTDT.printFilesFromMigrationIds)(
|
|
125
154
|
"migrations",
|
|
126
155
|
appliedMigrationNames,
|
|
127
156
|
{
|
|
@@ -181,7 +210,7 @@ ${(0, import_chunk_255BRND3.printFilesFromMigrationIds)(
|
|
|
181
210
|
}
|
|
182
211
|
let migrationName = void 0;
|
|
183
212
|
if (evaluateDataLossResult.migrationSteps > 0 || args["--create-only"]) {
|
|
184
|
-
const getMigrationNameResult = await (0,
|
|
213
|
+
const getMigrationNameResult = await (0, import_chunk_YBX7R3MT.getMigrationName)(args["--name"]);
|
|
185
214
|
if (getMigrationNameResult.userCancelled) {
|
|
186
215
|
process.stdout.write(getMigrationNameResult.userCancelled + "\n");
|
|
187
216
|
migrate.stop();
|
|
@@ -193,10 +222,9 @@ ${(0, import_chunk_255BRND3.printFilesFromMigrationIds)(
|
|
|
193
222
|
let migrationIds;
|
|
194
223
|
try {
|
|
195
224
|
const createMigrationResult = await migrate.createMigration({
|
|
196
|
-
migrationsDirectoryPath: migrate.migrationsDirectoryPath,
|
|
197
225
|
migrationName: migrationName || "",
|
|
198
226
|
draft: args["--create-only"] ? true : false,
|
|
199
|
-
schema:
|
|
227
|
+
schema: migrate.getPrismaSchema()
|
|
200
228
|
});
|
|
201
229
|
debug({ createMigrationResult });
|
|
202
230
|
if (args["--create-only"]) {
|
|
@@ -226,7 +254,7 @@ You can now edit it and apply it by running ${(0, import_chunk_SKRR5WT4.green)((
|
|
|
226
254
|
`
|
|
227
255
|
The following migration(s) have been created and applied from new schema changes:
|
|
228
256
|
|
|
229
|
-
${(0,
|
|
257
|
+
${(0, import_chunk_KRQEFTDT.printFilesFromMigrationIds)(
|
|
230
258
|
"migrations",
|
|
231
259
|
migrationIds,
|
|
232
260
|
{
|
|
@@ -244,10 +272,10 @@ ${(0, import_chunk_SKRR5WT4.green)("Your database is now in sync with your schem
|
|
|
244
272
|
}
|
|
245
273
|
if (wasDbCreated && !process.env.PRISMA_MIGRATE_SKIP_SEED && !args["--skip-seed"]) {
|
|
246
274
|
try {
|
|
247
|
-
const seedCommandFromPkgJson = await (0,
|
|
275
|
+
const seedCommandFromPkgJson = await (0, import_chunk_5LKIRKDL.getSeedCommandFromPackageJson)(process.cwd());
|
|
248
276
|
if (seedCommandFromPkgJson) {
|
|
249
277
|
process.stdout.write("\n");
|
|
250
|
-
const successfulSeeding = await (0,
|
|
278
|
+
const successfulSeeding = await (0, import_chunk_5LKIRKDL.executeSeedCommand)({ commandFromConfig: seedCommandFromPkgJson });
|
|
251
279
|
if (successfulSeeding) {
|
|
252
280
|
process.stdout.write(`
|
|
253
281
|
${process.platform === "win32" ? "" : "\u{1F331} "}The seed command has been executed.
|
|
@@ -255,9 +283,6 @@ ${process.platform === "win32" ? "" : "\u{1F331} "}The seed command has been ex
|
|
|
255
283
|
} else {
|
|
256
284
|
process.exit(1);
|
|
257
285
|
}
|
|
258
|
-
} else {
|
|
259
|
-
const { schemaPath: schemaPath2 } = await (0, import_internals.getSchemaWithPath)(args["--schema"], config.schema);
|
|
260
|
-
await (0, import_chunk_V3ZMNXZC.verifySeedConfigAndReturnMessage)(schemaPath2);
|
|
261
286
|
}
|
|
262
287
|
} catch (e) {
|
|
263
288
|
console.error(e);
|
|
@@ -289,38 +314,8 @@ ${process.platform === "win32" ? "" : "\u{1F331} "}The seed command has been ex
|
|
|
289
314
|
if (error) {
|
|
290
315
|
return new import_internals.HelpError(`
|
|
291
316
|
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
|
|
292
|
-
${
|
|
317
|
+
${_MigrateDev.help}`);
|
|
293
318
|
}
|
|
294
|
-
return
|
|
319
|
+
return _MigrateDev.help;
|
|
295
320
|
}
|
|
296
321
|
};
|
|
297
|
-
(0, import_chunk_WWAWV7DQ.__publicField)(_MigrateDev, "help", (0, import_internals.format)(`
|
|
298
|
-
${process.platform === "win32" ? "" : "\u{1F3CB}\uFE0F "}Create a migration from changes in Prisma schema, apply it to the database, trigger generators (e.g. Prisma Client)
|
|
299
|
-
|
|
300
|
-
${(0, import_chunk_SKRR5WT4.bold)("Usage")}
|
|
301
|
-
|
|
302
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate dev [options]
|
|
303
|
-
|
|
304
|
-
${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
305
|
-
|
|
306
|
-
-h, --help Display this help message
|
|
307
|
-
--config Custom path to your Prisma config file
|
|
308
|
-
--schema Custom path to your Prisma schema
|
|
309
|
-
-n, --name Name the migration
|
|
310
|
-
--create-only Create a new migration but do not apply it
|
|
311
|
-
The migration will be empty if there are no changes in Prisma schema
|
|
312
|
-
--skip-generate Skip triggering generators (e.g. Prisma Client)
|
|
313
|
-
--skip-seed Skip triggering seed
|
|
314
|
-
|
|
315
|
-
${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
316
|
-
|
|
317
|
-
Create a migration from changes in Prisma schema, apply it to the database, trigger generators (e.g. Prisma Client)
|
|
318
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate dev
|
|
319
|
-
|
|
320
|
-
Specify a schema
|
|
321
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate dev --schema=./schema.prisma
|
|
322
|
-
|
|
323
|
-
Create a migration without applying it
|
|
324
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate dev --create-only
|
|
325
|
-
`));
|
|
326
|
-
var MigrateDev = _MigrateDev;
|
|
@@ -16,15 +16,15 @@ 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_YBX7R3MT_exports = {};
|
|
20
|
+
__export(chunk_YBX7R3MT_exports, {
|
|
21
21
|
getMigrationName: () => getMigrationName
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
24
|
-
var
|
|
23
|
+
module.exports = __toCommonJS(chunk_YBX7R3MT_exports);
|
|
24
|
+
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
|
|
25
25
|
var import_internals = require("@prisma/internals");
|
|
26
26
|
var import_prompts = require("prompts");
|
|
27
|
-
var require_escape_string_regexp = (0,
|
|
27
|
+
var require_escape_string_regexp = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
28
28
|
"../../node_modules/.pnpm/escape-string-regexp@4.0.0/node_modules/escape-string-regexp/index.js"(exports, module2) {
|
|
29
29
|
"use strict";
|
|
30
30
|
module2.exports = (string) => {
|
|
@@ -35,7 +35,7 @@ var require_escape_string_regexp = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
|
-
var require_lodash = (0,
|
|
38
|
+
var require_lodash = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
39
39
|
"../../node_modules/.pnpm/lodash.deburr@4.1.0/node_modules/lodash.deburr/index.js"(exports, module2) {
|
|
40
40
|
"use strict";
|
|
41
41
|
var INFINITY = 1 / 0;
|
|
@@ -279,7 +279,7 @@ var require_lodash = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
|
279
279
|
module2.exports = deburr;
|
|
280
280
|
}
|
|
281
281
|
});
|
|
282
|
-
var require_escape_string_regexp2 = (0,
|
|
282
|
+
var require_escape_string_regexp2 = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
283
283
|
"../../node_modules/.pnpm/escape-string-regexp@2.0.0/node_modules/escape-string-regexp/index.js"(exports, module2) {
|
|
284
284
|
"use strict";
|
|
285
285
|
var matchOperatorsRegex = /[|\\{}()[\]^$+*?.-]/g;
|
|
@@ -291,7 +291,7 @@ var require_escape_string_regexp2 = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
|
291
291
|
};
|
|
292
292
|
}
|
|
293
293
|
});
|
|
294
|
-
var require_replacements = (0,
|
|
294
|
+
var require_replacements = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
295
295
|
"../../node_modules/.pnpm/@sindresorhus+transliterate@0.1.2/node_modules/@sindresorhus/transliterate/replacements.js"(exports, module2) {
|
|
296
296
|
"use strict";
|
|
297
297
|
module2.exports = [
|
|
@@ -1067,7 +1067,7 @@ var require_replacements = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
|
1067
1067
|
];
|
|
1068
1068
|
}
|
|
1069
1069
|
});
|
|
1070
|
-
var require_transliterate = (0,
|
|
1070
|
+
var require_transliterate = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
1071
1071
|
"../../node_modules/.pnpm/@sindresorhus+transliterate@0.1.2/node_modules/@sindresorhus/transliterate/index.js"(exports, module2) {
|
|
1072
1072
|
"use strict";
|
|
1073
1073
|
var deburr = require_lodash();
|
|
@@ -1098,7 +1098,7 @@ var require_transliterate = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
|
1098
1098
|
};
|
|
1099
1099
|
}
|
|
1100
1100
|
});
|
|
1101
|
-
var require_overridable_replacements = (0,
|
|
1101
|
+
var require_overridable_replacements = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
1102
1102
|
"../../node_modules/.pnpm/@sindresorhus+slugify@1.1.2/node_modules/@sindresorhus/slugify/overridable-replacements.js"(exports, module2) {
|
|
1103
1103
|
"use strict";
|
|
1104
1104
|
module2.exports = [
|
|
@@ -1108,7 +1108,7 @@ var require_overridable_replacements = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
|
1108
1108
|
];
|
|
1109
1109
|
}
|
|
1110
1110
|
});
|
|
1111
|
-
var require_slugify = (0,
|
|
1111
|
+
var require_slugify = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
1112
1112
|
"../../node_modules/.pnpm/@sindresorhus+slugify@1.1.2/node_modules/@sindresorhus/slugify/index.js"(exports, module2) {
|
|
1113
1113
|
"use strict";
|
|
1114
1114
|
var escapeStringRegexp = require_escape_string_regexp();
|
|
@@ -1183,7 +1183,7 @@ var require_slugify = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
|
1183
1183
|
module2.exports.counter = counter;
|
|
1184
1184
|
}
|
|
1185
1185
|
});
|
|
1186
|
-
var import_slugify = (0,
|
|
1186
|
+
var import_slugify = (0, import_chunk_2ESYSVXG.__toESM)(require_slugify());
|
|
1187
1187
|
async function getMigrationName(name) {
|
|
1188
1188
|
const maxMigrationNameLength = 200;
|
|
1189
1189
|
if (name) {
|