diff --git a/ebean-test/src/test/java/misc/migration/v1_1/EHistory2.java b/ebean-test/src/test/java/misc/migration/v1_1/EHistory2.java
index 0c58ab84b..89cf970a7 100644
--- a/ebean-test/src/test/java/misc/migration/v1_1/EHistory2.java
+++ b/ebean-test/src/test/java/misc/migration/v1_1/EHistory2.java
@@ -2,11 +2,9 @@ package misc.migration.v1_1;
import io.ebean.annotation.DbDefault;
-import io.ebean.annotation.DbMigration;
import io.ebean.annotation.History;
import io.ebean.annotation.HistoryExclude;
import io.ebean.annotation.NotNull;
-import io.ebean.annotation.Platform;
import javax.persistence.Entity;
import javax.persistence.Id;
@@ -22,13 +20,6 @@ public class EHistory2 {
Integer id;
@NotNull
- // see: https://mariadb.com/de/resources/blog/use-cases-for-mariadb-data-versioning/
- @DbMigration(preAlter = {
- "SET @@system_versioning_alter_history = 1",
- "update ${table} set ${column} = 'unknown' where ${column} is null"}, platforms = Platform.MARIADB)
-
- // other platforms
- @DbMigration(preAlter = "update ${table} set ${column} = 'unknown' where ${column} is null")
@DbDefault("unknown")
String testString;
diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.0__initial.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.0__initial.sql
index 3533dde95..a5d40b3ea 100644
--- a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.0__initial.sql
+++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.0__initial.sql
@@ -159,6 +159,12 @@ create table migtest_oto_master (
constraint pk_migtest_oto_master primary key (id)
);
+-- apply alter tables
+alter table migtest_e_history2 add system versioning;
+alter table migtest_e_history3 add system versioning;
+alter table migtest_e_history4 add system versioning;
+alter table migtest_e_history5 add system versioning;
+alter table migtest_e_history6 add system versioning;
-- foreign keys and indices
create index ix_migtest_fk_cascade_one_id on migtest_fk_cascade (one_id);
alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id foreign key (one_id) references migtest_fk_cascade_one (id) on delete cascade on update restrict;
@@ -171,9 +177,3 @@ alter table migtest_e_basic add constraint fk_migtest_e_basic_eref_id foreign ke
create index ix_migtest_e_basic_indextest1 on migtest_e_basic (indextest1);
create index ix_migtest_e_basic_indextest5 on migtest_e_basic (indextest5);
--- apply history view
-alter table migtest_e_history2 add system versioning;
-alter table migtest_e_history3 add system versioning;
-alter table migtest_e_history4 add system versioning;
-alter table migtest_e_history5 add system versioning;
-alter table migtest_e_history6 add system versioning;
diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.1.sql
index b1fa065d3..5068f4608 100644
--- a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.1.sql
+++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.1.sql
@@ -37,8 +37,8 @@ update migtest_e_basic set status = 'A' where status is null;
insert into migtest_e_user (id) select distinct user_id from migtest_e_basic;
-- NOTE: table has @History - special migration may be necessary
-SET @@system_versioning_alter_history = 1;
update migtest_e_history2 set test_string = 'unknown' where test_string is null;
+SET @@system_versioning_alter_history = 1;
-- NOTE: table has @History - special migration may be necessary
update migtest_e_history6 set test_number1 = 42 where test_number1 is null;
@@ -54,6 +54,7 @@ alter table migtest_e_basic add column new_boolean_field tinyint(1) default 1 no
alter table migtest_e_basic add column new_boolean_field2 tinyint(1) default 1 not null;
alter table migtest_e_basic add column progress integer default 0 not null;
alter table migtest_e_basic add column new_integer integer default 42 not null;
+alter table migtest_e_history add system versioning;
alter table migtest_e_history modify test_string bigint;
alter table migtest_e_history2 modify test_string varchar(255) not null default 'unknown';
alter table migtest_e_history2 add column test_string2 varchar(255);
@@ -104,8 +105,3 @@ alter table migtest_oto_child add constraint fk_migtest_oto_child_master_id fore
create index ix_migtest_e_basic_indextest3 on migtest_e_basic (indextest3);
create index ix_migtest_e_basic_indextest6 on migtest_e_basic (indextest6);
--- apply history view
-alter table migtest_e_history add system versioning;
--- apply history trigger
-lock tables migtest_e_history3 write;
-unlock tables;
diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.2__dropsFor_1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.2__dropsFor_1.1.sql
index f33b6874f..52ed4e9c0 100644
--- a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.2__dropsFor_1.1.sql
+++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.2__dropsFor_1.1.sql
@@ -1,4 +1,6 @@
-- Migrationscripts for ebean unittest
+-- apply changes
+SET @@system_versioning_alter_history = 1;
-- apply alter tables
alter table migtest_e_basic drop column description_file;
alter table migtest_e_basic drop column old_boolean;
diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.3.sql
index 3063a1427..86d0e6528 100644
--- a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.3.sql
+++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.3.sql
@@ -25,6 +25,7 @@ create table migtest_e_ref (
update migtest_e_basic set status2 = 'N' where status2 is null;
update migtest_e_basic set user_id = 23 where user_id is null;
+SET @@system_versioning_alter_history = 1;
-- NOTE: table has @History - special migration may be necessary
update migtest_e_history6 set test_number2 = 7 where test_number2 is null;
@@ -54,6 +55,3 @@ alter table migtest_e_basic add constraint fk_migtest_e_basic_eref_id foreign ke
create index ix_migtest_e_basic_indextest1 on migtest_e_basic (indextest1);
create index ix_migtest_e_basic_indextest5 on migtest_e_basic (indextest5);
--- apply history trigger
-lock tables migtest_e_history3 write;
-unlock tables;
diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.4__dropsFor_1.3.sql
index f3cc59238..b15ac579e 100644
--- a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.4__dropsFor_1.3.sql
+++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.4__dropsFor_1.3.sql
@@ -1,4 +1,6 @@
-- Migrationscripts for ebean unittest
+-- apply changes
+SET @@system_versioning_alter_history = 1;
-- apply alter tables
alter table migtest_ckey_detail drop column one_key;
alter table migtest_ckey_detail drop column two_key;
@@ -8,6 +10,7 @@ alter table migtest_e_basic drop column new_boolean_field;
alter table migtest_e_basic drop column new_boolean_field2;
alter table migtest_e_basic drop column progress;
alter table migtest_e_basic drop column new_integer;
+alter table migtest_e_history drop system versioning;
alter table migtest_e_history2 drop column test_string2;
alter table migtest_e_history2 drop column test_string3;
alter table migtest_e_history2 drop column new_column;
@@ -20,5 +23,3 @@ drop sequence if exists migtest_e_user_seq;
drop table if exists migtest_mtm_c_migtest_mtm_m;
drop table if exists migtest_mtm_m_migtest_mtm_c;
drop table if exists migtest_mtm_m_phone_numbers;
--- apply history view
-alter table migtest_e_history drop system versioning;
diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/idx_mariadb.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/idx_mariadb.migrations
index 5f13ba80f..336dbf5d2 100644
--- a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/idx_mariadb.migrations
+++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/idx_mariadb.migrations
@@ -1,7 +1,7 @@
-2035483098, 1.0__initial.sql
--924429039, 1.1.sql
--300925212, 1.2__dropsFor_1.1.sql
--773358828, 1.3.sql
--1978922691, 1.4__dropsFor_1.3.sql
+-636344713, 1.0__initial.sql
+-1901679107, 1.1.sql
+-828985759, 1.2__dropsFor_1.1.sql
+903264949, 1.3.sql
+-446860935, 1.4__dropsFor_1.3.sql
561281075, R__order_views.sql
diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.0__initial.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.0__initial.sql
index 3533dde95..a5d40b3ea 100644
--- a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.0__initial.sql
+++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.0__initial.sql
@@ -159,6 +159,12 @@ create table migtest_oto_master (
constraint pk_migtest_oto_master primary key (id)
);
+-- apply alter tables
+alter table migtest_e_history2 add system versioning;
+alter table migtest_e_history3 add system versioning;
+alter table migtest_e_history4 add system versioning;
+alter table migtest_e_history5 add system versioning;
+alter table migtest_e_history6 add system versioning;
-- foreign keys and indices
create index ix_migtest_fk_cascade_one_id on migtest_fk_cascade (one_id);
alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id foreign key (one_id) references migtest_fk_cascade_one (id) on delete cascade on update restrict;
@@ -171,9 +177,3 @@ alter table migtest_e_basic add constraint fk_migtest_e_basic_eref_id foreign ke
create index ix_migtest_e_basic_indextest1 on migtest_e_basic (indextest1);
create index ix_migtest_e_basic_indextest5 on migtest_e_basic (indextest5);
--- apply history view
-alter table migtest_e_history2 add system versioning;
-alter table migtest_e_history3 add system versioning;
-alter table migtest_e_history4 add system versioning;
-alter table migtest_e_history5 add system versioning;
-alter table migtest_e_history6 add system versioning;
diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.1.sql
index b1fa065d3..5068f4608 100644
--- a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.1.sql
+++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.1.sql
@@ -37,8 +37,8 @@ update migtest_e_basic set status = 'A' where status is null;
insert into migtest_e_user (id) select distinct user_id from migtest_e_basic;
-- NOTE: table has @History - special migration may be necessary
-SET @@system_versioning_alter_history = 1;
update migtest_e_history2 set test_string = 'unknown' where test_string is null;
+SET @@system_versioning_alter_history = 1;
-- NOTE: table has @History - special migration may be necessary
update migtest_e_history6 set test_number1 = 42 where test_number1 is null;
@@ -54,6 +54,7 @@ alter table migtest_e_basic add column new_boolean_field tinyint(1) default 1 no
alter table migtest_e_basic add column new_boolean_field2 tinyint(1) default 1 not null;
alter table migtest_e_basic add column progress integer default 0 not null;
alter table migtest_e_basic add column new_integer integer default 42 not null;
+alter table migtest_e_history add system versioning;
alter table migtest_e_history modify test_string bigint;
alter table migtest_e_history2 modify test_string varchar(255) not null default 'unknown';
alter table migtest_e_history2 add column test_string2 varchar(255);
@@ -104,8 +105,3 @@ alter table migtest_oto_child add constraint fk_migtest_oto_child_master_id fore
create index ix_migtest_e_basic_indextest3 on migtest_e_basic (indextest3);
create index ix_migtest_e_basic_indextest6 on migtest_e_basic (indextest6);
--- apply history view
-alter table migtest_e_history add system versioning;
--- apply history trigger
-lock tables migtest_e_history3 write;
-unlock tables;
diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.2__dropsFor_1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.2__dropsFor_1.1.sql
index 832cfb31f..227ae4335 100644
--- a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.2__dropsFor_1.1.sql
+++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.2__dropsFor_1.1.sql
@@ -1,4 +1,6 @@
-- Migrationscripts for ebean unittest
+-- apply changes
+SET @@system_versioning_alter_history = 1;
-- apply alter tables
CALL usp_ebean_drop_column('migtest_e_basic', 'description_file');
CALL usp_ebean_drop_column('migtest_e_basic', 'old_boolean');
diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.3.sql
index 3063a1427..86d0e6528 100644
--- a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.3.sql
+++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.3.sql
@@ -25,6 +25,7 @@ create table migtest_e_ref (
update migtest_e_basic set status2 = 'N' where status2 is null;
update migtest_e_basic set user_id = 23 where user_id is null;
+SET @@system_versioning_alter_history = 1;
-- NOTE: table has @History - special migration may be necessary
update migtest_e_history6 set test_number2 = 7 where test_number2 is null;
@@ -54,6 +55,3 @@ alter table migtest_e_basic add constraint fk_migtest_e_basic_eref_id foreign ke
create index ix_migtest_e_basic_indextest1 on migtest_e_basic (indextest1);
create index ix_migtest_e_basic_indextest5 on migtest_e_basic (indextest5);
--- apply history trigger
-lock tables migtest_e_history3 write;
-unlock tables;
diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.4__dropsFor_1.3.sql
index 7b20bd958..abd31f737 100644
--- a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.4__dropsFor_1.3.sql
+++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.4__dropsFor_1.3.sql
@@ -1,4 +1,6 @@
-- Migrationscripts for ebean unittest
+-- apply changes
+SET @@system_versioning_alter_history = 1;
-- apply alter tables
CALL usp_ebean_drop_column('migtest_ckey_detail', 'one_key');
CALL usp_ebean_drop_column('migtest_ckey_detail', 'two_key');
@@ -8,6 +10,7 @@ CALL usp_ebean_drop_column('migtest_e_basic', 'new_boolean_field');
CALL usp_ebean_drop_column('migtest_e_basic', 'new_boolean_field2');
CALL usp_ebean_drop_column('migtest_e_basic', 'progress');
CALL usp_ebean_drop_column('migtest_e_basic', 'new_integer');
+alter table migtest_e_history drop system versioning;
CALL usp_ebean_drop_column('migtest_e_history2', 'test_string2');
CALL usp_ebean_drop_column('migtest_e_history2', 'test_string3');
CALL usp_ebean_drop_column('migtest_e_history2', 'new_column');
@@ -20,5 +23,3 @@ drop sequence if exists migtest_e_user_seq;
drop table if exists migtest_mtm_c_migtest_mtm_m;
drop table if exists migtest_mtm_m_migtest_mtm_c;
drop table if exists migtest_mtm_m_phone_numbers;
--- apply history view
-alter table migtest_e_history drop system versioning;
diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/idx_mariadb.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/idx_mariadb.migrations
index 10fdd6684..ddc777e23 100644
--- a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/idx_mariadb.migrations
+++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/idx_mariadb.migrations
@@ -1,8 +1,8 @@
1835064798, I__create_procs.sql
-2035483098, 1.0__initial.sql
--924429039, 1.1.sql
--17652545, 1.2__dropsFor_1.1.sql
--773358828, 1.3.sql
--171059083, 1.4__dropsFor_1.3.sql
+-636344713, 1.0__initial.sql
+-1901679107, 1.1.sql
+2123392915, 1.2__dropsFor_1.1.sql
+903264949, 1.3.sql
+-692020559, 1.4__dropsFor_1.3.sql
561281075, R__order_views.sql
diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.1.model.xml b/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.1.model.xml
index 0edbb49da..cab8491ca 100644
--- a/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.1.model.xml
+++ b/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.1.model.xml
@@ -54,15 +54,7 @@
-
-
- SET @@system_versioning_alter_history = 1
- update ${table} set ${column} = 'unknown' where ${column} is null
-
-
- update ${table} set ${column} = 'unknown' where ${column} is null
-
-
+