The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix: column primary key toggling errors
gitstart9c54876f434c
diff --git a/studio/stores/pgmeta/MetaStore.ts b/studio/stores/pgmeta/MetaStore.tsindex 92ac9067ebd..1b606082d24 100644--- a/studio/stores/pgmeta/MetaStore.ts+++ b/studio/stores/pgmeta/MetaStore.ts@@ -288,8 +288,8 @@ export default class MetaStore implements IMetaStore {}async addPrimaryKey(schema: string, table: string, columns: string[]) {- const primaryKeyColumns = columns.join(',')- const query = `ALTER TABLE "${schema}"."${table}" ADD PRIMARY KEY (${primaryKeyColumns})`+ const primaryKeyColumns = columns.join('","')+ const query = `ALTER TABLE "${schema}"."${table}" ADD PRIMARY KEY ("${primaryKeyColumns}")`return await this.query(query)}@@ -501,11 +501,15 @@ export default class MetaStore implements IMetaStore {const removePK = await this.removePrimaryKey(column.schema, column.table)if (removePK.error) throw removePK.error}+const primaryKeyColumns = isPrimaryKey? existingPrimaryKeys.concat([column.name]): existingPrimaryKeys.filter((x) => x !== column.name)- const addPK = await this.addPrimaryKey(column.schema, column.table, primaryKeyColumns)- if (addPK.error) throw addPK.error++ if (primaryKeyColumns.length) {+ const addPK = await this.addPrimaryKey(column.schema, column.table, primaryKeyColumns)+ if (addPK.error) throw addPK.error+ }}// For updating of foreign key relationship, we remove the original one by default