supabase-graphql-example icon indicating copy to clipboard operation
supabase-graphql-example copied to clipboard

Recommended local development / migration workflow

Open amosbastian opened this issue 3 years ago • 1 comments

Hi, this isn't really an issue and more of a question. I've never used Supabase before, but only heard good things, and since GraphQL is now supported (also gql-tag-operations-preset = ❤️), I've decided to finally give it a try for a side project I'm building. I've been reading through the local development guide and this repository and was wondering a few things about the recommended local development / migration workflow.

  • Seems like dbmate is used here, while the above guide uses the Supabase CLI. Which is recommended?
  • The public_profiles migration generated by dbmate will not result in a correct Profile table when using it in Supabase's SQL editor (it will result in columns updatedat and avatarurl). Will using dbmate (or any other tool for creating migrations) possibly result in the same when using supabase db push?

I hope posting this here is ok, but if it's not, feel free to close it and I'll ask elsewhere!

amosbastian avatar Apr 04 '22 19:04 amosbastian

Hi @amosbastian one of my plans -- or if you'd like to try it first as I may not get to this for a bit -- is to write up how to use the Supabase CLI with local development.

Using db_mate was a stopgap in development since at the time we made the example app, the pg_graphql extension hadn't yet been added to the CLI and Postgres Docker image it uses.

It definitely can "clutter" the schema with several tables that one may have to ignore or apply RLS to.

With the CLI, you won't need dbmate since you can write you own migrations -- as well as pull down a remote project.

I'd give the CLI a go -- and use the db schema provided here as a start.

The public_profiles migration generated by dbmate will not result in a correct Profile table when using it in Supabase's SQL editor (it will result in columns updatedat and avatarurl)

Oh, I should check that out. I thought that: https://github.com/supabase-community/supabase-graphql-example/blob/main/data/supabase/04-public-profiles.sql had the correct casing.

dthyresson avatar Apr 04 '22 19:04 dthyresson

There have been major additions to the Supabase CLI in the last launch week: https://supabase.com/blog/supabase-cli-v1-and-admin-api-beta#schema-migrations

And I'd recommend reading the new docs: https://supabase.com/docs/guides/cli/local-development#database-migrations

I hope this helps :)

thorwebdev avatar Sep 26 '22 07:09 thorwebdev