From 05df47c0d7f7f2061cd63cbf3687d66b48fb7bb2 Mon Sep 17 00:00:00 2001 From: rob bygrave Date: Mon, 3 Dec 2018 22:11:47 +1300 Subject: [PATCH] #1569 - Ebean generates wrong ddl (datetime(6) vs timestamp) for H2 with `@History` annotation --- .../migrationtest-history/1.0__initial.sql | 12 ++- .../migrationtest/h2/1.0__initial.sql | 76 ++++++++----------- .../dbmigration/migrationtest/h2/1.1.sql | 14 ++-- 3 files changed, 44 insertions(+), 58 deletions(-) diff --git a/src/test/resources/dbmigration/migrationtest-history/1.0__initial.sql b/src/test/resources/dbmigration/migrationtest-history/1.0__initial.sql index 68987746a..344badd88 100644 --- a/src/test/resources/dbmigration/migrationtest-history/1.0__initial.sql +++ b/src/test/resources/dbmigration/migrationtest-history/1.0__initial.sql @@ -5,14 +5,12 @@ create table migtest_e_history7 ( constraint pk_migtest_e_history7 primary key (id) ); -alter table migtest_e_history7 - add column sys_period_start timestamp default now(); -alter table migtest_e_history7 - add column sys_period_end timestamp; +alter table migtest_e_history7 add column sys_period_start timestamp default now(); +alter table migtest_e_history7 add column sys_period_end timestamp; create table migtest_e_history7_history( - id integer, - sys_period_start timestamp, - sys_period_end timestamp + id integer, + sys_period_start timestamp, + sys_period_end timestamp ); create view migtest_e_history7_with_history as select * from migtest_e_history7 union all select * from migtest_e_history7_history; diff --git a/src/test/resources/dbmigration/migrationtest/h2/1.0__initial.sql b/src/test/resources/dbmigration/migrationtest/h2/1.0__initial.sql index 30ba59c08..f90dcc0a0 100644 --- a/src/test/resources/dbmigration/migrationtest/h2/1.0__initial.sql +++ b/src/test/resources/dbmigration/migrationtest/h2/1.0__initial.sql @@ -170,66 +170,56 @@ alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id for create index ix_migtest_e_basic_eref_id on migtest_e_basic (eref_id); alter table migtest_e_basic add constraint fk_migtest_e_basic_eref_id foreign key (eref_id) references migtest_e_ref (id) on delete restrict on update restrict; -alter table migtest_e_history2 - add column sys_period_start timestamp default now(); -alter table migtest_e_history2 - add column sys_period_end timestamp; +alter table migtest_e_history2 add column sys_period_start timestamp default now(); +alter table migtest_e_history2 add column sys_period_end timestamp; create table migtest_e_history2_history( - id integer, - test_string varchar(255), - obsolete_string1 varchar(255), - obsolete_string2 varchar(255), - sys_period_start timestamp, - sys_period_end timestamp + id integer, + test_string varchar(255), + obsolete_string1 varchar(255), + obsolete_string2 varchar(255), + sys_period_start timestamp, + sys_period_end timestamp ); create view migtest_e_history2_with_history as select * from migtest_e_history2 union all select * from migtest_e_history2_history; -alter table migtest_e_history3 - add column sys_period_start timestamp default now(); -alter table migtest_e_history3 - add column sys_period_end timestamp; +alter table migtest_e_history3 add column sys_period_start timestamp default now(); +alter table migtest_e_history3 add column sys_period_end timestamp; create table migtest_e_history3_history( - id integer, - test_string varchar(255), - sys_period_start timestamp, - sys_period_end timestamp + id integer, + test_string varchar(255), + sys_period_start timestamp, + sys_period_end timestamp ); create view migtest_e_history3_with_history as select * from migtest_e_history3 union all select * from migtest_e_history3_history; -alter table migtest_e_history4 - add column sys_period_start timestamp default now(); -alter table migtest_e_history4 - add column sys_period_end timestamp; +alter table migtest_e_history4 add column sys_period_start timestamp default now(); +alter table migtest_e_history4 add column sys_period_end timestamp; create table migtest_e_history4_history( - id integer, - test_number integer, - sys_period_start timestamp, - sys_period_end timestamp + id integer, + test_number integer, + sys_period_start timestamp, + sys_period_end timestamp ); create view migtest_e_history4_with_history as select * from migtest_e_history4 union all select * from migtest_e_history4_history; -alter table migtest_e_history5 - add column sys_period_start timestamp default now(); -alter table migtest_e_history5 - add column sys_period_end timestamp; +alter table migtest_e_history5 add column sys_period_start timestamp default now(); +alter table migtest_e_history5 add column sys_period_end timestamp; create table migtest_e_history5_history( - id integer, - test_number integer, - sys_period_start timestamp, - sys_period_end timestamp + id integer, + test_number integer, + sys_period_start timestamp, + sys_period_end timestamp ); create view migtest_e_history5_with_history as select * from migtest_e_history5 union all select * from migtest_e_history5_history; -alter table migtest_e_history6 - add column sys_period_start timestamp default now(); -alter table migtest_e_history6 - add column sys_period_end timestamp; +alter table migtest_e_history6 add column sys_period_start timestamp default now(); +alter table migtest_e_history6 add column sys_period_end timestamp; create table migtest_e_history6_history( - id integer, - test_number1 integer, - test_number2 integer, - sys_period_start timestamp, - sys_period_end timestamp + id integer, + test_number1 integer, + test_number2 integer, + sys_period_start timestamp, + sys_period_end timestamp ); create view migtest_e_history6_with_history as select * from migtest_e_history6 union all select * from migtest_e_history6_history; diff --git a/src/test/resources/dbmigration/migrationtest/h2/1.1.sql b/src/test/resources/dbmigration/migrationtest/h2/1.1.sql index 75be16374..2732f5d8e 100644 --- a/src/test/resources/dbmigration/migrationtest/h2/1.1.sql +++ b/src/test/resources/dbmigration/migrationtest/h2/1.1.sql @@ -115,15 +115,13 @@ alter table migtest_ckey_parent add constraint fk_migtest_ckey_parent_assoc_id f alter table migtest_oto_child add constraint fk_migtest_oto_child_master_id foreign key (master_id) references migtest_oto_master (id) on delete restrict on update restrict; -alter table migtest_e_history - add column sys_period_start timestamp default now(); -alter table migtest_e_history - add column sys_period_end timestamp; +alter table migtest_e_history add column sys_period_start timestamp default now(); +alter table migtest_e_history add column sys_period_end timestamp; create table migtest_e_history_history( - id integer, - test_string bigint, - sys_period_start timestamp, - sys_period_end timestamp + id integer, + test_string bigint, + sys_period_start timestamp, + sys_period_end timestamp ); create view migtest_e_history_with_history as select * from migtest_e_history union all select * from migtest_e_history_history;