Skip to content

feat: alias migration down command as reset #3635

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

Merged
merged 2 commits into from
Jun 4, 2025
Merged

Conversation

sweatybridge
Copy link
Contributor

@sweatybridge sweatybridge commented May 30, 2025

What kind of change does this PR introduce?

relates to #611

What is the new behavior?

Adds an alias for db reset so that it's easier to revert the last n migrations without inputting the full version string.

$ supabase db start
Seeding globals from roles.sql...
Applying migration 20250510162534_table.sql...
Applying migration 20250510162754_index.sql...
NOTICE (42P06): schema "supabase_migrations" already exists, skipping
Seeding data from supabase/seed.sql...
A new version of Supabase CLI is available: v2.23.4 (currently installed v)
We recommend updating regularly for new features and bug fixes: https://supabase.com/docs/guides/cli/getting-started#updating-the-supabase-cli
$ supabase migrations down
Connecting to local database...
Resetting local database to version: 20250510162534
Recreating database...

Additional context

https://x.com/nicolaygerold/status/1928396644241879115

@sweatybridge sweatybridge marked this pull request as ready for review May 30, 2025 10:49
@sweatybridge sweatybridge requested a review from a team as a code owner May 30, 2025 10:49
Copy link
Member

@avallete avallete left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

MIght wanna inform the user that this is a destructive operation for his data just in case ? 🤔

@coveralls
Copy link

coveralls commented Jun 4, 2025

Pull Request Test Coverage Report for Build 15439830073

Details

  • 15 of 42 (35.71%) changed or added relevant lines in 4 files are covered.
  • 5 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.06%) to 54.84%

Changes Missing Coverage Covered Lines Changed/Added Lines %
cmd/db.go 0 3 0.0%
internal/migration/down/down.go 13 17 76.47%
cmd/migration.go 0 10 0.0%
internal/db/reset/reset.go 2 12 16.67%
Files with Coverage Reduction New Missed Lines %
internal/gen/keys/keys.go 5 12.9%
Totals Coverage Status
Change from base Build 15438467837: -0.06%
Covered Lines: 5977
Relevant Lines: 10899

💛 - Coveralls

@sweatybridge sweatybridge merged commit 070e558 into develop Jun 4, 2025
9 checks passed
@sweatybridge sweatybridge deleted the migrate-down branch June 4, 2025 10:27
@sweatybridge
Copy link
Contributor Author

Yup, we print a confirmation when running migration down.

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