DDL generation produces invalid type for ZonedDateTime #3720
Replies: 5 comments 1 reply
-
You should create a failing test. Noting that this doesn't reproduce in master, so you should create a failing test first to confirm you can reproduce the issue. @WhenCreated
ZonedDateTime zonedDateTime;
@WhenModified
ZonedDateTime zonedDateTime2; zoned_date_time timestamp not null,
zoned_date_time2 timestamp not null,
These are expected to be used together for testing purposes yes. You might want to outline the use case and include the NPE to see what should happen / if we need to change or fix something here. |
Beta Was this translation helpful? Give feedback.
-
|
Here is a minimal reproducer demonstrating the failing test:
No specific use case — this came up while debugging a DDL generator issue and trying to initialize the database via |
Beta Was this translation helpful? Give feedback.
-
|
Hey @rbygrave, Whenever you get a chance, could you confirm whether this is something that should be tracked as an issue? I’d be glad to open one if that’s the preferred workflow. |
Beta Was this translation helpful? Give feedback.
-
|
Ok, I have reproduced. So the issue is a regression related to https://github.com/ebean-orm/ebean/pull/3619/changes ... which was a feature/change to allow Background: JPA So as part of that change, Ebean's JPA API needed to set that default length on column from 255 to 0. However, that change has introduced this regression with H2. So now we need to figure out how to resolve that and keep the Postgres feature. |
Beta Was this translation helpful? Give feedback.
-
WorkaroundThe workaround you can use is to remove the dependency on |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
After upgrading to Ebean 16.0.0+, DDL generation for ZonedDateTime fields annotated with @WhenCreated / @WhenUpdated produces timestamp(255) when running against H2.
Since this is not a valid H2 type, schema creation fails in tests.
Is this expected in 16.x, or should this be reported as a bug?
While looking into this further, I noticed that DdlGenerator does not seem to support running only initSql / seedSql without full DDL generation. When generate=false and only initSql is used, a NullPointerException occurs, which suggests these steps are currently coupled to DDL generation.
#https://github.com/ebean-orm/ebean/blob/master/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/DdlGenerator.java#L126-L129
Is this expected, or should running initSql / seedSql independently be supported?
Beta Was this translation helpful? Give feedback.
All reactions