@mikro-orm/cli 7.0.4 → 7.0.5-dev.1
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.d.ts +6 -7
- package/CLIConfigurator.js +51 -51
- package/CLIHelper.d.ts +45 -58
- package/CLIHelper.js +314 -325
- package/README.md +1 -1
- package/cli.js +1 -1
- package/commands/ClearCacheCommand.d.ts +6 -6
- package/commands/ClearCacheCommand.js +14 -16
- package/commands/CompileCommand.d.ts +13 -16
- package/commands/CompileCommand.js +83 -88
- package/commands/CreateDatabaseCommand.d.ts +6 -6
- package/commands/CreateDatabaseCommand.js +10 -10
- package/commands/CreateSeederCommand.d.ts +12 -12
- package/commands/CreateSeederCommand.js +27 -28
- package/commands/DatabaseSeedCommand.d.ts +8 -8
- package/commands/DatabaseSeedCommand.js +20 -20
- package/commands/DebugCommand.d.ts +7 -7
- package/commands/DebugCommand.js +71 -74
- package/commands/GenerateCacheCommand.d.ts +9 -9
- package/commands/GenerateCacheCommand.js +29 -33
- package/commands/GenerateEntitiesCommand.d.ts +14 -14
- package/commands/GenerateEntitiesCommand.js +43 -43
- package/commands/ImportCommand.d.ts +7 -7
- package/commands/ImportCommand.js +12 -12
- package/commands/MigrationCommandFactory.d.ts +53 -58
- package/commands/MigrationCommandFactory.js +191 -192
- package/commands/SchemaCommandFactory.d.ts +32 -42
- package/commands/SchemaCommandFactory.js +100 -97
- package/package.json +3 -3
package/commands/DebugCommand.js
CHANGED
|
@@ -2,82 +2,79 @@ import { colors } from '@mikro-orm/core';
|
|
|
2
2
|
import { fs } from '@mikro-orm/core/fs-utils';
|
|
3
3
|
import { CLIHelper } from '../CLIHelper.js';
|
|
4
4
|
export class DebugCommand {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
5
|
+
command = 'debug';
|
|
6
|
+
describe = 'Debug CLI configuration';
|
|
7
|
+
/**
|
|
8
|
+
* @inheritDoc
|
|
9
|
+
*/
|
|
10
|
+
async handler(args) {
|
|
11
|
+
CLIHelper.dump(`Current ${colors.cyan('MikroORM')} CLI configuration`);
|
|
12
|
+
CLIHelper.dumpDependencies();
|
|
13
|
+
const settings = CLIHelper.getSettings();
|
|
14
|
+
if (!process.versions.bun && settings.preferTs !== false) {
|
|
15
|
+
const loader = process.env.MIKRO_ORM_CLI_TS_LOADER ?? 'auto';
|
|
16
|
+
CLIHelper.dump(' - TypeScript support ' + colors.green(`enabled (${loader})`));
|
|
17
|
+
}
|
|
18
|
+
const configPaths = args.config ?? (await CLIHelper.getConfigPaths());
|
|
19
|
+
CLIHelper.dump(' - searched config paths:');
|
|
20
|
+
await DebugCommand.checkPaths(configPaths, 'yellow');
|
|
21
|
+
CLIHelper.dump(` - searched for config name: ${colors.green(args.contextName)}`);
|
|
22
|
+
try {
|
|
23
|
+
const config = await CLIHelper.getConfiguration(args.contextName, configPaths);
|
|
24
|
+
CLIHelper.dump(` - configuration ${colors.green('found')}`);
|
|
25
|
+
const drivers = CLIHelper.getDriverDependencies(config);
|
|
26
|
+
CLIHelper.dump(' - driver dependencies:');
|
|
27
|
+
for (const driver of drivers) {
|
|
28
|
+
CLIHelper.dump(` - ${driver} ${CLIHelper.getModuleVersion(driver)}`);
|
|
29
|
+
}
|
|
30
|
+
const isConnected = await CLIHelper.isDBConnected(config, true);
|
|
31
|
+
if (isConnected === true) {
|
|
32
|
+
CLIHelper.dump(` - ${colors.green('database connection successful')}`);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
CLIHelper.dump(` - ${colors.yellow(`database connection failed (${isConnected})`)}`);
|
|
36
|
+
}
|
|
37
|
+
const preferTs = config.get('preferTs');
|
|
38
|
+
if ([true, false].includes(preferTs)) {
|
|
39
|
+
const warning = preferTs ? ' (this value should be set to `false` when running compiled code!)' : '';
|
|
40
|
+
CLIHelper.dump(` - \`preferTs\` flag explicitly set to ${preferTs}, will use \`entities${preferTs ? 'Ts' : ''}\` array${warning}`);
|
|
41
|
+
}
|
|
42
|
+
const entities = config.get('entities', []);
|
|
43
|
+
if (entities.length > 0) {
|
|
44
|
+
const refs = entities.filter(p => typeof p !== 'string');
|
|
45
|
+
const paths = entities.filter(p => typeof p === 'string');
|
|
46
|
+
const will = !config.get('preferTs') ? 'will' : 'could';
|
|
47
|
+
CLIHelper.dump(` - ${will} use \`entities\` array (contains ${refs.length} references and ${paths.length} paths)`);
|
|
48
|
+
if (paths.length > 0) {
|
|
49
|
+
await DebugCommand.checkPaths(paths, 'red', config.get('baseDir'));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const entitiesTs = config.get('entitiesTs', []);
|
|
53
|
+
if (entitiesTs.length > 0) {
|
|
54
|
+
const refs = entitiesTs.filter(p => typeof p !== 'string');
|
|
55
|
+
const paths = entitiesTs.filter(p => typeof p === 'string');
|
|
56
|
+
/* v8 ignore next */
|
|
57
|
+
const will = config.get('preferTs') ? 'will' : 'could';
|
|
58
|
+
CLIHelper.dump(` - ${will} use \`entitiesTs\` array (contains ${refs.length} references and ${paths.length} paths)`);
|
|
59
|
+
if (paths.length > 0) {
|
|
60
|
+
await DebugCommand.checkPaths(paths, 'red', config.get('baseDir'));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
53
63
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
if (entitiesTs.length > 0) {
|
|
57
|
-
const refs = entitiesTs.filter(p => typeof p !== 'string');
|
|
58
|
-
const paths = entitiesTs.filter(p => typeof p === 'string');
|
|
59
|
-
/* v8 ignore next */
|
|
60
|
-
const will = config.get('preferTs') ? 'will' : 'could';
|
|
61
|
-
CLIHelper.dump(
|
|
62
|
-
` - ${will} use \`entitiesTs\` array (contains ${refs.length} references and ${paths.length} paths)`,
|
|
63
|
-
);
|
|
64
|
-
if (paths.length > 0) {
|
|
65
|
-
await DebugCommand.checkPaths(paths, 'red', config.get('baseDir'));
|
|
64
|
+
catch (e) {
|
|
65
|
+
CLIHelper.dump(`- configuration ${colors.red('not found')} ${colors.red(`(${e.message})`)}`);
|
|
66
66
|
}
|
|
67
|
-
}
|
|
68
|
-
} catch (e) {
|
|
69
|
-
CLIHelper.dump(`- configuration ${colors.red('not found')} ${colors.red(`(${e.message})`)}`);
|
|
70
67
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
68
|
+
static async checkPaths(paths, failedColor, baseDir) {
|
|
69
|
+
for (let path of paths) {
|
|
70
|
+
path = fs.absolutePath(path, baseDir);
|
|
71
|
+
path = fs.normalizePath(path);
|
|
72
|
+
if (fs.pathExists(path)) {
|
|
73
|
+
CLIHelper.dump(` - ${path} (${colors.green('found')})`);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
CLIHelper.dump(` - ${path} (${colors[failedColor]('not found')})`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
81
79
|
}
|
|
82
|
-
}
|
|
83
80
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { ArgumentsCamelCase, Argv } from 'yargs';
|
|
2
2
|
import type { BaseArgs, BaseCommand } from '../CLIConfigurator.js';
|
|
3
3
|
type CacheArgs = BaseArgs & {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
ts?: boolean;
|
|
5
|
+
combined?: string;
|
|
6
6
|
};
|
|
7
7
|
export declare class GenerateCacheCommand implements BaseCommand<CacheArgs> {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
command: string;
|
|
9
|
+
describe: string;
|
|
10
|
+
builder: (args: Argv<BaseArgs>) => Argv<CacheArgs>;
|
|
11
|
+
/**
|
|
12
|
+
* @inheritDoc
|
|
13
|
+
*/
|
|
14
|
+
handler(args: ArgumentsCamelCase<CacheArgs>): Promise<void>;
|
|
15
15
|
}
|
|
16
16
|
export {};
|
|
@@ -2,37 +2,33 @@ import { MetadataDiscovery, MetadataStorage, colors } from '@mikro-orm/core';
|
|
|
2
2
|
import { FileCacheAdapter } from '@mikro-orm/core/fs-utils';
|
|
3
3
|
import { CLIHelper } from '../CLIHelper.js';
|
|
4
4
|
export class GenerateCacheCommand {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
`${combined ? 'Combined ' : ''}${args.ts ? 'TS' : 'JS'} metadata cache was successfully generated${combined ? ' to ' + combined : ''}`,
|
|
35
|
-
),
|
|
36
|
-
);
|
|
37
|
-
}
|
|
5
|
+
command = 'cache:generate';
|
|
6
|
+
describe = 'Generate metadata cache';
|
|
7
|
+
builder = (args) => {
|
|
8
|
+
args.option('ts', {
|
|
9
|
+
type: 'boolean',
|
|
10
|
+
desc: `Generate development cache for '.ts' files`,
|
|
11
|
+
});
|
|
12
|
+
args.option('combined', {
|
|
13
|
+
alias: 'c',
|
|
14
|
+
desc: `Generate production cache into a single JSON file that can be used with the GeneratedCacheAdapter.`,
|
|
15
|
+
});
|
|
16
|
+
return args;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* @inheritDoc
|
|
20
|
+
*/
|
|
21
|
+
async handler(args) {
|
|
22
|
+
const options = args.combined ? { combined: './metadata.json' } : {};
|
|
23
|
+
const config = await CLIHelper.getConfiguration(args.contextName, args.config, {
|
|
24
|
+
metadataCache: { enabled: true, adapter: FileCacheAdapter, options },
|
|
25
|
+
});
|
|
26
|
+
await config.getMetadataCacheAdapter().clear();
|
|
27
|
+
config.set('logger', CLIHelper.dump.bind(null));
|
|
28
|
+
config.set('debug', true);
|
|
29
|
+
const discovery = new MetadataDiscovery(new MetadataStorage(), config.getDriver().getPlatform(), config);
|
|
30
|
+
await discovery.discover(args.ts ?? false);
|
|
31
|
+
const combined = args.combined && config.get('metadataCache').combined;
|
|
32
|
+
CLIHelper.dump(colors.green(`${combined ? 'Combined ' : ''}${args.ts ? 'TS' : 'JS'} metadata cache was successfully generated${combined ? ' to ' + combined : ''}`));
|
|
33
|
+
}
|
|
38
34
|
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import type { ArgumentsCamelCase, Argv } from 'yargs';
|
|
2
2
|
import type { BaseArgs, BaseCommand } from '../CLIConfigurator.js';
|
|
3
3
|
export type GenerateEntitiesArgs = BaseArgs & {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
dump?: boolean;
|
|
5
|
+
save?: boolean;
|
|
6
|
+
path?: string;
|
|
7
|
+
schema?: string;
|
|
8
8
|
};
|
|
9
9
|
export declare class GenerateEntitiesCommand implements BaseCommand<GenerateEntitiesArgs> {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
command: string;
|
|
11
|
+
describe: string;
|
|
12
|
+
/**
|
|
13
|
+
* @inheritDoc
|
|
14
|
+
*/
|
|
15
|
+
builder(args: Argv): Argv<GenerateEntitiesArgs>;
|
|
16
|
+
/**
|
|
17
|
+
* @inheritDoc
|
|
18
|
+
*/
|
|
19
|
+
handler(args: ArgumentsCamelCase<GenerateEntitiesArgs>): Promise<void>;
|
|
20
20
|
}
|
|
@@ -1,48 +1,48 @@
|
|
|
1
1
|
import { CLIHelper } from '../CLIHelper.js';
|
|
2
2
|
export class GenerateEntitiesCommand {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* @inheritDoc
|
|
32
|
-
*/
|
|
33
|
-
async handler(args) {
|
|
34
|
-
if (!args.save && !args.dump) {
|
|
35
|
-
return CLIHelper.showHelp();
|
|
3
|
+
command = 'generate-entities';
|
|
4
|
+
describe = 'Generate entities based on current database schema';
|
|
5
|
+
/**
|
|
6
|
+
* @inheritDoc
|
|
7
|
+
*/
|
|
8
|
+
builder(args) {
|
|
9
|
+
args.option('s', {
|
|
10
|
+
alias: 'save',
|
|
11
|
+
type: 'boolean',
|
|
12
|
+
desc: 'Saves entities to directory defined by --path',
|
|
13
|
+
});
|
|
14
|
+
args.option('d', {
|
|
15
|
+
alias: 'dump',
|
|
16
|
+
type: 'boolean',
|
|
17
|
+
desc: 'Dumps all entities to console',
|
|
18
|
+
});
|
|
19
|
+
args.option('p', {
|
|
20
|
+
alias: 'path',
|
|
21
|
+
type: 'string',
|
|
22
|
+
desc: 'Sets path to directory where to save entities',
|
|
23
|
+
});
|
|
24
|
+
args.option('schema', {
|
|
25
|
+
type: 'string',
|
|
26
|
+
desc: 'Generates entities only for given schema',
|
|
27
|
+
});
|
|
28
|
+
return args;
|
|
36
29
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
30
|
+
/**
|
|
31
|
+
* @inheritDoc
|
|
32
|
+
*/
|
|
33
|
+
async handler(args) {
|
|
34
|
+
if (!args.save && !args.dump) {
|
|
35
|
+
return CLIHelper.showHelp();
|
|
36
|
+
}
|
|
37
|
+
const orm = await CLIHelper.getORM(args.contextName, args.config, { discovery: { warnWhenNoEntities: false } });
|
|
38
|
+
const dump = await orm.entityGenerator.generate({
|
|
39
|
+
save: args.save,
|
|
40
|
+
path: args.path,
|
|
41
|
+
schema: args.schema,
|
|
42
|
+
});
|
|
43
|
+
if (args.dump) {
|
|
44
|
+
CLIHelper.dump(dump.join('\n\n'));
|
|
45
|
+
}
|
|
46
|
+
await orm.close(true);
|
|
45
47
|
}
|
|
46
|
-
await orm.close(true);
|
|
47
|
-
}
|
|
48
48
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { ArgumentsCamelCase } from 'yargs';
|
|
2
2
|
import type { BaseArgs, BaseCommand } from '../CLIConfigurator.js';
|
|
3
3
|
type ImportArgs = BaseArgs & {
|
|
4
|
-
|
|
4
|
+
file: string;
|
|
5
5
|
};
|
|
6
6
|
export declare class ImportCommand implements BaseCommand<ImportArgs> {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
command: string;
|
|
8
|
+
describe: string;
|
|
9
|
+
/**
|
|
10
|
+
* @inheritDoc
|
|
11
|
+
*/
|
|
12
|
+
handler(args: ArgumentsCamelCase<ImportArgs>): Promise<void>;
|
|
13
13
|
}
|
|
14
14
|
export {};
|
|
@@ -2,16 +2,16 @@ import { readFile } from 'node:fs/promises';
|
|
|
2
2
|
import { colors } from '@mikro-orm/core';
|
|
3
3
|
import { CLIHelper } from '../CLIHelper.js';
|
|
4
4
|
export class ImportCommand {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
command = 'database:import <file>';
|
|
6
|
+
describe = 'Imports the SQL file to the database';
|
|
7
|
+
/**
|
|
8
|
+
* @inheritDoc
|
|
9
|
+
*/
|
|
10
|
+
async handler(args) {
|
|
11
|
+
const orm = await CLIHelper.getORM(args.contextName, args.config, { multipleStatements: true });
|
|
12
|
+
const buf = await readFile(args.file);
|
|
13
|
+
await orm.em.getConnection().executeDump(buf.toString());
|
|
14
|
+
CLIHelper.dump(colors.green(`File ${args.file} successfully imported`));
|
|
15
|
+
await orm.close(true);
|
|
16
|
+
}
|
|
17
17
|
}
|
|
@@ -1,72 +1,67 @@
|
|
|
1
1
|
import type { ArgumentsCamelCase, Argv } from 'yargs';
|
|
2
2
|
import type { BaseArgs } from '../CLIConfigurator.js';
|
|
3
3
|
export declare class MigrationCommandFactory {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
args:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
private static handleCreateCommand;
|
|
41
|
-
private static handleCheckCommand;
|
|
42
|
-
private static handleFreshCommand;
|
|
43
|
-
private static getUpDownOptions;
|
|
44
|
-
private static getUpDownSuccessMessage;
|
|
4
|
+
static readonly DESCRIPTIONS: {
|
|
5
|
+
create: string;
|
|
6
|
+
up: string;
|
|
7
|
+
down: string;
|
|
8
|
+
list: string;
|
|
9
|
+
check: string;
|
|
10
|
+
pending: string;
|
|
11
|
+
fresh: string;
|
|
12
|
+
};
|
|
13
|
+
static create<const T extends MigratorMethod>(command: T): {
|
|
14
|
+
command: string;
|
|
15
|
+
describe: {
|
|
16
|
+
create: string;
|
|
17
|
+
up: string;
|
|
18
|
+
down: string;
|
|
19
|
+
list: string;
|
|
20
|
+
check: string;
|
|
21
|
+
pending: string;
|
|
22
|
+
fresh: string;
|
|
23
|
+
}[T];
|
|
24
|
+
builder: (args: Argv<BaseArgs>) => Argv<MigrationOptionsMap[T]>;
|
|
25
|
+
handler: (args: ArgumentsCamelCase<MigrationOptionsMap[T]>) => Promise<void>;
|
|
26
|
+
};
|
|
27
|
+
static configureMigrationCommand<const T extends MigratorMethod>(args: Argv<BaseArgs>, method: T): Argv<MigrationOptionsMap[T]>;
|
|
28
|
+
private static configureUpDownCommand;
|
|
29
|
+
private static configureCreateCommand;
|
|
30
|
+
static handleMigrationCommand(args: ArgumentsCamelCase<Opts>, method: MigratorMethod): Promise<void>;
|
|
31
|
+
private static configureFreshCommand;
|
|
32
|
+
private static handleUpDownCommand;
|
|
33
|
+
private static handlePendingCommand;
|
|
34
|
+
private static handleListCommand;
|
|
35
|
+
private static handleCreateCommand;
|
|
36
|
+
private static handleCheckCommand;
|
|
37
|
+
private static handleFreshCommand;
|
|
38
|
+
private static getUpDownOptions;
|
|
39
|
+
private static getUpDownSuccessMessage;
|
|
45
40
|
}
|
|
46
41
|
type CliUpDownOptions = BaseArgs & {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
to?: string | number;
|
|
43
|
+
from?: string | number;
|
|
44
|
+
only?: string;
|
|
50
45
|
};
|
|
51
46
|
type MigratorFreshOptions = BaseArgs & {
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
dropDb?: boolean;
|
|
48
|
+
seed?: string;
|
|
54
49
|
};
|
|
55
50
|
type MigratorCreateOptions = BaseArgs & {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
51
|
+
blank?: boolean;
|
|
52
|
+
initial?: boolean;
|
|
53
|
+
path?: string;
|
|
54
|
+
dump?: boolean;
|
|
55
|
+
name?: string;
|
|
61
56
|
};
|
|
62
57
|
type MigrationOptionsMap = {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
58
|
+
create: MigratorCreateOptions;
|
|
59
|
+
check: BaseArgs;
|
|
60
|
+
up: CliUpDownOptions;
|
|
61
|
+
down: CliUpDownOptions;
|
|
62
|
+
list: BaseArgs;
|
|
63
|
+
pending: BaseArgs;
|
|
64
|
+
fresh: MigratorFreshOptions;
|
|
70
65
|
};
|
|
71
66
|
type MigratorMethod = keyof MigrationOptionsMap;
|
|
72
67
|
type Opts = BaseArgs & MigratorCreateOptions & CliUpDownOptions & MigratorFreshOptions;
|