Skip to content

Conversation

@coolusaHD
Copy link

What kind of change does this PR introduce?

Feature

What is the current behavior?

Currently, supabase db reset only supports two seed behaviors:

Run the default seed file(s) defined in config (e.g. supabase/seed.sql)
Skip seeding entirely with --no-seed
There is no way to specify an alternative seed file at runtime. Users who want to reset their database with different initial data (e.g., an empty state with minimal setup vs. a full product example) must either:

Manually swap seed files before running reset
Skip seeding and manually run the desired seed file afterward

What is the new behavior?

Added a new --override-seed-file flag to supabase db reset that allows specifying a custom seed SQL file path:

The --override-seed-file and --no-seed flags are mutually exclusive since using both doesn't make sense.

Additional context

Add any other context or screenshots.

Copilot AI review requested due to automatic review settings January 4, 2026 22:20
@coolusaHD coolusaHD requested a review from a team as a code owner January 4, 2026 22:20
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new --override-seed-file flag to the supabase db reset command, allowing users to specify a custom seed SQL file at runtime instead of using the default supabase/seed.sql. The flag is mutually exclusive with --no-seed.

Key Changes:

  • New --override-seed-file flag added to override the default seed file path
  • Mutual exclusivity enforcement between --no-seed and --override-seed-file flags
  • Documentation updated to describe the new flag and its use case

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
docs/supabase/db/reset.md Added documentation explaining the new --override-seed-file flag and its use case for specifying custom seed files
cmd/db.go Introduced overrideSeedFile variable, flag registration, mutual exclusivity setup, and logic to update SqlPaths when the flag is provided

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

RunE: func(cmd *cobra.Command, args []string) error {
if noSeed {
utils.Config.Db.Seed.Enabled = false
} else if len(overrideSeedFile) > 0 {
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

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

When using the override seed file, the code only updates SqlPaths but doesn't ensure that Seed.Enabled is set to true. If seeding is disabled in the config file, the override seed file won't be executed. Consider adding a line to enable seeding when an override file is provided.

Suggested change
} else if len(overrideSeedFile) > 0 {
} else if len(overrideSeedFile) > 0 {
utils.Config.Db.Seed.Enabled = true

Copilot uses AI. Check for mistakes.
Comment on lines +331 to +333
resetFlags.StringVar(&overrideSeedFile, "override-seed-file", "", "Path to a custom seed SQL file to use instead of the default.")
dbResetCmd.MarkFlagsMutuallyExclusive("db-url", "linked", "local")
dbResetCmd.MarkFlagsMutuallyExclusive("no-seed", "override-seed-file")
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

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

The new --override-seed-file flag lacks test coverage. Consider adding tests to verify that the custom seed file is used correctly and that it's properly mutually exclusive with --no-seed.

Copilot uses AI. Check for mistakes.
@sweatybridge
Copy link
Contributor

You can specify custom seed paths via config.toml

[db.seed]
# If enabled, seeds the database after migrations during a db reset.
enabled = true
# Specifies an ordered list of seed files to load during db reset.
# Supports glob patterns relative to supabase directory: "./seeds/*.sql"
sql_paths = ["./seed.sql"]

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.

2 participants