Skip to content

db diff: Incorrect migration for enum (Declarative Schema) #3554

@Revadike

Description

@Revadike

I added new enums to the end of my notification enum definition:
Image

Running the diff tool did something unexpected:

alter type "public"."notification" rename to "notification__old_version_to_be_dropped";

create type "public"."notification" as enum ('new_trade', 'accepted_trade', 'new_vault_entry', 'unread_messages', 'disputed_trade', 'resolved_trade');

alter table "public"."notifications" alter column type type "public"."notification" using type::text::"public"."notification";

drop type "public"."notification__old_version_to_be_dropped";

I expected it to do the following:

-- Add new enum values to the existing type instead of recreating it
ALTER TYPE "public"."notification" ADD VALUE IF NOT EXISTS 'disputed_trade';
ALTER TYPE "public"."notification" ADD VALUE IF NOT EXISTS 'resolved_trade';

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