dieselpoint / norm

Access a database in one line of code.
Other
205 stars 36 forks source link

Create table converts boolean into varchar #52

Open vicenrico opened 3 years ago

vicenrico commented 3 years ago

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.

ccleve commented 3 years ago

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();

lululombard commented 3 years ago

Just encountered this issue too

lululombard commented 3 years ago

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.