mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 01:45:10 +03:00
adds updating of check constraints
This commit is contained in:
1 parent
c257a58d55
commit
e10cf3ebfd
5 files changed
+19
-13
No files matched your search
Generated
+8
-8
@@ -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",
|
||||
|
||||
+1
@@ -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>
|
||||
|
||||
+6
-2
@@ -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
|
||||
}
|
||||
|
||||
+3
-2
@@ -4,7 +4,7 @@ export interface CreateColumnPayload {
|
||||
tableId: number
|
||||
name: string
|
||||
type: string
|
||||
check?: string
|
||||
check?: string | null
|
||||
comment?: string
|
||||
defaultValue?: any
|
||||
defaultValueFormat?: 'expression' | 'literal'
|
||||
@@ -19,6 +19,7 @@ export interface UpdateColumnPayload {
|
||||
name?: string
|
||||
comment?: string | null
|
||||
type?: string
|
||||
check?: string | null
|
||||
dropDefault?: boolean
|
||||
defaultValue?: any
|
||||
defaultValueFormat?: 'expression' | 'literal'
|
||||
@@ -63,11 +64,11 @@ export interface ExtendedPostgresRelationship extends PostgresRelationship {
|
||||
export interface ColumnField {
|
||||
id: string
|
||||
name: string
|
||||
check: string | null
|
||||
comment?: string
|
||||
format: string
|
||||
defaultValue: string | null
|
||||
foreignKey: ExtendedPostgresRelationship | undefined
|
||||
check: string | null
|
||||
isNullable: boolean
|
||||
isUnique: boolean
|
||||
isArray: boolean
|
||||
|
||||
+1
-1
@@ -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",
|
||||
|
||||
Reference in new issue
Block a user