Closed martyzz1 closed 4 years ago
for context I'm trying to migrate a php laravel mysql database to a postgres DB
ok seems I answered my own question and discovered more reasons to dislike mysql & laravel...
CREATE TYPE inquire_details AS ENUM ('always', 'no', 'on_no_only', 'on_yes_only');
This fixes the issue... But I'm still blocked where the same column name in mysql is used with an enum... Meaning I'd need to create an enum with the merged list..
hmm that doesn't work
CREATE TYPE status AS ENUM ('ACTIVE', 'INACTIVE');
CREATE TYPE status AS ENUM ('PUBLISHED', 'DRAFT', 'PENDING');
ERROR: type "status" already exists
DROP TYPE status;
CREATE TYPE status AS ENUM ('PUBLISHED', 'DRAFT', 'PENDING', 'ACTIVE', 'INACTIVE');
Still results in
Can't find an enumerated type with possible values ('ACTIVE', 'INACTIVE') for column status, please create one using CREATE TYPE
assuming only option is to rename the column of one of those "status" fields in the mysql
alter table posts CHANGE status ENUM varchar(12);
seems to have worked
Cool. Just to clarify, the ENUM doesn't have to have the same name as the column. Since MySQL doesn't define or name its enumeration types, when syncing from mysql to postgresql Kitchen Sync just tries to find any enumeration with the right values in postgresql's type system.
So you can pick a naming scheme for the postgresql enumerations like table1_status_t
and table2_status_t
or table1_status_enum_type
and table2_status_enum_type
or something, to avoid any naming conflicts with the columns or between the two status types.
I'm not entirely sure what this means, and what I need to do about it?