mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 08:58:26 +00:00
fix : Delete column query throws error if the column name starts with uppercase in ToolJet database (#9877)
* fix : while deleting a column if the column name starts with uppercase, it throws error * Added the query as parameterized query * fix : using query runner with creation in parameterized queries
This commit is contained in:
parent
1aa5ef66e2
commit
1234979f56
1 changed files with 6 additions and 2 deletions
|
|
@ -610,13 +610,17 @@ export class TooljetDbService {
|
|||
|
||||
if (!internalTable) throw new NotFoundException('Internal table not found: ' + tableName);
|
||||
|
||||
const query = `ALTER TABLE "${internalTable.id}" DROP COLUMN ${column['column_name']}`;
|
||||
// const query = `ALTER TABLE "${internalTable.id}" DROP COLUMN "${column['column_name']}"`;
|
||||
const tjdbQueryRunnner = this.tooljetDbManager.connection.createQueryRunner();
|
||||
await tjdbQueryRunnner.connect();
|
||||
try {
|
||||
const result = await this.tooljetDbManager.query(query);
|
||||
const result = await tjdbQueryRunnner.dropColumn(internalTable.id, column['column_name']);
|
||||
await this.tooljetDbManager.query("NOTIFY pgrst, 'reload schema'");
|
||||
return result;
|
||||
} catch (error) {
|
||||
throw new TooljetDatabaseError(error.message, { origin: 'drop_column', internalTables: [internalTable] }, error);
|
||||
} finally {
|
||||
await tjdbQueryRunnner.release();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue