Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Column editor enforce that tce can only be done on text type columns

Joshen Lim3d6fd56e5644
diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.tsx b/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.tsx
index 85ee11730b8..f600baeede3 100644
--- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.tsx
+++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.tsx
@@ -94,6 +94,10 @@ const ColumnEditor: FC<Props> = ({
}
const updatedColumnFields = { ...columnFields, ...changes } as ColumnField
+ if (changes.format !== 'text' && columnFields.isEncrypted) {
+ updatedColumnFields.isEncrypted = false
+ }
+
setColumnFields(updatedColumnFields)
updateEditorDirty()
@@ -322,7 +326,21 @@ const ColumnEditor: FC<Props> = ({
<FormSectionContent loading={false} className="lg:!col-span-8">
<Toggle
label="Encrypt Column"
- descriptionText={`Encrypt the column's data with pgsodium's Transparent Column Encryption (TCE). Decrypted values will be stored within the "decrypted_${selectedTable.name}" view.`}
+ disabled={columnFields.format !== 'text'}
+ // @ts-ignore
+ descriptionText={
+ <div className="space-y-2">
+ <p>
+ Encrypt the column's data with pgsodium's Transparent Column Encryption (TCE).
+ Decrypted values will be stored within the "decrypted_{selectedTable.name}"
+ view.
+ </p>
+ <p>
+ Note: Only columns of <code className="text-xs">text</code> type can be
+ encrypted.
+ </p>
+ </div>
+ }
checked={columnFields.isEncrypted}
onChange={() => onUpdateField({ isEncrypted: !columnFields.isEncrypted })}
/>