Skip to content

Allow to skip seed even if file exists #2534

Closed

Description

@T04435

Is your feature request related to a problem? Please describe.
I'm always frustrated when I have to update/rename the seed.sql to avoid seeding data.

Describe the solution you'd like
Add CLI db reset option --skip-seed which will ignore the seed.sql

Describe alternatives you've considered

  • rename seed.sql => _seed.sql every time I want to seed from a different source
  • ...?

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

Activity

  1. added this to the P1 milestone on Aug 6, 2024
  2. added a commit that references this issue on Sep 9, 2024
    e90292e
  3. sweatybridge commented on Sep 10, 2024

    @sweatybridge
    Contributor

    @avallete I wonder if this issue can be better solved by a config option, and if so what would it be?

    Perhaps something that allows users to specify different sources or skip completely if omitted.

    [db.seed]
    scripts_path = "./seed/*.sql"
    
  4. avallete commented on Sep 10, 2024

    @avallete
    Member

    @sweatybridge,

    I like the idea of adding a config option. My only worry is that it might be harder for users to find compared to a CLI flag, and it could be less convenient for one-time use. It depends on how often people would need to change this setting.

    For compatibility, can we add this new config automatically when the CLI runs for the first time (some kind of migration process)? Or should we use some logic like:

    • No [db.seed] in config: Use the current behavior.
    • [db.seed] in config: Seed from the given path or skip if empty/disabled.

    Also, for different branches, should we still use "supabase/seed/*.sql" by default, or follow the path set in config.toml?

    Another solution could be adding a --seed-path flag. If this flag is given an empty value, it would skip seeding. This way, users can control seeding behavior directly from the command line.

    What do you think?

  5. sweatybridge commented on Sep 11, 2024

    @sweatybridge
    Contributor

    Or should we use some logic like:

    • No [db.seed] in config: Use the current behavior.
    • [db.seed] in config: Seed from the given path or skip if empty/disabled.

    This sounds good to me. We can start with a cli flag for adhoc usage, followed by the config approach for branching use cases.

    The config approach would eventually support different sources so that users can control what to seed for each branch.

  6. added a commit that references this issue on Sep 12, 2024
    e60bc21
  7. frederikheld commented on Sep 26, 2026

    @frederikheld

    Can we please have the flag as well? Sometimes you just want to skip seeding once to debug something.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions