Skip to content

declarative: changing an index to be DEFERRABLE INITIALLY DEFERRED should drop and recreate the index #5161

@tolgap

Description

@tolgap

Describe the bug
When updating an index to be DEFERRABLE INITIALLY DEFERRED, the declarative sync command creates diff of the index without DEFERRABLE INITIALLY DEFERRED.

Expected behavior
The index should be dropped in the migration, and it should be recreated with DEFERRABLE INITIALLY DEFERRED (unless there's a non-destructive way to update this index?)

Screenshots
If applicable, add screenshots to help explain your problem.

System information
Rerun the failing command with --create-ticket flag.

  • Version of OS: MacOS 26.4.2
  • Version of CLI: v2.98.1
  • Version of Docker: 4.69.0

Additional Information

Here's my example supabase/database/schemas/public/tables/my_table.sql diff

- CREATE UNIQUE INDEX my_table_unique ON public.my_table (id, sequence_number);
+ ALTER TABLE public.my_table
+  ADD CONSTRAINT my_table_unique UNIQUE (id, sequence_number) DEFERRABLE INITIALLY DEFERRED;

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    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