@prisma/migrate 6.5.0-dev.1 → 6.5.0-dev.3

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.
Files changed (102) hide show
  1. package/dist/CLI.js +3 -4
  2. package/dist/Migrate.js +6 -7
  3. package/dist/SchemaEngine.js +6 -7
  4. package/dist/bin.js +116 -146
  5. package/dist/{chunk-WOOPRG54.js → chunk-255BRND3.js} +7 -14
  6. package/dist/{chunk-75EIHNAH.js → chunk-2NMFKGXM.js} +5 -6
  7. package/dist/chunk-3WC4XD74.js +98 -0
  8. package/dist/chunk-4EV2RVXY.js +226 -0
  9. package/dist/{chunk-YWWOSXMY.js → chunk-4JQIX6O7.js} +7 -15
  10. package/dist/{chunk-M5YNQ2NP.js → chunk-6DFJIBJX.js} +5 -12
  11. package/dist/{chunk-SGCF5OHF.js → chunk-7CQBDP4H.js} +6 -13
  12. package/dist/{chunk-7IT2ZO3D.js → chunk-AHJ2N6BJ.js} +3 -9
  13. package/dist/chunk-C2PR6JQR.js +266 -0
  14. package/dist/chunk-CTPONE6G.js +65 -0
  15. package/dist/{chunk-DUCG3NRP.js → chunk-D74DU52C.js} +633 -806
  16. package/dist/{chunk-UVNSK22K.js → chunk-DDHPSYC4.js} +122 -130
  17. package/dist/{chunk-CUDKD32S.js → chunk-DIAO4W7O.js} +11 -17
  18. package/dist/{chunk-XJQP3B4W.js → chunk-DJMFXNR4.js} +7 -15
  19. package/dist/{chunk-V5LEZ5BX.js → chunk-DY3QUOB7.js} +634 -807
  20. package/dist/{chunk-YD7GG4WS.js → chunk-FRTPDRF2.js} +66 -74
  21. package/dist/chunk-HIFVDK2U.js +96 -0
  22. package/dist/chunk-I4EY55DC.js +195 -0
  23. package/dist/{chunk-WLJHGKMK.js → chunk-IHDN3L3R.js} +7 -8
  24. package/dist/{chunk-INC2OACE.js → chunk-JFKDSUIE.js} +3 -9
  25. package/dist/{chunk-V7DE6JTG.js → chunk-JZ75RIMZ.js} +3 -9
  26. package/dist/{chunk-AAATUOV6.js → chunk-L6KOIJJ5.js} +53 -59
  27. package/dist/{chunk-GN5BY5N2.js → chunk-LGYRZ6CV.js} +4 -10
  28. package/dist/chunk-LVLRGTYH.js +148 -0
  29. package/dist/{chunk-CQQQ436N.js → chunk-MATFO4ZW.js} +186 -200
  30. package/dist/{chunk-IFCV5MY4.js → chunk-OCQGHQED.js} +5 -11
  31. package/dist/chunk-ORL3LJOT.js +470 -0
  32. package/dist/{chunk-Q7ACZDDT.js → chunk-QOPTDDIH.js} +5 -12
  33. package/dist/chunk-QTAIWPLH.js +78 -0
  34. package/dist/{chunk-35LAJN5S.js → chunk-RP2N6UXA.js} +23 -29
  35. package/dist/chunk-RQFGRXJI.js +174 -0
  36. package/dist/{chunk-QBK5XTJE.js → chunk-RR6BKMNO.js} +3 -9
  37. package/dist/{chunk-ILJRJJ3S.js → chunk-RTGQXNX6.js} +3 -9
  38. package/dist/chunk-SKRR5WT4.js +76 -0
  39. package/dist/chunk-TM3ETZES.js +153 -0
  40. package/dist/{chunk-KPUNMK5W.js → chunk-TWPTG4XS.js} +5 -12
  41. package/dist/{chunk-6QFE3AWR.js → chunk-UP6FVCDK.js} +6 -13
  42. package/dist/{chunk-YKUZUAXA.js → chunk-V3ZMNXZC.js} +16 -23
  43. package/dist/chunk-WLPX3672.js +365 -0
  44. package/dist/chunk-WNH2ACJS.js +122 -0
  45. package/dist/chunk-XSNOKQTD.js +347 -0
  46. package/dist/{chunk-X6XGFLEF.js → chunk-YZVZCC3I.js} +25 -30
  47. package/dist/commands/DbCommand.js +3 -4
  48. package/dist/commands/DbDrop.js +9 -9
  49. package/dist/commands/DbExecute.js +7 -8
  50. package/dist/commands/DbPull.js +18 -19
  51. package/dist/commands/DbPush.js +12 -13
  52. package/dist/commands/DbSeed.js +4 -5
  53. package/dist/commands/MigrateCommand.js +3 -4
  54. package/dist/commands/MigrateDeploy.js +13 -14
  55. package/dist/commands/MigrateDev.js +17 -18
  56. package/dist/commands/MigrateDiff.js +8 -9
  57. package/dist/commands/MigrateReset.js +15 -16
  58. package/dist/commands/MigrateResolve.js +11 -12
  59. package/dist/commands/MigrateStatus.js +11 -12
  60. package/dist/index.js +60 -77
  61. package/dist/{multipart-parser-73VM3J4A.js → multipart-parser-NDLECNMN.js} +527 -561
  62. package/dist/utils/byline.js +5 -6
  63. package/dist/utils/captureStdout.js +2 -3
  64. package/dist/utils/countModelsAndTypes.js +2 -3
  65. package/dist/utils/ensureDatabaseExists.js +8 -9
  66. package/dist/utils/errors.js +8 -9
  67. package/dist/utils/flagErrors.js +5 -5
  68. package/dist/utils/getDatabaseVersionSafe.js +6 -7
  69. package/dist/utils/getSchemaPathAndPrint.js +4 -5
  70. package/dist/utils/handleEvaluateDataloss.js +3 -4
  71. package/dist/utils/introspectSql.js +6 -6
  72. package/dist/utils/isSchemaEmpty.js +2 -3
  73. package/dist/utils/printDatasource.js +3 -4
  74. package/dist/utils/printDatasources.js +3 -4
  75. package/dist/utils/printFiles.js +5 -6
  76. package/dist/utils/printIntrospectedSchema.js +2 -3
  77. package/dist/utils/printMigrationId.js +4 -5
  78. package/dist/utils/promptForMigrationName.js +2 -3
  79. package/dist/utils/removeSchemaFiles.js +2 -3
  80. package/dist/utils/replaceOrAddDatasource.js +2 -3
  81. package/dist/utils/replaceOrAddDatasource.test.js +7 -8
  82. package/dist/utils/saveSchemaFiles.js +2 -3
  83. package/dist/utils/seed.js +6 -7
  84. package/dist/utils/spinner.js +2 -3
  85. package/dist/utils/unixSocket.js +2 -3
  86. package/dist/views/handleViewsIO.js +2 -3
  87. package/package.json +6 -6
  88. package/dist/chunk-26XQQ4AG.js +0 -386
  89. package/dist/chunk-2RSEPJFX.js +0 -165
  90. package/dist/chunk-4B2LXK4R.js +0 -207
  91. package/dist/chunk-4UJBOCZJ.js +0 -130
  92. package/dist/chunk-5HZLCY6X.js +0 -161
  93. package/dist/chunk-6TE2RIPN.js +0 -80
  94. package/dist/chunk-7S3Q4MCN.js +0 -480
  95. package/dist/chunk-AOX7CJAS.js +0 -234
  96. package/dist/chunk-FF3526PX.js +0 -279
  97. package/dist/chunk-FUSFURVP.js +0 -86
  98. package/dist/chunk-GCTCQLOF.js +0 -365
  99. package/dist/chunk-K44VNAFW.js +0 -189
  100. package/dist/chunk-O4BT6W33.js +0 -104
  101. package/dist/chunk-TKAGMA5K.js +0 -72
  102. package/dist/chunk-U374EXYQ.js +0 -106
