Open parkernilson opened 2 months ago
Hello! Any updates on this issue? Has anybody seen it?
Update: It looks like when I use supabase db diff --use-pg-schema
it generates the following migration:
ALTER TYPE "public"."enum_type_1" ADD VALUE 'val3';
Which works just fine.
I am assuming this is because support for ALTER TYPE
was added to postgres and Migra just doesn't know about it, or it is trying to be backwards compatible or something like that.
It looks like as a workaround, I will just manually alter the migration files to use ALTER TYPE
whenever I modify an enum that is used as a function parameter type.
Describe the bug When adding a value to an enum, the db diff algorithm renames the type, creates a new one with the new value, and then alters all objects that depend on it to use the newly created enum, then deletes the old enum. However, it does not update functions that use the enum as a parameter type.
To Reproduce Steps to reproduce the behavior:
Create an enum type, with a table and a function that both use it
Generate a diff, which will result in:
However, the function is not re-created with the new enum, so trying to run the diff results in this error:
ERROR: cannot drop type enum_type_1__old_version_to_be_dropped because other objects depend on it (SQLSTATE 2BP01) At statement 3: drop type "public"."enum_type_1__old_version_to_be_dropped"
because the function is still using"public"."enum_type_1__old_version_to_be_dropped"
.Expected behavior After the new enum is created with the extra val, the function that depends on it should be recreated with the new enum:
System information Rerun the failing command with
--create-ticket
flag.Additional context I made sure to use migra with
supabase db diff --use-migra
. I have also filed a ticket with Migra here