The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
adds updating of check constraints
Alaister Younge10cf3ebfd53
diff --git a/package-lock.json b/package-lock.jsonindex 67067295f21..0a726b40db4 100644--- a/package-lock.json+++ b/package-lock.json@@ -9529,9 +9529,9 @@}},"node_modules/@supabase/postgres-meta": {- "version": "0.62.0",- "resolved": "https://registry.npmjs.org/@supabase/postgres-meta/-/postgres-meta-0.62.0.tgz",- "integrity": "sha512-35p2KJXq1tvzIuEa1VTEbRl5Or5qQEYFLZmG30LwdyDYGzdVtuQ03rYpQLMKAG8ueuhul+PN0WCPfvH1yq3DhA==",+ "version": "0.64.4",+ "resolved": "https://registry.npmjs.org/@supabase/postgres-meta/-/postgres-meta-0.64.4.tgz",+ "integrity": "sha512-QLRsNEPCi1VExZJqDy41YPzsAfXDyP/qB4fXu6G+EjcToONUGbi1zHFkBR9bqyAEE0dP+cf11+ZMD4cAXJ+7JQ==","dev": true,"dependencies": {"@sinclair/typebox": "^0.25.1",@@ -39094,7 +39094,7 @@"@storybook/addon-links": "^6.4.19","@storybook/react": "^6.4.19","@storybook/testing-library": "^0.0.9",- "@supabase/postgres-meta": "^0.62.0",+ "@supabase/postgres-meta": "^0.64.4","@tailwindcss/typography": "^0.5.2","@testing-library/dom": "^8.19.0","@testing-library/react": "^12.1.5",@@ -45927,9 +45927,9 @@}},"@supabase/postgres-meta": {- "version": "0.62.0",- "resolved": "https://registry.npmjs.org/@supabase/postgres-meta/-/postgres-meta-0.62.0.tgz",- "integrity": "sha512-35p2KJXq1tvzIuEa1VTEbRl5Or5qQEYFLZmG30LwdyDYGzdVtuQ03rYpQLMKAG8ueuhul+PN0WCPfvH1yq3DhA==",+ "version": "0.64.4",+ "resolved": "https://registry.npmjs.org/@supabase/postgres-meta/-/postgres-meta-0.64.4.tgz",+ "integrity": "sha512-QLRsNEPCi1VExZJqDy41YPzsAfXDyP/qB4fXu6G+EjcToONUGbi1zHFkBR9bqyAEE0dP+cf11+ZMD4cAXJ+7JQ==","dev": true,"requires": {"@sinclair/typebox": "^0.25.1",@@ -65994,7 +65994,7 @@"@storybook/testing-library": "^0.0.9","@stripe/react-stripe-js": "^1.7.0","@stripe/stripe-js": "^1.25.0",- "@supabase/postgres-meta": "^0.62.0",+ "@supabase/postgres-meta": "^0.64.4","@supabase/react-data-grid": "^7.1.0-beta.7","@supabase/shared-types": "^0.1.40","@supabase/supabase-js": "^2.13.0",diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.tsx b/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.tsxindex dafb2da326b..7bb69ff989c 100644--- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.tsx+++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.tsx@@ -345,6 +345,7 @@ const ColumnEditor = ({type="text"value={columnFields?.check ?? ''}onChange={(event: any) => onUpdateField({ check: event.target.value })}+ className="[&_input]:font-mono"/></FormSectionContent></FormSection>diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.utils.ts b/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.utils.tsindex f1b31300425..98c92be6f42 100644--- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.utils.ts+++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.utils.ts@@ -73,7 +73,7 @@ export const generateColumnFieldFromPostgresColumn = (comment: column?.comment ?? '',format: isArray ? column.format.slice(1) : column.format,defaultValue: column?.default_value as string | null,- check: null,+ check: column.check,isArray: isArray,isNullable: column.is_nullable,isIdentity: column.is_identity,@@ -97,7 +97,7 @@ export const generateCreateColumnPayload = (name: field.name,comment: field.comment,type: field.isArray ? `${field.format}[]` : field.format,- check: field.check ?? undefined,+ check: field.check?.trim() || undefined,isUnique: field.isUnique,isPrimaryKey: field.isPrimaryKey,...(!field.isPrimaryKey && !isIdentity && { isNullable: field.isNullable }),@@ -137,6 +137,10 @@ export const generateUpdateColumnPayload = (if (!isEqual(originalColumn.comment, comment)) {payload.comment = comment}+ if (!isEqual(originalColumn.check?.trim(), field.check?.trim())) {+ payload.check = field.check?.trim() || null+ }+if (!isEqual(originalColumn.format, type)) {payload.type = type}diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.types.ts b/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.types.tsindex 7d52f817a15..392a449c00f 100644--- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.types.ts+++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.types.ts@@ -4,7 +4,7 @@ export interface CreateColumnPayload {tableId: numbername: stringtype: string- check?: string+ check?: string | nullcomment?: stringdefaultValue?: anydefaultValueFormat?: 'expression' | 'literal'@@ -19,6 +19,7 @@ export interface UpdateColumnPayload {name?: stringcomment?: string | nulltype?: string+ check?: string | nulldropDefault?: booleandefaultValue?: anydefaultValueFormat?: 'expression' | 'literal'@@ -63,11 +64,11 @@ export interface ExtendedPostgresRelationship extends PostgresRelationship {export interface ColumnField {id: stringname: string+ check: string | nullcomment?: stringformat: stringdefaultValue: string | nullforeignKey: ExtendedPostgresRelationship | undefined- check: string | nullisNullable: booleanisUnique: booleanisArray: booleandiff --git a/studio/package.json b/studio/package.jsonindex c2299cd3fef..8f44780b533 100644--- a/studio/package.json+++ b/studio/package.json@@ -108,7 +108,7 @@"@storybook/addon-links": "^6.4.19","@storybook/react": "^6.4.19","@storybook/testing-library": "^0.0.9",- "@supabase/postgres-meta": "^0.62.0",+ "@supabase/postgres-meta": "^0.64.4","@tailwindcss/typography": "^0.5.2","@testing-library/dom": "^8.19.0","@testing-library/react": "^12.1.5",