norm icon indicating copy to clipboard operation
norm copied to clipboard

Create table converts boolean into varchar

Open vicenrico opened this issue 4 years ago • 3 comments

Hello, i get this problem in h2 database. When i use boolean field, It converts It to varchar. How can that be possible.?

I,.e. boolean SEEN When i look generated table, i see it's varchar

Thanks in avance.

vicenrico avatar Mar 24 '21 06:03 vicenrico

I'm not sure -- haven't tested H2 in a while. But I've started to get away from using createTable() in my own code. It's better to just use straight sql: db.sql("CREATE TABLE foo (col1 boolean, col2 varchar)").execute();

ccleve avatar Mar 24 '21 15:03 ccleve

Just encountered this issue too

lululombard avatar Aug 20 '21 19:08 lululombard

This condition seems to be flipped, or is it me? https://github.com/dieselpoint/norm/blob/1b21dbba27b557dd92f578bf78fc107a9e34fb94/src/main/java/com/dieselpoint/norm/sqlmakers/StandardSqlMaker.java#L208

If it wasn't, @Column(name = "my_bool_field", columnDefinition = "my_bool_field tinyint default 0") would probably work.

lululombard avatar Aug 20 '21 20:08 lululombard