Skip to content

Conversation

@sweatybridge
Copy link
Contributor

@sweatybridge sweatybridge commented Aug 4, 2022

What kind of change does this PR introduce?

feature

What is the current behavior?

only public schema is diffed by migra

What is the new behavior?

exposes a -s or --schema flag

$ supabase db commit --migra --schema extensions my_ext

Additional context

Generates 20220804072957_my_ext.sql

create extension if not exists "pgtap" with schema "extensions" version '1.1.0';

create type "extensions"."_time_trial_type" as ("a_time" numeric);

@sweatybridge sweatybridge marked this pull request as ready for review August 4, 2022 07:27
@sweatybridge sweatybridge requested a review from soedirgo as a code owner August 4, 2022 07:27
@coveralls
Copy link

Pull Request Test Coverage Report for Build 2794913841

  • 1 of 11 (9.09%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.001%) to 21.502%

Changes Missing Coverage Covered Lines Changed/Added Lines %
cmd/db.go 1 2 50.0%
internal/db/commit/migra.go 0 9 0.0%
Totals Coverage Status
Change from base Build 2791067853: -0.001%
Covered Lines: 1102
Relevant Lines: 5125

💛 - Coveralls

@soedirgo
Copy link
Member

soedirgo commented Aug 4, 2022

How would this take care of diffing multiple schemas? e.g. if I have new tables in public as well as private

@sweatybridge
Copy link
Contributor Author

sweatybridge commented Aug 4, 2022

I assume it's trivial to run the command multiple times.

Also users probably know their schema better than us. Instead of trying to diff all schemas, it's probably ok to document and ask for user input. This approach agrees with pgAdmin GUI, which exposes a dropdown selection, and also migra, which exposes a schema flag.

@sweatybridge sweatybridge merged commit 7be5ed5 into main Aug 4, 2022
@sweatybridge sweatybridge deleted the flag-schema branch August 4, 2022 07:41
@github-actions
Copy link

github-actions bot commented Aug 4, 2022

🎉 This PR is included in version 0.33.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants