Skip to content

db reset ignores migrations and sql_paths when using SUPABASE_PROJECT_ID env var #4784

Description

@ignacio-gradial

Bug report

Describe the bug

supabase db reset with --workdir flag fails to apply migrations and ignores custom sql_paths from config.toml.

Root cause analysis

The CLI appears to:

  1. Ignore sql_paths from config.toml when using --workdir
  2. Only look for the default supabase/seed.sql path
  3. Not apply app migrations (only Supabase internal migrations)

The bug is in --workdir path resolution, not specific to SUPABASE_PROJECT_ID.

Expected behavior

  • db reset should read sql_paths from config.toml and apply those seed files
  • db reset should apply all migrations from the migrations/ directory

Workaround

Bypass supabase db reset and apply migrations/seeds manually via docker exec psql.

System information

  • OS: macOS (Darwin 24.5.0)
  • Supabase CLI version: 2.72.7
  • Docker version: Docker Desktop

Minimal repro (verified)

  1. Create a monorepo-like layout
mkdir -p repro/apps/supabase
cd repro
  1. Init Supabase in the subdir
supabase init --workdir apps/supabase
  1. Add one migration + one seed file
mkdir -p apps/supabase/migrations
mkdir -p apps/supabase/seed/base
cat > apps/supabase/migrations/20250101000000_init.sql <<'SQL'
create table public.test_repro(id int primary key);
SQL
cat > apps/supabase/seed/base/01-seed.sql <<'SQL'
insert into public.test_repro values (1);
SQL
  1. Configure custom sql_paths in config.toml
cat >> apps/supabase/config.toml <<'TOML'
[db.seed]
enabled = true
sql_paths = ["./seed/base/01-seed.sql"]
TOML
  1. Run with --workdir
supabase start --workdir apps/supabase
supabase db reset --workdir apps/supabase --yes

Observed output:

Seeding globals from roles.sql...
WARN: no files matched pattern: supabase/seed.sql

Observed DB state:

$ docker exec -i supabase_db_supabase psql -U postgres -d postgres -c "\\dt public.*"
Did not find any relation named "public.*".

Expected:

  • migration from migrations/ applied
  • seed from sql_paths applied

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions