Skip to content

Commit

Permalink
fix: Fix CLI query command TypeError (typeorm#7043)
Browse files Browse the repository at this point in the history
Switch to using named args property now that it is explicitly defined in the command.
  • Loading branch information
peterjroberts authored and edcolvin committed Nov 12, 2020
1 parent 1a9ba32 commit c5776e7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/commands/QueryCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ export class QueryCommand implements yargs.CommandModule {

// create a query runner and execute query using it
queryRunner = connection.createQueryRunner();
console.log(chalk.green("Running query: ") + PlatformTools.highlightSql(args._[1]));
const queryResult = await queryRunner.query(args._[1]);
const query = args.query as string;
console.log(chalk.green("Running query: ") + PlatformTools.highlightSql(query));
const queryResult = await queryRunner.query(query);

if (typeof queryResult === "undefined") {
console.log(chalk.green("Query has been executed. No result was returned."));
Expand Down

0 comments on commit c5776e7

Please sign in to comment.