You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I tried to migrate between those 2 schemas (removing the SK option of an enum referenced by a foreign key) and it fails. Do you consider supporting this case?
Here are the schemas
From:
CREATETYPElanguage_code_enumAS ENUM ('FR', 'ES', 'SK'); -- the change is hereCREATETABLE "language" (
code language_code_enum PRIMARY KEY
);
CREATETABLE "provider" (
lang language_code_enum REFERENCES"language"(code)
);
Target:
CREATETYPElanguage_code_enumAS ENUM ('FR', 'ES'); -- the change is hereCREATETABLE "language" (
code language_code_enum PRIMARY KEY
);
CREATETABLE "provider" (
lang language_code_enum REFERENCES"language"(code)
);
migra generated code:
altertype"public"."language_code_enum" rename to "language_code_enum__old_version_to_be_dropped";
createtype "public"."language_code_enum"as enum ('FR', 'ES');
altertable"public"."language" alter column code type "public"."language_code_enum" using code::text::"public"."language_code_enum";
altertable"public"."provider" alter column lang type "public"."language_code_enum" using lang::text::"public"."language_code_enum";
droptype"public"."language_code_enum__old_version_to_be_dropped";
Here are the logs:
ALTER TYPE
CREATE TYPE
psql:mig.sql:5: ERROR: foreign key constraint "provider_lang_fkey" cannot be implemented
DETAIL: Key columns "lang" and "code" are of incompatible types: language_code_enum__old_version_to_be_dropped and language_code_enum.
psql:mig.sql:7: ERROR: foreign key constraint "provider_lang_fkey" cannot be implemented
DETAIL: Key columns "lang" and "code" are of incompatible types: language_code_enum and language_code_enum__old_version_to_be_dropped.
psql:mig.sql:9: ERROR: cannot drop type language_code_enum__old_version_to_be_dropped because other objects depend on it
DETAIL: column code of table language depends on type language_code_enum__old_version_to_be_dropped
column lang of table provider depends on type language_code_enum__old_version_to_be_dropped
HINT: Use DROP ... CASCADE to drop the dependent objects too.
I know the primary issue is the bad schema design
The text was updated successfully, but these errors were encountered:
Hello, I tried to migrate between those 2 schemas (removing the
SK
option of an enum referenced by a foreign key) and it fails. Do you consider supporting this case?Here are the schemas
From:
Target:
migra generated code:
Here are the logs:
I know the primary issue is the bad schema design
The text was updated successfully, but these errors were encountered: