@mikro-orm/cli 7.1.0-dev.1 → 7.1.0-dev.11
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/CLIConfigurator.js
CHANGED
|
@@ -73,5 +73,6 @@ export async function configure() {
|
|
|
73
73
|
.command(MigrationCommandFactory.create('fresh'))
|
|
74
74
|
.command(MigrationCommandFactory.create('log'))
|
|
75
75
|
.command(MigrationCommandFactory.create('unlog'))
|
|
76
|
+
.command(MigrationCommandFactory.create('rollup'))
|
|
76
77
|
.command(new DebugCommand());
|
|
77
78
|
}
|
|
@@ -11,6 +11,7 @@ export declare class MigrationCommandFactory {
|
|
|
11
11
|
fresh: string;
|
|
12
12
|
log: string;
|
|
13
13
|
unlog: string;
|
|
14
|
+
rollup: string;
|
|
14
15
|
};
|
|
15
16
|
static create<const T extends MigratorMethod>(command: T): {
|
|
16
17
|
command: string;
|
|
@@ -24,6 +25,7 @@ export declare class MigrationCommandFactory {
|
|
|
24
25
|
fresh: string;
|
|
25
26
|
log: string;
|
|
26
27
|
unlog: string;
|
|
28
|
+
rollup: string;
|
|
27
29
|
}[T];
|
|
28
30
|
builder: (args: Argv<BaseArgs>) => Argv<MigrationOptionsMap[T]>;
|
|
29
31
|
handler: (args: ArgumentsCamelCase<MigrationOptionsMap[T]>) => Promise<void>;
|
|
@@ -41,6 +43,7 @@ export declare class MigrationCommandFactory {
|
|
|
41
43
|
private static handleCheckCommand;
|
|
42
44
|
private static handleFreshCommand;
|
|
43
45
|
private static handleLogUnlogCommand;
|
|
46
|
+
private static handleRollupCommand;
|
|
44
47
|
private static getUpDownOptions;
|
|
45
48
|
private static getUpDownSuccessMessage;
|
|
46
49
|
}
|
|
@@ -73,6 +76,7 @@ type MigrationOptionsMap = {
|
|
|
73
76
|
fresh: MigratorFreshOptions;
|
|
74
77
|
log: MigratorLogUnlogOptions;
|
|
75
78
|
unlog: MigratorLogUnlogOptions;
|
|
79
|
+
rollup: BaseArgs;
|
|
76
80
|
};
|
|
77
81
|
type MigratorMethod = keyof MigrationOptionsMap;
|
|
78
82
|
type Opts = BaseArgs & MigratorCreateOptions & CliUpDownOptions & MigratorFreshOptions & MigratorLogUnlogOptions;
|
|
@@ -11,6 +11,7 @@ export class MigrationCommandFactory {
|
|
|
11
11
|
fresh: 'Clear the database and rerun all migrations',
|
|
12
12
|
log: 'Mark a migration as executed without running it',
|
|
13
13
|
unlog: 'Remove a migration from the executed list without reverting it',
|
|
14
|
+
rollup: 'Combine multiple migrations into a single migration',
|
|
14
15
|
};
|
|
15
16
|
static create(command) {
|
|
16
17
|
// oxfmt-ignore
|
|
@@ -119,6 +120,9 @@ export class MigrationCommandFactory {
|
|
|
119
120
|
case 'unlog':
|
|
120
121
|
await this.handleLogUnlogCommand(args, orm.migrator, method);
|
|
121
122
|
break;
|
|
123
|
+
case 'rollup':
|
|
124
|
+
await this.handleRollupCommand(orm.migrator);
|
|
125
|
+
break;
|
|
122
126
|
}
|
|
123
127
|
await orm.close(true);
|
|
124
128
|
}
|
|
@@ -206,6 +210,10 @@ export class MigrationCommandFactory {
|
|
|
206
210
|
const action = method === 'log' ? 'logged' : 'unlogged';
|
|
207
211
|
CLIHelper.dump(colors.green(`Successfully ${action} migration '${args.name}'`));
|
|
208
212
|
}
|
|
213
|
+
static async handleRollupCommand(migrator) {
|
|
214
|
+
const ret = await migrator.rollup();
|
|
215
|
+
CLIHelper.dump(colors.green(`${ret.fileName} successfully created (rollup)`));
|
|
216
|
+
}
|
|
209
217
|
static getUpDownOptions(flags) {
|
|
210
218
|
if (!flags.to && !flags.from && flags.only) {
|
|
211
219
|
return { migrations: flags.only.split(/[, ]+/) };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/cli",
|
|
3
|
-
"version": "7.1.0-dev.
|
|
3
|
+
"version": "7.1.0-dev.11",
|
|
4
4
|
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data-mapper",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"copy": "node ../../scripts/copy.mjs"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@mikro-orm/core": "7.1.0-dev.
|
|
54
|
-
"mikro-orm": "7.1.0-dev.
|
|
53
|
+
"@mikro-orm/core": "7.1.0-dev.11",
|
|
54
|
+
"mikro-orm": "7.1.0-dev.11",
|
|
55
55
|
"yargs": "17.7.2"
|
|
56
56
|
},
|
|
57
57
|
"engines": {
|