Let’s say I have a softr project setup with supabase/postgres where I have a custom type that looks something like this:
CREATE TYPE allowable_colors AS ENUM ('Green', 'Red', 'Blue');
I then have a field called color_choice
in a user_colors
table that looks something like:
color_choice allowable_colors NOT NULL
then, I have a form that uses allowable_colors
. Is it possible to set it up in such a way where Softr will understand that custom type, and allow a “sync with source” to pre-populate valid single-select options for that field?
So far I have had no luck with that – I have had to un-type my fields in postgres back to plain old text or varchar and then add in the ENUM types manually in softr as input choices. I attempted to still keep the allowed_colors
type in postgres (assuming it would accept them if softr sent over an allowed typed value), but it doesn’t look like softr can actually sync with custom typed fields – it throws an error (casting-related, which makes sense – e.g. the connector would have to know to do something like INSERT ... 'Green'::allowable_colors ...
).
Anyone else had experience with a setup like this? I am thinking I will have to fall back to not using custom types and either:
-
approximate types with a lookup table for each type populated by the desired enum values, then for tables that have a field of that type, add a relationship that softr can then use to reference fk-wise to sync/populate form choices – basically just using the db relationship instead of a custom type
-
find some way to efficiently templatize out forms in such a way that I don’t need to continuously/redundantly copypasta enum values as form field choices