MySQL dialect:
CREATE TABLE My_Table ( my_column enum ('first', 'second', ... 'last'));
H2 dialect:
CREATE TABLE My_Table ( my_column ? ('first', 'second', ... 'last'));
What type is equivalent in H2 too the enum
type from MySQL?
I'm not sure if this is what you are looking for, but would you could do is use a check constraint:
CREATE TABLE My_Table(my_column varchar(255)
check (my_column in ('first', 'second', 'last')));
-- fails:
insert into My_Table values('x');
-- ok:
insert into My_Table values('first');
This will work in H2, Apache Derby, PostgreSQL, HSQLDB, and even SQLite. I didn't test other databases.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With