From d78e59dd0910d3ea6ec5183a8748420b2db57050 Mon Sep 17 00:00:00 2001 From: mirrorb <630773165@qq.com> Date: Mon, 30 Sep 2024 10:57:19 +0800 Subject: [PATCH 1/2] fix(PostgreSQL): unable to change table comment to empty --- src/main/libs/clients/PostgreSQLClient.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/libs/clients/PostgreSQLClient.ts b/src/main/libs/clients/PostgreSQLClient.ts index 6fac21d9..5e0606b2 100644 --- a/src/main/libs/clients/PostgreSQLClient.ts +++ b/src/main/libs/clients/PostgreSQLClient.ts @@ -921,7 +921,7 @@ export class PostgreSQLClient extends BaseClient { sql = `${sql} (${[...newColumns, ...newIndexes, ...newForeigns].join(', ')}); `; if (manageIndexes.length) sql = `${sql} ${manageIndexes.join(';')}; `; // TABLE COMMENT - if (options.comment) sql = `${sql} COMMENT ON TABLE "${schema}"."${options.name}" IS '${options.comment}'; `; + if (options.comment != null) sql = `${sql} COMMENT ON TABLE "${schema}"."${options.name}" IS '${options.comment}'; `; // FIELDS COMMENT if (modifyComment.length) sql = `${sql} ${modifyComment.join(';')}; `; @@ -1066,7 +1066,7 @@ export class PostgreSQLClient extends BaseClient { if (createSequences.length) sql = `${createSequences.join(';')}; ${sql}`; if (manageIndexes.length) sql = `${manageIndexes.join(';')}; ${sql}`; // TABLE COMMENT - if (options.comment) sql = `${sql} COMMENT ON TABLE ${schema}.${table} IS '${options.comment}'; `; + if (options.comment != null) sql = `${sql} COMMENT ON TABLE ${schema}.${table} IS '${options.comment}'; `; // FIELDS COMMENT if (modifyComment.length) sql = `${sql} ${modifyComment.join(';')}; `; if (options.name) sql += `ALTER TABLE "${schema}"."${table}" RENAME TO "${options.name}"; `; From eb749f0f66bf6547053e30b1503c8b2990ae5950 Mon Sep 17 00:00:00 2001 From: mirrorb <630773165@qq.com> Date: Mon, 30 Sep 2024 11:02:26 +0800 Subject: [PATCH 2/2] fix(PostgreSQL): error changing the comment for a specific table name --- src/main/libs/clients/PostgreSQLClient.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/libs/clients/PostgreSQLClient.ts b/src/main/libs/clients/PostgreSQLClient.ts index 5e0606b2..60a9e567 100644 --- a/src/main/libs/clients/PostgreSQLClient.ts +++ b/src/main/libs/clients/PostgreSQLClient.ts @@ -1066,7 +1066,7 @@ export class PostgreSQLClient extends BaseClient { if (createSequences.length) sql = `${createSequences.join(';')}; ${sql}`; if (manageIndexes.length) sql = `${manageIndexes.join(';')}; ${sql}`; // TABLE COMMENT - if (options.comment != null) sql = `${sql} COMMENT ON TABLE ${schema}.${table} IS '${options.comment}'; `; + if (options.comment != null) sql = `${sql} COMMENT ON TABLE "${schema}"."${table}" IS '${options.comment}'; `; // FIELDS COMMENT if (modifyComment.length) sql = `${sql} ${modifyComment.join(';')}; `; if (options.name) sql += `ALTER TABLE "${schema}"."${table}" RENAME TO "${options.name}"; `;