Skip to content

Commit

Permalink
Merge pull request #48 from badsyntax/show-migration-file
Browse files Browse the repository at this point in the history
Show migration file after creating migration
  • Loading branch information
badsyntax authored Jan 13, 2023
2 parents edf3826 + 2163c89 commit fad4e3d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ src/**
.github/**
images/**
sample_dotnet/**
**/wdio.conf.ts
.wdio-vscode-service/**
**/.ncurc.json
**/.nvmrc

webview-ui/src/**
webview-ui/build/index.html
Expand Down
19 changes: 15 additions & 4 deletions src/actions/AddMigrationAction.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import * as vscode from 'vscode';
import { EFOutputParser } from '../cli/EFOutputParser';
import { CommandProvider } from '../commands/CommandProvider';
import { OpenMigrationFileCommand } from '../commands/OpenMigrationFileCommand';
import { RefreshTreeCommand } from '../commands/RefreshTreeCommand';
import { getCommandsConfig } from '../config/config';
import { TREE_VIEW_ID } from '../constants/constants';
Expand Down Expand Up @@ -52,10 +54,13 @@ export class AddMigrationAction extends TerminalAction {
this.cancel();
});

await this.start({
...this.params,
migrationName,
});
await this.start(
{
...this.params,
migrationName,
},
{ asJson: true, removeDataFromOutput: true },
);

const output = await this.getOutput();
const cacheId = DbContextTreeItem.getCacheId(
Expand All @@ -64,6 +69,12 @@ export class AddMigrationAction extends TerminalAction {
this.dbContext,
);
dbContextsCache.clear(cacheId);
const { data } = EFOutputParser.parse(output);
const parsedData = JSON.parse(data);
await vscode.commands.executeCommand(
'vscode.open',
vscode.Uri.file(parsedData.migrationFile),
);
await vscode.commands.executeCommand(
CommandProvider.getCommandName(RefreshTreeCommand.commandName),
false,
Expand Down

0 comments on commit fad4e3d

Please sign in to comment.