Browse Source

fix(knex): pg check for empty query before running

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/4280/head
mertmit 2 years ago
parent
commit
8b3cd4cecd
  1. 6
      packages/nocodb/src/lib/db/sql-client/lib/pg/PgClient.ts

6
packages/nocodb/src/lib/db/sql-client/lib/pg/PgClient.ts

@ -2102,7 +2102,7 @@ class PGClient extends KnexClient {
this.genQuery(`DROP FUNCTION IF EXISTS ??()`, [triggerFnName]); this.genQuery(`DROP FUNCTION IF EXISTS ??()`, [triggerFnName]);
} }
} }
await this.sqlClient.raw(upQuery); if (upQuery != '') await this.sqlClient.raw(upQuery);
result.upStatement[0] = { sql: upQuery }; result.upStatement[0] = { sql: upQuery };
result.downStatement[0] = { sql: downQuery }; result.downStatement[0] = { sql: downQuery };
@ -2153,7 +2153,7 @@ class PGClient extends KnexClient {
this.genQuery(`DROP FUNCTION IF EXISTS ??()`, [triggerFnName]); this.genQuery(`DROP FUNCTION IF EXISTS ??()`, [triggerFnName]);
} }
} }
await this.sqlClient.raw(upQuery); if (upQuery != '') await this.sqlClient.raw(upQuery);
result.upStatement[0] = { sql: upQuery }; result.upStatement[0] = { sql: upQuery };
result.downStatement[0] = { sql: downQuery }; result.downStatement[0] = { sql: downQuery };
@ -2273,7 +2273,7 @@ class PGClient extends KnexClient {
//downQuery = `ALTER TABLE "${args.columns[0].tn}" ${downQuery};`; //downQuery = `ALTER TABLE "${args.columns[0].tn}" ${downQuery};`;
} }
await this.sqlClient.raw(upQuery); if (upQuery != '') await this.sqlClient.raw(upQuery);
// console.log(upQuery); // console.log(upQuery);

Loading…
Cancel
Save