Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supabase db push should support migration sub directories #2881

Closed
FrancescoMasaia opened this issue Nov 13, 2024 · 5 comments
Closed

Supabase db push should support migration sub directories #2881

FrancescoMasaia opened this issue Nov 13, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@FrancescoMasaia
Copy link

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

It could be interesting to have the support for push migration for subdirectories instead of only the main directory of supabase/migrations
that could be helpful in order to have features or scheme separated for each migration, specially in bigger projects i think that something like that is essential.

Describe the solution you'd like
A clear and concise description of what you want to happen.

I would like the script to iterate over
supabase/migrations/**/.sql
instead of only
supabase/migrations/
.sql

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

The other alternative is naming convention but that doesn't help to pre filter easily the files in the file explorer

Additional context
Add any other context or screenshots about the feature request here.

@sweatybridge sweatybridge added the enhancement New feature or request label Nov 15, 2024
@sweatybridge
Copy link
Contributor

sweatybridge commented Nov 15, 2024

We will probably support this by allowing custom migrations path to be declared in config.toml, similar to #2139 (comment)

I will close this one as a duplicate, but feel free to upvote the other issue to help us prioritise.

@sweatybridge sweatybridge closed this as not planned Won't fix, can't repro, duplicate, stale Nov 15, 2024
@GitTorres
Copy link

GitTorres commented Nov 20, 2024

Will a single custom migration path really be the solution here? I too have an interest in organizing my migrations folder by using subdirectories because it's a huge pain to search through to find the right SQL statements to adjust.

example:

  • subdirectory for each view that I've changed. That way I know the last file in each folder is the latest sql for that view.
migrations/some_view_name/*.sql
migrations/some_other_view_name/*.sql

Is the current vision for custom paths in the config.toml really supporting this?

@FrancescoMasaia
Copy link
Author

FrancescoMasaia commented Nov 20, 2024 via email

@sweatybridge
Copy link
Contributor

I too have an interest in organizing my migrations folder by using subdirectories because it's a huge pain to search through to find the right SQL statements to adjust.

That's a slightly different issue. I believe a nice solution for that is to use declarative schemas. So you would declare all your tables once in supabase/schemas directory and use db diff to generate migrations against the declared schema when making changes.

This is currently lacking some docs so I will try to explain the process more in a docs update.

See also #2099

@GitTorres
Copy link

Thanks for the idea @sweatybridge! Much appreciated. I'll give that approach a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants