Skip to content

Commit c07b694

Browse files
committed
Show migration file after creating migration. Fixes #45
1 parent f698ad1 commit c07b694

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/actions/AddMigrationAction.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import * as vscode from 'vscode';
2+
import { EFOutputParser } from '../cli/EFOutputParser';
23
import { CommandProvider } from '../commands/CommandProvider';
4+
import { OpenMigrationFileCommand } from '../commands/OpenMigrationFileCommand';
35
import { RefreshTreeCommand } from '../commands/RefreshTreeCommand';
46
import { getCommandsConfig } from '../config/config';
57
import { TREE_VIEW_ID } from '../constants/constants';
@@ -52,10 +54,13 @@ export class AddMigrationAction extends TerminalAction {
5254
this.cancel();
5355
});
5456

55-
await this.start({
56-
...this.params,
57-
migrationName,
58-
});
57+
await this.start(
58+
{
59+
...this.params,
60+
migrationName,
61+
},
62+
{ asJson: true, removeDataFromOutput: true },
63+
);
5964

6065
const output = await this.getOutput();
6166
const cacheId = DbContextTreeItem.getCacheId(
@@ -64,6 +69,12 @@ export class AddMigrationAction extends TerminalAction {
6469
this.dbContext,
6570
);
6671
dbContextsCache.clear(cacheId);
72+
const { data } = EFOutputParser.parse(output);
73+
const parsedData = JSON.parse(data);
74+
await vscode.commands.executeCommand(
75+
'vscode.open',
76+
vscode.Uri.file(parsedData.migrationFile),
77+
);
6778
await vscode.commands.executeCommand(
6879
CommandProvider.getCommandName(RefreshTreeCommand.commandName),
6980
false,

0 commit comments

Comments
 (0)