Closed iteroji closed 5 years ago
Try conforming your enum to Migration
and adding it to your migration config. Postgres should then create the enum in the database.
Brilliant, I conformed the enum to PostgreSQLMigration
and then added it to the config
migrations.add(migration: UserRole.self, database: .psql)
and magically works. Thanks 👍
Awesome!
I cannot figure out what I'm doing wrong but my string enum is not being translated into enum type but jsonb.
I get the following error:
PostgreSQLError.server.error.report_invalid_token: invalid input syntax for type json
When I create the type in psql manually
CREATE TYPE userRole AS ENUM ('user', 'admin', 'superadmin');
it starts working. Is there a way to automatically create the native postgres enum?