Merge pull request #875 from mirrorb/master

fix(PostgreSQL): unable to change table comment to empty, error changing the comment for a specific table name
This commit is contained in:
Fabio Di Stasio 2024-09-30 18:12:02 +02:00 committed by GitHub
commit 76c8cd1beb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -925,7 +925,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(';')}; `;
@ -1070,7 +1070,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}"; `;