From 8ad7ae221dadcdea8303494f2d1fa0e4c0d03e95 Mon Sep 17 00:00:00 2001 From: gitstart Date: Tue, 18 Apr 2023 15:39:06 +0000 Subject: [PATCH] fix: errors on adding PR cols Co-authored-by: phunguyenmurcul <51897872+phunguyenmurcul@users.noreply.github.com> --- studio/stores/pgmeta/MetaStore.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/studio/stores/pgmeta/MetaStore.ts b/studio/stores/pgmeta/MetaStore.ts index 78a1d0608de..f8e9dcdd1f1 100644 --- a/studio/stores/pgmeta/MetaStore.ts +++ b/studio/stores/pgmeta/MetaStore.ts @@ -652,7 +652,7 @@ export default class MetaStore implements IMetaStore { // Then add the primary key constraints here to support composite keys const primaryKeyColumns = columns .filter((column: ColumnField) => column.isPrimaryKey) - .map((column: ColumnField) => `"${column.name}"`) + .map((column: ColumnField) => column.name) if (primaryKeyColumns.length > 0) { const primaryKeys = await this.addPrimaryKey(table.schema, table.name, primaryKeyColumns) if (primaryKeys.error) throw primaryKeys.error @@ -752,11 +752,9 @@ export default class MetaStore implements IMetaStore { // Prepare a check to see if primary keys to the tables were updated or not const primaryKeyColumns = columns .filter((column) => column.isPrimaryKey) - .map((column) => `"${column.name}"`) + .map((column) => column.name) // @ts-ignore - const existingPrimaryKeyColumns = table.primary_keys.map( - (pk: PostgresPrimaryKey) => `"${pk.name}"` - ) + const existingPrimaryKeyColumns = table.primary_keys.map((pk: PostgresPrimaryKey) => pk.name) const isPrimaryKeyUpdated = !isEqual(primaryKeyColumns, existingPrimaryKeyColumns) if (isPrimaryKeyUpdated) {