Skip to content

Corrupted local migration file after squashing linked database #4268

@coryetzkorn

Description

@coryetzkorn

Describe the bug
A clear and concise description of what the bug is.

To Reproduce

  1. Setup Supabase locally on a Mac
  2. Run a few db migrations locally with supabase migration new
  3. Push them to prod with supabase db push
  4. Squash prod migrations with supabase migration squash --linked
  5. Wait for local migrations to get combined into single file
  6. Inspect new SQL file
  7. See arbitrary \restrict kTrockadcZbBWKVmAbVhIDQlLdcDyZSsAqwkJgYKZgW66LahpYsOt6Cs2cZo2i7 injected at top and bottom and middle of file
  8. Realize file is corrupted

Current workaround is to:

  1. Delete the squashed file
  2. supabase db pull
  3. So prod is fine... there is something broken in the sync from prod to local

Expected behavior
Local squashed migration file is not corrupted.

Screenshots
Image

System information

  • Version of OS: MacOS 15.6.1 (24G90)
  • Version of CLI: 2.48.3
  • Version of Docker: 28.4.0, build d8eb465

Additional context

  • Node 22.18.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions