Skip to content

Deduplication of declarative schemas fail on Windows #3556

Description

@cohlar

Describe the bug
I have created the below declarative schema structure.

Image

I have added the below schema paths to my config.toml:

[db.migrations]
schema_paths = [
  "schemas/enums.sql",
  "schemas/tables/abstract/baseModel.sql",
  "schemas/tables/abstract/*.sql",
  "schemas/tables/**/*.sql"
]

When running yarn supabase db diff -f whatever, I get the below log:

Creating local database from declarative schemas:
 • supabase/schemas/enums.sql
 • supabase/schemas/tables/abstract/baseModel.sql
 • supabase\schemas\tables\abstract\baseDocuments.sql
 • supabase\schemas\tables\abstract\baseModel.sql
 • supabase\schemas\tables\abstract\baseProduct.sql
 • supabase\schemas\tables\public\sellers.sql
Initialising schema...
Seeding globals from roles.sql...
Seeding globals from enums.sql...
Seeding globals from baseModel.sql...
Seeding globals from baseDocuments.sql...
Seeding globals from baseModel.sql...

In my case the script fails when re-applying baseModel.sql a second time (it tries to re-create the same table).

Expected behavior
supabase/schemas/tables/abstract/baseModel.sql should only be run once, not twice.

System information

  • Ticket ID: fb17c4aebea84fa0b9132c7327d8dc5d
  • Version of OS: Windows 11 Pro 24H2
  • Version of CLI: 2.22.6
  • Version of Docker: Docker Windows Desktop 4.41.0 (engine 28.1.1)
  • Versions of services:
SERVICE IMAGE          | LOCAL                  | LINKED
 ------------------------|------------------------|------------
  supabase/postgres      | 15.8.1.044             | 15.8.1.044
  supabase/gotrue        | v2.170.0               | v2.172.1
  postgrest/postgrest    | v12.2.3                | v12.2.3
  supabase/realtime      | v2.34.47               | -
  supabase/storage-api   | v1.22.11               | -
  supabase/edge-runtime  | v1.67.4                | -
  supabase/studio        | 2025.05.05-sha-3c3fe9b | -
  supabase/postgres-meta | v0.88.9                | -
  supabase/logflare      | 1.12.0                 | -
  supabase/supavisor     | 2.5.1                  | -

Additional context
This feels like a Windows related issue with the / and \ (I suspect this doesn't happen on macOS or Linux, but haven't verified).
I can fix this in a number of ways for myself (e.g. make baseModel.sql idempotent, or describe schema_paths more explicitly, or rename my schemas to ensure they are executed in the right order by default), but this seems like a bug to me and I thought it's worth raising it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions