migra icon indicating copy to clipboard operation
migra copied to clipboard

Exclusion constraint missing from diff

Open kevinmehall opened this issue 3 years ago • 1 comments

When adding a table using an exclusion constraint, for example:

CREATE EXTENSION btree_gist;

create table event(
    resource_id int not null,
    start_time timestamptz not null,
    end_time timestamptz not null,
    exclude using gist (resource_id with =, tstzrange(start_time, end_time) with &&)
);

and diffing against a database that does not contain the table, migra returns a diff that creates the table and the index, but does not add the constraint to the table:

create extension if not exists "btree_gist" with schema "public" version '1.5';

create table "public"."event" (
    "resource_id" integer not null,
    "start_time" timestamp with time zone not null,
    "end_time" timestamp with time zone not null
);


CREATE INDEX event_resource_id_tstzrange_excl ON public.event USING gist (resource_id, tstzrange(start_time, end_time));

kevinmehall avatar Aug 26 '20 22:08 kevinmehall

Hey, thanks for filing this! I'll look at fixing this up as soon as I can.

djrobstep avatar Oct 18 '20 09:10 djrobstep

Exclusion constraints are now supported!

djrobstep avatar Sep 18 '22 06:09 djrobstep