Skip to content

feat: support resetting database to a specific version#1369

Merged
sweatybridge merged 4 commits intomainfrom
reset-version
Aug 11, 2023
Merged

feat: support resetting database to a specific version#1369
sweatybridge merged 4 commits intomainfrom
reset-version

Conversation

@sweatybridge
Copy link
Contributor

@sweatybridge sweatybridge commented Aug 10, 2023

What kind of change does this PR introduce?

https://news.ycombinator.com/reply?id=37075043&goto=item%3Fid%3D37072464%2337075043

What is the current behavior?

Using supabase migration up would mean moving the latest migration out of the migrations folder, running supabase db reset, moving the file back in and then calling supabase migration up.

What is the new behavior?

Allows resetting database to a specific version. For eg.

  • supabase/migrations/20221014075902_first.sql
  • supabase/migrations/20221014075903_second.sql
$ supabase db reset --version 20221014075902
Resetting local database to version: 20221014075902
...

$ supabase migration up
Applying migration 20230810083342_test_pgsodium.sql...

$ supabase db reset --version 0
glob supabase/migrations/0_*.sql: file does not exist
...

Additional context

Add any other context or screenshots.

@coveralls
Copy link

coveralls commented Aug 10, 2023

Pull Request Test Coverage Report for Build 5828682526

  • 41 of 56 (73.21%) changed or added relevant lines in 7 files are covered.
  • 7 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.05%) to 56.799%

Changes Missing Coverage Covered Lines Changed/Added Lines %
cmd/db.go 1 2 50.0%
internal/db/push/push.go 0 1 0.0%
internal/migration/apply/apply.go 14 16 87.5%
internal/migration/repair/repair.go 10 12 83.33%
internal/db/reset/reset.go 12 21 57.14%
Files with Coverage Reduction New Missed Lines %
internal/migration/squash/squash.go 2 93.33%
internal/gen/keys/keys.go 5 12.31%
Totals Coverage Status
Change from base Build 5818087382: -0.05%
Covered Lines: 4749
Relevant Lines: 8361

💛 - Coveralls

@sweatybridge sweatybridge marked this pull request as ready for review August 10, 2023 14:11
@sweatybridge sweatybridge requested a review from a team as a code owner August 10, 2023 14:11
@sweatybridge sweatybridge merged commit 7e1f7b7 into main Aug 11, 2023
@sweatybridge sweatybridge deleted the reset-version branch August 11, 2023 05:40
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.

3 participants