@@ -1,207 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_4B2LXK4R_exports = {};
30
- __export(chunk_4B2LXK4R_exports, {
31
- MigrateStatus: () => MigrateStatus,
32
- init_MigrateStatus: () => init_MigrateStatus
33
- });
34
- module.exports = __toCommonJS(chunk_4B2LXK4R_exports);
35
- var import_chunk_UVNSK22K = require("./chunk-UVNSK22K.js");
36
- var import_chunk_M5YNQ2NP = require("./chunk-M5YNQ2NP.js");
37
- var import_chunk_Q7ACZDDT = require("./chunk-Q7ACZDDT.js");
38
- var import_chunk_XJQP3B4W = require("./chunk-XJQP3B4W.js");
39
- var import_chunk_6TE2RIPN = require("./chunk-6TE2RIPN.js");
40
- var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
41
- var import_debug = __toESM(require("@prisma/debug"));
42
- var import_internals = require("@prisma/internals");
43
- var debug, _MigrateStatus, MigrateStatus;
44
- var init_MigrateStatus = (0, import_chunk_WWAWV7DQ.__esm)({
45
- "src/commands/MigrateStatus.ts"() {
46
- (0, import_chunk_6TE2RIPN.init_colors)();
47
- (0, import_chunk_UVNSK22K.init_Migrate)();
48
- (0, import_chunk_XJQP3B4W.init_ensureDatabaseExists)();
49
- (0, import_chunk_M5YNQ2NP.init_getSchemaPathAndPrint)();
50
- (0, import_chunk_Q7ACZDDT.init_printDatasource)();
51
- debug = (0, import_debug.default)("prisma:migrate:status");
52
- _MigrateStatus = class _MigrateStatus2 {
53
- static new() {
54
- return new _MigrateStatus2();
55
- }
56
- async parse(argv, config) {
57
- const args = (0, import_internals.arg)(
58
- argv,
59
- {
60
- "--help": Boolean,
61
- "-h": "--help",
62
- "--schema": String,
63
- "--config": String,
64
- "--telemetry-information": String
65
- },
66
- false
67
- );
68
- if ((0, import_internals.isError)(args)) {
69
- return this.help(args.message);
70
- }
71
- await (0, import_internals.checkUnsupportedDataProxy)("migrate status", args, config.schema, true);
72
- if (args["--help"]) {
73
- return this.help();
74
- }
75
- await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
76
- const { schemaPath } = await (0, import_chunk_M5YNQ2NP.getSchemaPathAndPrint)(args["--schema"], config.schema);
77
- (0, import_chunk_Q7ACZDDT.printDatasource)({ datasourceInfo: await (0, import_chunk_XJQP3B4W.getDatasourceInfo)({ schemaPath }) });
78
- const migrate = new import_chunk_UVNSK22K.Migrate(schemaPath);
79
- await (0, import_chunk_XJQP3B4W.ensureCanConnectToDatabase)(schemaPath);
80
- let diagnoseResult;
81
- let listMigrationDirectoriesResult;
82
- try {
83
- diagnoseResult = await migrate.diagnoseMigrationHistory({
84
- optInToShadowDatabase: false
85
- });
86
- debug({ diagnoseResult: JSON.stringify(diagnoseResult, null, 2) });
87
- listMigrationDirectoriesResult = await migrate.listMigrationDirectories();
88
- debug({ listMigrationDirectoriesResult });
89
- } finally {
90
- migrate.stop();
91
- }
92
- process.stdout.write("\n");
93
- if (listMigrationDirectoriesResult.migrations.length > 0) {
94
- const migrations = listMigrationDirectoriesResult.migrations;
95
- process.stdout.write(
96
- `${migrations.length} migration${migrations.length > 1 ? "s" : ""} found in prisma/migrations
97
- `
98
- );
99
- } else {
100
- process.stdout.write(`No migration found in prisma/migrations
101
- `);
102
- }
103
- let unappliedMigrations = [];
104
- if (diagnoseResult.history?.diagnostic === "databaseIsBehind") {
105
- unappliedMigrations = diagnoseResult.history.unappliedMigrationNames;
106
- process.stdout.write(
107
- `Following migration${unappliedMigrations.length > 1 ? "s" : ""} have not yet been applied:
108
- ${unappliedMigrations.join("\n")}
109
-
110
- To apply migrations in development run ${(0, import_chunk_6TE2RIPN.bold)((0, import_chunk_6TE2RIPN.green)((0, import_internals.getCommandWithExecutor)(`prisma migrate dev`)))}.
111
- To apply migrations in production run ${(0, import_chunk_6TE2RIPN.bold)((0, import_chunk_6TE2RIPN.green)((0, import_internals.getCommandWithExecutor)(`prisma migrate deploy`)))}.
112
- `
113
- );
114
- process.exit(1);
115
- } else if (diagnoseResult.history?.diagnostic === "historiesDiverge") {
116
- console.error(`Your local migration history and the migrations table from your database are different:
117
-
118
- The last common migration is: ${diagnoseResult.history.lastCommonMigrationName}
119
-
120
- The migration${diagnoseResult.history.unappliedMigrationNames.length > 1 ? "s" : ""} have not yet been applied:
121
- ${diagnoseResult.history.unappliedMigrationNames.join("\n")}
122
-
123
- The migration${diagnoseResult.history.unpersistedMigrationNames.length > 1 ? "s" : ""} from the database are not found locally in prisma/migrations:
124
- ${diagnoseResult.history.unpersistedMigrationNames.join("\n")}`);
125
- process.exit(1);
126
- }
127
- if (!diagnoseResult.hasMigrationsTable) {
128
- if (listMigrationDirectoriesResult.migrations.length === 0) {
129
- console.error(`The current database is not managed by Prisma Migrate.
130
-
131
- Read more about how to baseline an existing production database:
132
- ${(0, import_internals.link)("https://pris.ly/d/migrate-baseline")}`);
133
- process.exit(1);
134
- } else {
135
- const migrationId = listMigrationDirectoriesResult.migrations.shift();
136
- console.error(`The current database is not managed by Prisma Migrate.
137
-
138
- If you want to keep the current database structure and data and create new migrations, baseline this database with the migration "${migrationId}":
139
- ${(0, import_chunk_6TE2RIPN.bold)((0, import_chunk_6TE2RIPN.green)((0, import_internals.getCommandWithExecutor)(`prisma migrate resolve --applied "${migrationId}"`)))}
140
-
141
- Read more about how to baseline an existing production database:
142
- https://pris.ly/d/migrate-baseline`);
143
- process.exit(1);
144
- }
145
- } else if (diagnoseResult.failedMigrationNames.length > 0) {
146
- const failedMigrations = diagnoseResult.failedMigrationNames;
147
- console.error(
148
- `Following migration${failedMigrations.length > 1 ? "s" : ""} have failed:
149
- ${failedMigrations.join("\n")}
150
-
151
- During development if the failed migration(s) have not been deployed to a production database you can then fix the migration(s) and run ${(0, import_chunk_6TE2RIPN.bold)(
152
- (0, import_chunk_6TE2RIPN.green)((0, import_internals.getCommandWithExecutor)(`prisma migrate dev`))
153
- )}.
154
- `
155
- );
156
- console.error(`The failed migration(s) can be marked as rolled back or applied:
157
-
158
- - If you rolled back the migration(s) manually:
159
- ${(0, import_chunk_6TE2RIPN.bold)((0, import_chunk_6TE2RIPN.green)((0, import_internals.getCommandWithExecutor)(`prisma migrate resolve --rolled-back "${failedMigrations[0]}"`)))}
160
-
161
- - If you fixed the database manually (hotfix):
162
- ${(0, import_chunk_6TE2RIPN.bold)((0, import_chunk_6TE2RIPN.green)((0, import_internals.getCommandWithExecutor)(`prisma migrate resolve --applied "${failedMigrations[0]}"`)))}
163
-
164
- Read more about how to resolve migration issues in a production database:
165
- ${(0, import_internals.link)("https://pris.ly/d/migrate-resolve")}`);
166
- process.exit(1);
167
- } else {
168
- process.stdout.write("\n");
169
- if (unappliedMigrations.length === 0) {
170
- return `Database schema is up to date!`;
171
- }
172
- }
173
- return "";
174
- }
175
- help(error) {
176
- if (error) {
177
- return new import_internals.HelpError(`
178
- ${(0, import_chunk_6TE2RIPN.bold)((0, import_chunk_6TE2RIPN.red)(`!`))} ${error}
179
- ${_MigrateStatus2.help}`);
180
- }
181
- return _MigrateStatus2.help;
182
- }
183
- };
184
- _MigrateStatus.help = (0, import_internals.format)(`
185
- Check the status of your database migrations
186
-
187
- ${(0, import_chunk_6TE2RIPN.bold)("Usage")}
188
-
189
- ${(0, import_chunk_6TE2RIPN.dim)("$")} prisma migrate status [options]
190
-
191
- ${(0, import_chunk_6TE2RIPN.bold)("Options")}
192
-
193
- -h, --help Display this help message
194
- --config Custom path to your Prisma config file
195
- --schema Custom path to your Prisma schema
196
-
197
- ${(0, import_chunk_6TE2RIPN.bold)("Examples")}
198
-
199
- Check the status of your database migrations
200
- ${(0, import_chunk_6TE2RIPN.dim)("$")} prisma migrate status
201
-
202
- Specify a schema
203
- ${(0, import_chunk_6TE2RIPN.dim)("$")} prisma migrate status --schema=./schema.prisma
204
- `);
205
- MigrateStatus = _MigrateStatus;
206
- }
207
- });
@@ -1,130 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var chunk_4UJBOCZJ_exports = {};
20
- __export(chunk_4UJBOCZJ_exports, {
21
- MigrateCommand: () => MigrateCommand,
22
- init_MigrateCommand: () => init_MigrateCommand
23
- });
24
- module.exports = __toCommonJS(chunk_4UJBOCZJ_exports);
25
- var import_chunk_6TE2RIPN = require("./chunk-6TE2RIPN.js");
26
- var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
27
- var import_internals = require("@prisma/internals");
28
- var _MigrateCommand, MigrateCommand;
29
- var init_MigrateCommand = (0, import_chunk_WWAWV7DQ.__esm)({
30
- "src/commands/MigrateCommand.ts"() {
31
- (0, import_chunk_6TE2RIPN.init_colors)();
32
- _MigrateCommand = class _MigrateCommand2 {
33
- constructor(cmds) {
34
- this.cmds = cmds;
35
- }
36
- static new(cmds) {
37
- return new _MigrateCommand2(cmds);
38
- }
39
- async parse(argv, config) {
40
- const args = (0, import_internals.arg)(argv, {
41
- "--help": Boolean,
42
- "-h": "--help",
43
- "--config": String,
44
- "--preview-feature": Boolean,
45
- "--telemetry-information": String
46
- });
47
- if ((0, import_internals.isError)(args)) {
48
- return this.help(args.message);
49
- }
50
- if (args._.length === 0 || args["--help"]) {
51
- return this.help();
52
- }
53
- const commandName = args._[0];
54
- const cmd = this.cmds[commandName];
55
- if (cmd) {
56
- let argsForCmd;
57
- if (commandName === "diff") {
58
- argsForCmd = args["--preview-feature"] ? [...args._.slice(1), `--preview-feature`] : args._.slice(1);
59
- } else {
60
- const filteredArgs = args._.filter((item) => item !== "--preview-feature");
61
- argsForCmd = filteredArgs.slice(1);
62
- }
63
- return cmd.parse(argsForCmd, config);
64
- }
65
- return (0, import_internals.unknownCommand)(_MigrateCommand2.help, commandName);
66
- }
67
- help(error) {
68
- if (error) {
69
- return new import_internals.HelpError(`
70
- ${(0, import_chunk_6TE2RIPN.bold)((0, import_chunk_6TE2RIPN.red)(`!`))} ${error}
71
- ${_MigrateCommand2.help}`);
72
- }
73
- return _MigrateCommand2.help;
74
- }
75
- };
76
- _MigrateCommand.help = (0, import_internals.format)(`
77
- Update the database schema with migrations
78
-
79
- ${(0, import_chunk_6TE2RIPN.bold)("Usage")}
80
-
81
- ${(0, import_chunk_6TE2RIPN.dim)("$")} prisma migrate [command] [options]
82
-
83
- ${(0, import_chunk_6TE2RIPN.bold)("Commands for development")}
84
-
85
- dev Create a migration from changes in Prisma schema, apply it to the database
86
- trigger generators (e.g. Prisma Client)
87
- reset Reset your database and apply all migrations, all data will be lost
88
-
89
- ${(0, import_chunk_6TE2RIPN.bold)("Commands for production/staging")}
90
-
91
- deploy Apply pending migrations to the database
92
- status Check the status of your database migrations
93
- resolve Resolve issues with database migrations, i.e. baseline, failed migration, hotfix
94
-
95
- ${(0, import_chunk_6TE2RIPN.bold)("Command for any stage")}
96
-
97
- diff Compare the database schema from two arbitrary sources
98
-
99
- ${(0, import_chunk_6TE2RIPN.bold)("Options")}
100
-
101
- -h, --help Display this help message
102
- --config Custom path to your Prisma config file
103
- --schema Custom path to your Prisma schema
104
-
105
- ${(0, import_chunk_6TE2RIPN.bold)("Examples")}
106
-
107
- Create a migration from changes in Prisma schema, apply it to the database, trigger generators (e.g. Prisma Client)
108
- ${(0, import_chunk_6TE2RIPN.dim)("$")} prisma migrate dev
109
-
110
- Reset your database and apply all migrations
111
- ${(0, import_chunk_6TE2RIPN.dim)("$")} prisma migrate reset
112
-
113
- Apply pending migrations to the database in production/staging
114
- ${(0, import_chunk_6TE2RIPN.dim)("$")} prisma migrate deploy
115
-
116
- Check the status of migrations in the production/staging database
117
- ${(0, import_chunk_6TE2RIPN.dim)("$")} prisma migrate status
118
-
119
- Specify a schema
120
- ${(0, import_chunk_6TE2RIPN.dim)("$")} prisma migrate status --schema=./schema.prisma
121
-
122
- Compare the database schema from two databases and render the diff as a SQL script
123
- ${(0, import_chunk_6TE2RIPN.dim)("$")} prisma migrate diff \\
124
- --from-url "$DATABASE_URL" \\
125
- --to-url "postgresql://login:password@localhost:5432/db" \\
126
- --script
127
- `);
128
- MigrateCommand = _MigrateCommand;
129
- }
130
- });
@@ -1,161 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_5HZLCY6X_exports = {};
30
- __export(chunk_5HZLCY6X_exports, {
31
- MigrateDeploy: () => MigrateDeploy,
32
- init_MigrateDeploy: () => init_MigrateDeploy
33
- });
34
- module.exports = __toCommonJS(chunk_5HZLCY6X_exports);
35
- var import_chunk_WOOPRG54 = require("./chunk-WOOPRG54.js");
36
- var import_chunk_UVNSK22K = require("./chunk-UVNSK22K.js");
37
- var import_chunk_M5YNQ2NP = require("./chunk-M5YNQ2NP.js");
38
- var import_chunk_Q7ACZDDT = require("./chunk-Q7ACZDDT.js");
39
- var import_chunk_XJQP3B4W = require("./chunk-XJQP3B4W.js");
40
- var import_chunk_6TE2RIPN = require("./chunk-6TE2RIPN.js");
41
- var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
42
- var import_debug = __toESM(require("@prisma/debug"));
43
- var import_internals = require("@prisma/internals");
44
- var debug, _MigrateDeploy, MigrateDeploy;
45
- var init_MigrateDeploy = (0, import_chunk_WWAWV7DQ.__esm)({
46
- "src/commands/MigrateDeploy.ts"() {
47
- (0, import_chunk_6TE2RIPN.init_colors)();
48
- (0, import_chunk_UVNSK22K.init_Migrate)();
49
- (0, import_chunk_XJQP3B4W.init_ensureDatabaseExists)();
50
- (0, import_chunk_M5YNQ2NP.init_getSchemaPathAndPrint)();
51
- (0, import_chunk_Q7ACZDDT.init_printDatasource)();
52
- (0, import_chunk_WOOPRG54.init_printFiles)();
53
- debug = (0, import_debug.default)("prisma:migrate:deploy");
54
- _MigrateDeploy = class _MigrateDeploy2 {
55
- static new() {
56
- return new _MigrateDeploy2();
57
- }
58
- async parse(argv, config) {
59
- const args = (0, import_internals.arg)(
60
- argv,
61
- {
62
- "--help": Boolean,
63
- "-h": "--help",
64
- "--schema": String,
65
- "--config": String,
66
- "--telemetry-information": String
67
- },
68
- false
69
- );
70
- if ((0, import_internals.isError)(args)) {
71
- return this.help(args.message);
72
- }
73
- await (0, import_internals.checkUnsupportedDataProxy)("migrate deploy", args, config.schema, true);
74
- if (args["--help"]) {
75
- return this.help();
76
- }
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);
79
- (0, import_chunk_Q7ACZDDT.printDatasource)({ datasourceInfo: await (0, import_chunk_XJQP3B4W.getDatasourceInfo)({ schemaPath }) });
80
- const migrate = new import_chunk_UVNSK22K.Migrate(schemaPath);
81
- try {
82
- const wasDbCreated = await (0, import_chunk_XJQP3B4W.ensureDatabaseExists)("apply", schemaPath);
83
- if (wasDbCreated) {
84
- process.stdout.write("\n" + wasDbCreated + "\n");
85
- }
86
- } catch (e) {
87
- process.stdout.write("\n");
88
- throw e;
89
- }
90
- const listMigrationDirectoriesResult = await migrate.listMigrationDirectories();
91
- debug({ listMigrationDirectoriesResult });
92
- process.stdout.write("\n");
93
- if (listMigrationDirectoriesResult.migrations.length > 0) {
94
- const migrations = listMigrationDirectoriesResult.migrations;
95
- process.stdout.write(
96
- `${migrations.length} migration${migrations.length > 1 ? "s" : ""} found in prisma/migrations
97
- `
98
- );
99
- } else {
100
- process.stdout.write(`No migration found in prisma/migrations
101
- `);
102
- }
103
- let migrationIds;
104
- try {
105
- process.stdout.write("\n");
106
- const { appliedMigrationNames } = await migrate.applyMigrations();
107
- migrationIds = appliedMigrationNames;
108
- } finally {
109
- migrate.stop();
110
- }
111
- process.stdout.write("\n");
112
- if (migrationIds.length === 0) {
113
- return (0, import_chunk_6TE2RIPN.green)(`No pending migrations to apply.`);
114
- } else {
115
- return `The following migration(s) have been applied:
116
-
117
- ${(0, import_chunk_WOOPRG54.printFilesFromMigrationIds)(
118
- "migrations",
119
- migrationIds,
120
- {
121
- "migration.sql": ""
122
- }
123
- )}
124
-
125
- ${(0, import_chunk_6TE2RIPN.green)("All migrations have been successfully applied.")}`;
126
- }
127
- }
128
- help(error) {
129
- if (error) {
130
- return new import_internals.HelpError(`
131
- ${(0, import_chunk_6TE2RIPN.bold)((0, import_chunk_6TE2RIPN.red)(`!`))} ${error}
132
- ${_MigrateDeploy2.help}`);
133
- }
134
- return _MigrateDeploy2.help;
135
- }
136
- };
137
- _MigrateDeploy.help = (0, import_internals.format)(`
138
- Apply pending migrations to update the database schema in production/staging
139
-
140
- ${(0, import_chunk_6TE2RIPN.bold)("Usage")}
141
-
142
- ${(0, import_chunk_6TE2RIPN.dim)("$")} prisma migrate deploy [options]
143
-
144
- ${(0, import_chunk_6TE2RIPN.bold)("Options")}
145
-
146
- -h, --help Display this help message
147
- --config Custom path to your Prisma config file
148
- --schema Custom path to your Prisma schema
149
-
150
- ${(0, import_chunk_6TE2RIPN.bold)("Examples")}
151
-
152
- Deploy your pending migrations to your production/staging database
153
- ${(0, import_chunk_6TE2RIPN.dim)("$")} prisma migrate deploy
154
-
155
- Specify a schema
156
- ${(0, import_chunk_6TE2RIPN.dim)("$")} prisma migrate deploy --schema=./schema.prisma
157
-
158
- `);
159
- MigrateDeploy = _MigrateDeploy;
160
- }
161
- });
@@ -1,80 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var chunk_6TE2RIPN_exports = {};
20
- __export(chunk_6TE2RIPN_exports, {
21
- bold: () => bold,
22
- cyan: () => cyan,
23
- dim: () => dim,
24
- green: () => green,
25
- init_colors: () => init_colors,
26
- italic: () => italic,
27
- red: () => red,
28
- underline: () => underline,
29
- yellow: () => yellow
30
- });
31
- module.exports = __toCommonJS(chunk_6TE2RIPN_exports);
32
- var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
33
- function init(x, y) {
34
- let rgx = new RegExp(`\\x1b\\[${y}m`, "g");
35
- let open = `\x1B[${x}m`, close = `\x1B[${y}m`;
36
- return function(txt) {
37
- if (!$.enabled || txt == null) return txt;
38
- return open + (!!~("" + txt).indexOf(close) ? txt.replace(rgx, close + open) : txt) + close;
39
- };
40
- }
41
- var FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM, isTTY, $, reset, bold, dim, italic, underline, inverse, hidden, strikethrough, black, red, green, yellow, blue, magenta, cyan, white, gray, grey, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite;
42
- var init_colors = (0, import_chunk_WWAWV7DQ.__esm)({
43
- "../../node_modules/.pnpm/kleur@4.1.5/node_modules/kleur/colors.mjs"() {
44
- "use strict";
45
- isTTY = true;
46
- if (typeof process !== "undefined") {
47
- ({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {});
48
- isTTY = process.stdout && process.stdout.isTTY;
49
- }
50
- $ = {
51
- enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== "dumb" && (FORCE_COLOR != null && FORCE_COLOR !== "0" || isTTY)
52
- };
53
- reset = init(0, 0);
54
- bold = init(1, 22);
55
- dim = init(2, 22);
56
- italic = init(3, 23);
57
- underline = init(4, 24);
58
- inverse = init(7, 27);
59
- hidden = init(8, 28);
60
- strikethrough = init(9, 29);
61
- black = init(30, 39);
62
- red = init(31, 39);
63
- green = init(32, 39);
64
- yellow = init(33, 39);
65
- blue = init(34, 39);
66
- magenta = init(35, 39);
67
- cyan = init(36, 39);
68
- white = init(37, 39);
69
- gray = init(90, 39);
70
- grey = init(90, 39);
71
- bgBlack = init(40, 49);
72
- bgRed = init(41, 49);
73
- bgGreen = init(42, 49);
74
- bgYellow = init(43, 49);
75
- bgBlue = init(44, 49);
76
- bgMagenta = init(45, 49);
77
- bgCyan = init(46, 49);
78
- bgWhite = init(47, 49);
79
- }
80
- });