As my applications grow, I add new columns to tables and those are placed at the end of the list of columns. To ease development I like to keep related columns grouped.
Today we can visually reorder the columns via drag & drop in the Supabase UI and this order is saved within the browser's local storage. The issues with this approach are:
- The custom order is gone if for whatever reason local storage is erased.
- It isn't reflected on other machines such as my own or my coworkers.
- It isn't reflected in the types generated via the Supabase CLI (https://supabase.com/docs/guides/api/generating-types).
- It isn't reflected in automated reports, which need manual mapping via views or other means.
PostgreSQL itself doesn't have a mechanism by which to change the order of columns. Manually recreating tables is the only way to do this, which isn't practical or advisable for established projects. See https://wiki.postgresql.org/wiki/Alter_column_position
I'm wondering if Supabase could offer this ordering capability through persisting the custom order within the database itself, and then having it reflected to the various clients connecting to the DB (Supabase web UI, Supabase CLI, maybe even third-parties like pgAdmin if you manage to integrate this low enough in the API).
As my applications grow, I add new columns to tables and those are placed at the end of the list of columns. To ease development I like to keep related columns grouped.
Today we can visually reorder the columns via drag & drop in the Supabase UI and this order is saved within the browser's local storage. The issues with this approach are:
PostgreSQL itself doesn't have a mechanism by which to change the order of columns. Manually recreating tables is the only way to do this, which isn't practical or advisable for established projects. See https://wiki.postgresql.org/wiki/Alter_column_position
I'm wondering if Supabase could offer this ordering capability through persisting the custom order within the database itself, and then having it reflected to the various clients connecting to the DB (Supabase web UI, Supabase CLI, maybe even third-parties like pgAdmin if you manage to integrate this low enough in the API).