I am building a migration. Changed a column from string to Enum-Type and want to insert the saved values as Enum into the table, but no idea how to do this. I inserted my values into a new table, droped the colum, created it with an enum type and got only the strings in the new table. The string have the same text as the enum. The code is:
UPDATE event_participations
SET kind = participations_migration.kind
FROM participations_migration
WHERE participations_migration.part_id = event_participations.id
Participations_type is the name of the enum with values like "going", "not_going". Now I have strings in participations_migration.kind and want to get the enum value to update the event_participations.kind.
I need a subselect or join to update event_participations with the enum value according to the string which is set in participations_migration.kind. Any idea?