You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I often want to know what my table schema looks like. To do this, I need to open the Dashboard table editor for the table in question, then scroll to see the columns.
Describe the solution you'd like
Rails has a schema.rb file that does this. (I think) When you run a migration, it updates the schema.rb file with a snapshot of all current tables and their schema.
doesnt supabase db dump -f supabase/schema.sql do this?
it does indeed.
however, i think an alternative approach that would better accomplish the intended DX would be to create all schemas in a /schemas file, then be able to run db reset to run off of /schema files instead of /migrations. then run db diff --use-migra on the newly reset schema to generate migration files.
when you want to change a schema file you change it in /schema instead of /migrations, editing the original schema SQL. db reset off of /schema. db diff off of newly reset local db to update migrations to push up to prod.
this enables you to better organize files under /supabase/schema/users.sql, /supabase/schema/teams.sql. can also include comments and organize each file as desired.
easier to reason about than one big dump into schema.sql
You would need to be able to tell supabase db reset to look at /supabase/schema/ instead of /migrations
Is your feature request related to a problem? Please describe.
I often want to know what my table schema looks like. To do this, I need to open the Dashboard table editor for the table in question, then scroll to see the columns.
Describe the solution you'd like
Rails has a
schema.rb
file that does this. (I think) When you run a migration, it updates theschema.rb
file with a snapshot of all current tables and their schema.The accepted answer for this question gives a concise explanation of why this file is useful:
https://stackoverflow.com/questions/9884429/rails-what-does-schema-rb-do
Here's a
schema.rb
example:This file could live in
/supabase/schema.sql
Describe alternatives you've considered
Generating types to a types.ts file is also helpful, but its a little noisier than this
schema.sql
approach.The text was updated successfully, but these errors were encountered: