New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DDL generation of DbEnumValue uses different strategies for different table #2921
Comments
Shall we close this? I'm fairly sure you will find another annotation which has meant that it's using the ordinal integer value rather than the expected String values. |
@rbygrave I have tried to find, but all the annotations are ebean annotation. Just give me this week, will debug some more and update you |
@rbygrave : I have tried to find what is causing the issue, but couldn't I have to change all the DbEnumValue to @Enumerated(EnumType.STRING) to make it work. You can close the issue. |
Can you show us the code for the entities that declared UserConsentType as a field? (The entity code that declared the field of type UserConsentType). Did this type get used across multiple jars / multiple modules? Can you tell us the version of Ebean being used here? |
I'll close this for now. Lets reopen if we can come back to it sometime. |
Expected behavior
Ebean should use same strategy when generating DDL for DbEnumValue i.e. either use Integer or VarChar, or should honour
storage = DbEnumType.VARCHAR
when definedActual behavior
In my project it is using Integer for some table and VarChar for others even though I have defined
storage = DbEnumType.VARCHAR
on all enums.Steps to reproduce
For below enum, ebean uses VarChar
DDL generated
create table device_otp ( id uuid not null, otp integer not null, verified boolean default false not null, last_sent timestamptz, retry_count integer not null, device_id uuid not null, verified_at timestamptz, version bigint not null, when_created timestamptz not null, last_modified timestamptz not null, deleted boolean default false not null, generated_at timestamptz not null, otp_status varchar(8), constraint ck_device_otp_otp_status check ( otp_status in ('VALID','VERIFIED','EXPIRED')), constraint pk_device_otp primary key (id) );
For below ENUM ebean uses Integer
DDL generated
create table device_consents ( id uuid not null, consent_type integer not null, device_id uuid not null, provided boolean default false not null, version bigint not null, when_created timestamptz not null, last_modified timestamptz not null, deleted boolean default false not null, constraint ck_device_consents_consent_type check ( consent_type in (0,1,2,3,4)), constraint pk_device_consents primary key (id) );
The text was updated successfully, but these errors were encountered: