From 3fea5ce93d0cd04735f7b401153b554ca10f8b3f Mon Sep 17 00:00:00 2001 From: Rob Bygrave Date: Fri, 20 Dec 2024 14:58:10 +1300 Subject: [PATCH] #3408 play-ebean inline sql comment in test generated scripts --- .../dbmigration/hana/I__create_procs.sql | 4 ++++ .../dbmigration/hana/idx_hana.migrations | 2 +- .../dbmigration/mariadb/I__create_procs.sql | 4 ++++ .../mariadb/idx_mariadb.migrations | 2 +- .../dbmigration/mysql/I__create_procs.sql | 4 ++++ .../dbmigration/mysql/idx_mysql.migrations | 2 +- .../dbmigration/mysql55/I__create_procs.sql | 4 ++++ .../dbmigration/mysql55/idx_mysql.migrations | 2 +- .../dbmigration/postgres/1.0__initial.sql | 12 +++++++++++ .../dbmigration/postgres/1.1.sql | 14 +++++++++++++ .../postgres/1.2__dropsFor_1.1.sql | 2 ++ .../dbmigration/postgres/1.3.sql | 8 ++++++++ .../postgres/1.4__dropsFor_1.3.sql | 6 ++++++ .../postgres/idx_postgres.migrations | 10 +++++----- .../dbmigration/postgres9/1.0__initial.sql | 12 +++++++++++ .../dbmigration/postgres9/1.1.sql | 14 +++++++++++++ .../postgres9/1.2__dropsFor_1.1.sql | 2 ++ .../dbmigration/postgres9/1.3.sql | 8 ++++++++ .../postgres9/1.4__dropsFor_1.3.sql | 6 ++++++ .../postgres9/idx_postgres.migrations | 10 +++++----- .../sqlserver16/I__create_procs.sql | 20 +++++++++++++++---- .../sqlserver16/idx_sqlserver.migrations | 2 +- .../sqlserver17/I__create_procs.sql | 20 +++++++++++++++---- .../sqlserver17/idx_sqlserver.migrations | 2 +- .../dbmigration/yugabyte/1.0__initial.sql | 12 +++++++++++ .../dbmigration/yugabyte/1.1.sql | 14 +++++++++++++ .../yugabyte/1.2__dropsFor_1.1.sql | 2 ++ .../dbmigration/yugabyte/1.3.sql | 8 ++++++++ .../yugabyte/1.4__dropsFor_1.3.sql | 6 ++++++ .../yugabyte/idx_yugabyte.migrations | 10 +++++----- 30 files changed, 195 insertions(+), 29 deletions(-) diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/hana/I__create_procs.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/hana/I__create_procs.sql index cec7863ac0..d65c7e0f5c 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/hana/I__create_procs.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/hana/I__create_procs.sql @@ -6,6 +6,7 @@ delimiter $$ -- CREATE OR REPLACE PROCEDURE usp_ebean_drop_foreign_keys(IN table_name NVARCHAR(256), IN column_name NVARCHAR(256)) AS +-- play-ebean-start BEGIN DECLARE foreign_key_names TABLE(CONSTRAINT_NAME NVARCHAR(256), TABLE_NAME NVARCHAR(256)); DECLARE i INT; @@ -17,6 +18,7 @@ EXEC 'ALTER TABLE "' || ESCAPE_DOUBLE_QUOTES(:foreign_key_names.TABLE_NAME[i]) | END FOR; END; +-- play-ebean-end $$ delimiter $$ @@ -26,8 +28,10 @@ delimiter $$ -- CREATE OR REPLACE PROCEDURE usp_ebean_drop_column(IN table_name NVARCHAR(256), IN column_name NVARCHAR(256)) AS +-- play-ebean-start BEGIN CALL usp_ebean_drop_foreign_keys(table_name, column_name); EXEC 'ALTER TABLE "' || UPPER(ESCAPE_DOUBLE_QUOTES(table_name)) || '" DROP ("' || UPPER(ESCAPE_DOUBLE_QUOTES(column_name)) || '")'; END; +-- play-ebean-end $$ diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/hana/idx_hana.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/hana/idx_hana.migrations index 9344a16da9..0fc827b7b1 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/hana/idx_hana.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/hana/idx_hana.migrations @@ -1,4 +1,4 @@ --745347271, I__create_procs.sql +1349158244, I__create_procs.sql -2017770851, 1.0__initial.sql -475843596, 1.1.sql 1535221752, 1.2__dropsFor_1.1.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/I__create_procs.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/I__create_procs.sql index 1dd943f653..cb91f376fc 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/I__create_procs.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/I__create_procs.sql @@ -7,6 +7,7 @@ delimiter $$ -- deletes all constraints and foreign keys referring to TABLE.COLUMN -- CREATE PROCEDURE usp_ebean_drop_foreign_keys(IN p_table_name VARCHAR(255), IN p_column_name VARCHAR(255)) +-- play-ebean-start BEGIN DECLARE done INT DEFAULT FALSE; DECLARE c_fk_name CHAR(255); @@ -29,6 +30,7 @@ END LOOP; CLOSE curs; END +-- play-ebean-end $$ DROP PROCEDURE IF EXISTS usp_ebean_drop_column; @@ -39,10 +41,12 @@ delimiter $$ -- deletes the column and ensures that all indices and constraints are dropped first -- CREATE PROCEDURE usp_ebean_drop_column(IN p_table_name VARCHAR(255), IN p_column_name VARCHAR(255)) +-- play-ebean-start BEGIN CALL usp_ebean_drop_foreign_keys(p_table_name, p_column_name); SET @sql = CONCAT('ALTER TABLE `', p_table_name, '` DROP COLUMN `', p_column_name, '`'); PREPARE stmt FROM @sql; EXECUTE stmt; END +-- play-ebean-end $$ 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 f1a58c3ba0..af3db8f1d7 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,4 +1,4 @@ --1933396282, I__create_procs.sql +-1617676189, I__create_procs.sql -2111548334, 1.0__initial.sql 1085383251, 1.1.sql 1187950993, 1.2__dropsFor_1.1.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/I__create_procs.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/I__create_procs.sql index 1dd943f653..cb91f376fc 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/I__create_procs.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/I__create_procs.sql @@ -7,6 +7,7 @@ delimiter $$ -- deletes all constraints and foreign keys referring to TABLE.COLUMN -- CREATE PROCEDURE usp_ebean_drop_foreign_keys(IN p_table_name VARCHAR(255), IN p_column_name VARCHAR(255)) +-- play-ebean-start BEGIN DECLARE done INT DEFAULT FALSE; DECLARE c_fk_name CHAR(255); @@ -29,6 +30,7 @@ END LOOP; CLOSE curs; END +-- play-ebean-end $$ DROP PROCEDURE IF EXISTS usp_ebean_drop_column; @@ -39,10 +41,12 @@ delimiter $$ -- deletes the column and ensures that all indices and constraints are dropped first -- CREATE PROCEDURE usp_ebean_drop_column(IN p_table_name VARCHAR(255), IN p_column_name VARCHAR(255)) +-- play-ebean-start BEGIN CALL usp_ebean_drop_foreign_keys(p_table_name, p_column_name); SET @sql = CONCAT('ALTER TABLE `', p_table_name, '` DROP COLUMN `', p_column_name, '`'); PREPARE stmt FROM @sql; EXECUTE stmt; END +-- play-ebean-end $$ diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/idx_mysql.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/idx_mysql.migrations index dce80649d6..0a47a38d56 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/idx_mysql.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/idx_mysql.migrations @@ -1,4 +1,4 @@ --1933396282, I__create_procs.sql +-1617676189, I__create_procs.sql 1980830787, 1.0__initial.sql -151422898, 1.1.sql -1097227916, 1.2__dropsFor_1.1.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/I__create_procs.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/I__create_procs.sql index 1dd943f653..cb91f376fc 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/I__create_procs.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/I__create_procs.sql @@ -7,6 +7,7 @@ delimiter $$ -- deletes all constraints and foreign keys referring to TABLE.COLUMN -- CREATE PROCEDURE usp_ebean_drop_foreign_keys(IN p_table_name VARCHAR(255), IN p_column_name VARCHAR(255)) +-- play-ebean-start BEGIN DECLARE done INT DEFAULT FALSE; DECLARE c_fk_name CHAR(255); @@ -29,6 +30,7 @@ END LOOP; CLOSE curs; END +-- play-ebean-end $$ DROP PROCEDURE IF EXISTS usp_ebean_drop_column; @@ -39,10 +41,12 @@ delimiter $$ -- deletes the column and ensures that all indices and constraints are dropped first -- CREATE PROCEDURE usp_ebean_drop_column(IN p_table_name VARCHAR(255), IN p_column_name VARCHAR(255)) +-- play-ebean-start BEGIN CALL usp_ebean_drop_foreign_keys(p_table_name, p_column_name); SET @sql = CONCAT('ALTER TABLE `', p_table_name, '` DROP COLUMN `', p_column_name, '`'); PREPARE stmt FROM @sql; EXECUTE stmt; END +-- play-ebean-end $$ diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/idx_mysql.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/idx_mysql.migrations index 31e2e055b4..12e7122f3d 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/idx_mysql.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/idx_mysql.migrations @@ -1,4 +1,4 @@ --1933396282, I__create_procs.sql +-1617676189, I__create_procs.sql 369577572, 1.0__initial.sql -151422898, 1.1.sql -1097227916, 1.2__dropsFor_1.1.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.0__initial.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.0__initial.sql index acc4504bc8..81f8191796 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.0__initial.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.0__initial.sql @@ -198,6 +198,7 @@ alter table migtest_e_history6 add column if not exists sys_period tstzrange not create table migtest_e_history2_history(like migtest_e_history2); create view migtest_e_history2_with_history as select * from migtest_e_history2 union all select * from migtest_e_history2_history; create or replace function migtest_e_history2_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -213,6 +214,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history2_history_upd @@ -223,6 +225,7 @@ create trigger migtest_e_history2_history_upd create table migtest_e_history3_history(like migtest_e_history3); create view migtest_e_history3_with_history as select * from migtest_e_history3 union all select * from migtest_e_history3_history; create or replace function migtest_e_history3_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -238,6 +241,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history3_history_upd @@ -248,6 +252,7 @@ create trigger migtest_e_history3_history_upd create table migtest_e_history4_history(like migtest_e_history4); create view migtest_e_history4_with_history as select * from migtest_e_history4 union all select * from migtest_e_history4_history; create or replace function migtest_e_history4_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -263,6 +268,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history4_history_upd @@ -273,6 +279,7 @@ create trigger migtest_e_history4_history_upd create table migtest_e_history5_history(like migtest_e_history5); create view migtest_e_history5_with_history as select * from migtest_e_history5 union all select * from migtest_e_history5_history; create or replace function migtest_e_history5_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -288,6 +295,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history5_history_upd @@ -298,6 +306,7 @@ create trigger migtest_e_history5_history_upd create table migtest_e_history6_history(like migtest_e_history6); create view migtest_e_history6_with_history as select * from migtest_e_history6 union all select * from migtest_e_history6_history; create or replace function migtest_e_history6_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -313,6 +322,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history6_history_upd @@ -323,6 +333,7 @@ create trigger migtest_e_history6_history_upd create table table_history(like "table"); create view table_with_history as select * from "table" union all select * from table_history; create or replace function table_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -338,6 +349,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger table_history_upd diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.1.sql index 331821319b..7b1675d739 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.1.sql @@ -255,6 +255,7 @@ alter table migtest_e_basic add constraint uq_migtest_e_basic_indextest5 unique create table migtest_e_history_history(like migtest_e_history); create view migtest_e_history_with_history as select * from migtest_e_history union all select * from migtest_e_history_history; create or replace function migtest_e_history_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -270,6 +271,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history_history_upd @@ -281,6 +283,7 @@ comment on column migtest_e_history.test_string is 'Column altered to long now'; comment on table migtest_e_history is 'We have history now'; create view migtest_e_history2_with_history as select * from migtest_e_history2 union all select * from migtest_e_history2_history; create or replace function migtest_e_history2_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -296,6 +299,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history2_history_upd @@ -304,6 +308,7 @@ create trigger migtest_e_history2_history_upd create view migtest_e_history3_with_history as select * from migtest_e_history3 union all select * from migtest_e_history3_history; create or replace function migtest_e_history3_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -319,6 +324,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history3_history_upd @@ -327,6 +333,7 @@ create trigger migtest_e_history3_history_upd create view migtest_e_history4_with_history as select * from migtest_e_history4 union all select * from migtest_e_history4_history; create or replace function migtest_e_history4_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -342,6 +349,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history4_history_upd @@ -350,6 +358,7 @@ create trigger migtest_e_history4_history_upd create view migtest_e_history5_with_history as select * from migtest_e_history5 union all select * from migtest_e_history5_history; create or replace function migtest_e_history5_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -365,6 +374,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history5_history_upd @@ -373,6 +383,7 @@ create trigger migtest_e_history5_history_upd create view migtest_e_history6_with_history as select * from migtest_e_history6 union all select * from migtest_e_history6_history; create or replace function migtest_e_history6_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -388,6 +399,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history6_history_upd @@ -397,6 +409,7 @@ create trigger migtest_e_history6_history_upd comment on column "table"."index" is 'this is an other comment'; create view table_with_history as select * from "table" union all select * from table_history; create or replace function table_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -412,6 +425,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger table_history_upd diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.2__dropsFor_1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.2__dropsFor_1.1.sql index 7e6c962280..f89073040b 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.2__dropsFor_1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.2__dropsFor_1.1.sql @@ -16,6 +16,7 @@ alter table migtest_e_history2_history drop column obsolete_string2; -- apply post alter create view migtest_e_history2_with_history as select * from migtest_e_history2 union all select * from migtest_e_history2_history; create or replace function migtest_e_history2_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -31,6 +32,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history2_history_upd diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.3.sql index 640840abc0..849da55bd9 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.3.sql @@ -108,6 +108,7 @@ comment on column migtest_e_history.test_string is ''; comment on table migtest_e_history is ''; create view migtest_e_history2_with_history as select * from migtest_e_history2 union all select * from migtest_e_history2_history; create or replace function migtest_e_history2_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -123,6 +124,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history2_history_upd @@ -131,6 +133,7 @@ create trigger migtest_e_history2_history_upd create view migtest_e_history3_with_history as select * from migtest_e_history3 union all select * from migtest_e_history3_history; create or replace function migtest_e_history3_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -146,6 +149,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history3_history_upd @@ -154,6 +158,7 @@ create trigger migtest_e_history3_history_upd create view migtest_e_history4_with_history as select * from migtest_e_history4 union all select * from migtest_e_history4_history; create or replace function migtest_e_history4_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -169,6 +174,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history4_history_upd @@ -177,6 +183,7 @@ create trigger migtest_e_history4_history_upd create view migtest_e_history6_with_history as select * from migtest_e_history6 union all select * from migtest_e_history6_history; create or replace function migtest_e_history6_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -192,6 +199,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history6_history_upd diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.4__dropsFor_1.3.sql index 784d289fb2..3320cad4ce 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.4__dropsFor_1.3.sql @@ -46,6 +46,7 @@ alter table table_history drop column textfield2; -- apply post alter create view migtest_e_history2_with_history as select * from migtest_e_history2 union all select * from migtest_e_history2_history; create or replace function migtest_e_history2_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -61,6 +62,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history2_history_upd @@ -69,6 +71,7 @@ create trigger migtest_e_history2_history_upd create view migtest_e_history5_with_history as select * from migtest_e_history5 union all select * from migtest_e_history5_history; create or replace function migtest_e_history5_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -84,6 +87,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history5_history_upd @@ -92,6 +96,7 @@ create trigger migtest_e_history5_history_upd create view table_with_history as select * from "table" union all select * from table_history; create or replace function table_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -107,6 +112,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger table_history_upd diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/idx_postgres.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/idx_postgres.migrations index 19fa49c5dd..e62e8912b2 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/idx_postgres.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/idx_postgres.migrations @@ -1,8 +1,8 @@ -1942370812, 1.0__initial.sql --1945546744, 1.1.sql --261111052, 1.2__dropsFor_1.1.sql --129523686, 1.3.sql -1188958800, 1.4__dropsFor_1.3.sql +-894233730, 1.0__initial.sql +-1140732341, 1.1.sql +-328303888, 1.2__dropsFor_1.1.sql +-1783324840, 1.3.sql +-1371008923, 1.4__dropsFor_1.3.sql 783227075, R__multi_comments.sql 561281075, R__order_views.sql 283077354, R__pg_indexes.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.0__initial.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.0__initial.sql index e91b2b1c3d..feab2baf7f 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.0__initial.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.0__initial.sql @@ -198,6 +198,7 @@ alter table migtest_e_history6 add column if not exists sys_period tstzrange not create table migtest_e_history2_history(like migtest_e_history2); create view migtest_e_history2_with_history as select * from migtest_e_history2 union all select * from migtest_e_history2_history; create or replace function migtest_e_history2_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -213,6 +214,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history2_history_upd @@ -223,6 +225,7 @@ create trigger migtest_e_history2_history_upd create table migtest_e_history3_history(like migtest_e_history3); create view migtest_e_history3_with_history as select * from migtest_e_history3 union all select * from migtest_e_history3_history; create or replace function migtest_e_history3_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -238,6 +241,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history3_history_upd @@ -248,6 +252,7 @@ create trigger migtest_e_history3_history_upd create table migtest_e_history4_history(like migtest_e_history4); create view migtest_e_history4_with_history as select * from migtest_e_history4 union all select * from migtest_e_history4_history; create or replace function migtest_e_history4_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -263,6 +268,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history4_history_upd @@ -273,6 +279,7 @@ create trigger migtest_e_history4_history_upd create table migtest_e_history5_history(like migtest_e_history5); create view migtest_e_history5_with_history as select * from migtest_e_history5 union all select * from migtest_e_history5_history; create or replace function migtest_e_history5_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -288,6 +295,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history5_history_upd @@ -298,6 +306,7 @@ create trigger migtest_e_history5_history_upd create table migtest_e_history6_history(like migtest_e_history6); create view migtest_e_history6_with_history as select * from migtest_e_history6 union all select * from migtest_e_history6_history; create or replace function migtest_e_history6_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -313,6 +322,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history6_history_upd @@ -323,6 +333,7 @@ create trigger migtest_e_history6_history_upd create table table_history(like "table"); create view table_with_history as select * from "table" union all select * from table_history; create or replace function table_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -338,6 +349,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger table_history_upd diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.1.sql index 4b29b26918..d403f66d06 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.1.sql @@ -255,6 +255,7 @@ alter table migtest_e_basic add constraint uq_migtest_e_basic_indextest5 unique create table migtest_e_history_history(like migtest_e_history); create view migtest_e_history_with_history as select * from migtest_e_history union all select * from migtest_e_history_history; create or replace function migtest_e_history_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -270,6 +271,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history_history_upd @@ -281,6 +283,7 @@ comment on column migtest_e_history.test_string is 'Column altered to long now'; comment on table migtest_e_history is 'We have history now'; create view migtest_e_history2_with_history as select * from migtest_e_history2 union all select * from migtest_e_history2_history; create or replace function migtest_e_history2_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -296,6 +299,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history2_history_upd @@ -304,6 +308,7 @@ create trigger migtest_e_history2_history_upd create view migtest_e_history3_with_history as select * from migtest_e_history3 union all select * from migtest_e_history3_history; create or replace function migtest_e_history3_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -319,6 +324,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history3_history_upd @@ -327,6 +333,7 @@ create trigger migtest_e_history3_history_upd create view migtest_e_history4_with_history as select * from migtest_e_history4 union all select * from migtest_e_history4_history; create or replace function migtest_e_history4_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -342,6 +349,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history4_history_upd @@ -350,6 +358,7 @@ create trigger migtest_e_history4_history_upd create view migtest_e_history5_with_history as select * from migtest_e_history5 union all select * from migtest_e_history5_history; create or replace function migtest_e_history5_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -365,6 +374,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history5_history_upd @@ -373,6 +383,7 @@ create trigger migtest_e_history5_history_upd create view migtest_e_history6_with_history as select * from migtest_e_history6 union all select * from migtest_e_history6_history; create or replace function migtest_e_history6_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -388,6 +399,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history6_history_upd @@ -397,6 +409,7 @@ create trigger migtest_e_history6_history_upd comment on column "table"."index" is 'this is an other comment'; create view table_with_history as select * from "table" union all select * from table_history; create or replace function table_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -412,6 +425,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger table_history_upd diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.2__dropsFor_1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.2__dropsFor_1.1.sql index 7e6c962280..f89073040b 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.2__dropsFor_1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.2__dropsFor_1.1.sql @@ -16,6 +16,7 @@ alter table migtest_e_history2_history drop column obsolete_string2; -- apply post alter create view migtest_e_history2_with_history as select * from migtest_e_history2 union all select * from migtest_e_history2_history; create or replace function migtest_e_history2_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -31,6 +32,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history2_history_upd diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.3.sql index 71fbb9d4fb..36adc18729 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.3.sql @@ -108,6 +108,7 @@ comment on column migtest_e_history.test_string is ''; comment on table migtest_e_history is ''; create view migtest_e_history2_with_history as select * from migtest_e_history2 union all select * from migtest_e_history2_history; create or replace function migtest_e_history2_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -123,6 +124,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history2_history_upd @@ -131,6 +133,7 @@ create trigger migtest_e_history2_history_upd create view migtest_e_history3_with_history as select * from migtest_e_history3 union all select * from migtest_e_history3_history; create or replace function migtest_e_history3_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -146,6 +149,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history3_history_upd @@ -154,6 +158,7 @@ create trigger migtest_e_history3_history_upd create view migtest_e_history4_with_history as select * from migtest_e_history4 union all select * from migtest_e_history4_history; create or replace function migtest_e_history4_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -169,6 +174,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history4_history_upd @@ -177,6 +183,7 @@ create trigger migtest_e_history4_history_upd create view migtest_e_history6_with_history as select * from migtest_e_history6 union all select * from migtest_e_history6_history; create or replace function migtest_e_history6_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -192,6 +199,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history6_history_upd diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.4__dropsFor_1.3.sql index 784d289fb2..3320cad4ce 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.4__dropsFor_1.3.sql @@ -46,6 +46,7 @@ alter table table_history drop column textfield2; -- apply post alter create view migtest_e_history2_with_history as select * from migtest_e_history2 union all select * from migtest_e_history2_history; create or replace function migtest_e_history2_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -61,6 +62,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history2_history_upd @@ -69,6 +71,7 @@ create trigger migtest_e_history2_history_upd create view migtest_e_history5_with_history as select * from migtest_e_history5 union all select * from migtest_e_history5_history; create or replace function migtest_e_history5_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -84,6 +87,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history5_history_upd @@ -92,6 +96,7 @@ create trigger migtest_e_history5_history_upd create view table_with_history as select * from "table" union all select * from table_history; create or replace function table_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -107,6 +112,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger table_history_upd diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/idx_postgres.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/idx_postgres.migrations index 32b5f08a63..be0f87f332 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/idx_postgres.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/idx_postgres.migrations @@ -1,8 +1,8 @@ --1015076364, 1.0__initial.sql --1624208025, 1.1.sql --261111052, 1.2__dropsFor_1.1.sql --1697064513, 1.3.sql -1188958800, 1.4__dropsFor_1.3.sql +424496268, 1.0__initial.sql +1412926900, 1.1.sql +-328303888, 1.2__dropsFor_1.1.sql +533916041, 1.3.sql +-1371008923, 1.4__dropsFor_1.3.sql 783227075, R__multi_comments.sql 561281075, R__order_views.sql 283077354, R__pg_indexes.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/I__create_procs.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/I__create_procs.sql index af5206c057..7f9f64f9f9 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/I__create_procs.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/I__create_procs.sql @@ -21,7 +21,9 @@ GO -- deletes all indices referring to TABLE.COLUMN -- CREATE OR ALTER PROCEDURE usp_ebean_drop_indices @tableName nvarchar(255), @columnName nvarchar(255) -AS SET NOCOUNT ON +AS +-- play-ebean-start +SET NOCOUNT ON declare @sql nvarchar(1000) declare @indexName nvarchar(255) BEGIN @@ -41,6 +43,7 @@ BEGIN CLOSE index_cursor; DEALLOCATE index_cursor; END +-- play-ebean-end GO -- @@ -48,7 +51,9 @@ GO -- deletes the default constraint, which has a random name -- CREATE OR ALTER PROCEDURE usp_ebean_drop_default_constraint @tableName nvarchar(255), @columnName nvarchar(255) -AS SET NOCOUNT ON +AS +-- play-ebean-start +SET NOCOUNT ON declare @tmp nvarchar(1000) BEGIN select @tmp = t1.name from sys.default_constraints t1 @@ -57,6 +62,7 @@ BEGIN if @tmp is not null EXEC('alter table [' + @tableName +'] drop constraint ' + @tmp); END +-- play-ebean-end GO -- @@ -64,7 +70,9 @@ GO -- deletes constraints and foreign keys refering to TABLE.COLUMN -- CREATE OR ALTER PROCEDURE usp_ebean_drop_constraints @tableName nvarchar(255), @columnName nvarchar(255) -AS SET NOCOUNT ON +AS +-- play-ebean-start +SET NOCOUNT ON declare @sql nvarchar(1000) declare @constraintName nvarchar(255) BEGIN @@ -90,6 +98,7 @@ BEGIN CLOSE name_cursor; DEALLOCATE name_cursor; END +-- play-ebean-end GO -- @@ -97,7 +106,9 @@ GO -- deletes the column annd ensures that all indices and constraints are dropped first -- CREATE OR ALTER PROCEDURE usp_ebean_drop_column @tableName nvarchar(255), @columnName nvarchar(255) -AS SET NOCOUNT ON +AS +-- play-ebean-start +SET NOCOUNT ON declare @sql nvarchar(1000) BEGIN EXEC usp_ebean_drop_indices @tableName, @columnName; @@ -107,4 +118,5 @@ BEGIN set @sql = 'alter table [' + @tableName + '] drop column [' + @columnName + ']'; EXECUTE(@sql); END +-- play-ebean-end GO diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/idx_sqlserver.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/idx_sqlserver.migrations index cd04feee9e..072dfd4a19 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/idx_sqlserver.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/idx_sqlserver.migrations @@ -1,4 +1,4 @@ -891357544, I__create_procs.sql +1076122722, I__create_procs.sql -1455820494, 1.0__initial.sql -2020672101, 1.1.sql -1431095657, 1.2__dropsFor_1.1.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/I__create_procs.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/I__create_procs.sql index af5206c057..7f9f64f9f9 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/I__create_procs.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/I__create_procs.sql @@ -21,7 +21,9 @@ GO -- deletes all indices referring to TABLE.COLUMN -- CREATE OR ALTER PROCEDURE usp_ebean_drop_indices @tableName nvarchar(255), @columnName nvarchar(255) -AS SET NOCOUNT ON +AS +-- play-ebean-start +SET NOCOUNT ON declare @sql nvarchar(1000) declare @indexName nvarchar(255) BEGIN @@ -41,6 +43,7 @@ BEGIN CLOSE index_cursor; DEALLOCATE index_cursor; END +-- play-ebean-end GO -- @@ -48,7 +51,9 @@ GO -- deletes the default constraint, which has a random name -- CREATE OR ALTER PROCEDURE usp_ebean_drop_default_constraint @tableName nvarchar(255), @columnName nvarchar(255) -AS SET NOCOUNT ON +AS +-- play-ebean-start +SET NOCOUNT ON declare @tmp nvarchar(1000) BEGIN select @tmp = t1.name from sys.default_constraints t1 @@ -57,6 +62,7 @@ BEGIN if @tmp is not null EXEC('alter table [' + @tableName +'] drop constraint ' + @tmp); END +-- play-ebean-end GO -- @@ -64,7 +70,9 @@ GO -- deletes constraints and foreign keys refering to TABLE.COLUMN -- CREATE OR ALTER PROCEDURE usp_ebean_drop_constraints @tableName nvarchar(255), @columnName nvarchar(255) -AS SET NOCOUNT ON +AS +-- play-ebean-start +SET NOCOUNT ON declare @sql nvarchar(1000) declare @constraintName nvarchar(255) BEGIN @@ -90,6 +98,7 @@ BEGIN CLOSE name_cursor; DEALLOCATE name_cursor; END +-- play-ebean-end GO -- @@ -97,7 +106,9 @@ GO -- deletes the column annd ensures that all indices and constraints are dropped first -- CREATE OR ALTER PROCEDURE usp_ebean_drop_column @tableName nvarchar(255), @columnName nvarchar(255) -AS SET NOCOUNT ON +AS +-- play-ebean-start +SET NOCOUNT ON declare @sql nvarchar(1000) BEGIN EXEC usp_ebean_drop_indices @tableName, @columnName; @@ -107,4 +118,5 @@ BEGIN set @sql = 'alter table [' + @tableName + '] drop column [' + @columnName + ']'; EXECUTE(@sql); END +-- play-ebean-end GO diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/idx_sqlserver.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/idx_sqlserver.migrations index 2b7496e13e..8845265906 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/idx_sqlserver.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/idx_sqlserver.migrations @@ -1,4 +1,4 @@ -891357544, I__create_procs.sql +1076122722, I__create_procs.sql 1574627056, 1.0__initial.sql 1141454658, 1.1.sql -1431095657, 1.2__dropsFor_1.1.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.0__initial.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.0__initial.sql index 1dbcc0776b..f2ce7feff7 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.0__initial.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.0__initial.sql @@ -204,6 +204,7 @@ create table migtest_e_history2_history( ); create view migtest_e_history2_with_history as select * from migtest_e_history2 union all select * from migtest_e_history2_history; create or replace function migtest_e_history2_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -219,6 +220,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history2_history_upd @@ -233,6 +235,7 @@ create table migtest_e_history3_history( ); create view migtest_e_history3_with_history as select * from migtest_e_history3 union all select * from migtest_e_history3_history; create or replace function migtest_e_history3_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -248,6 +251,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history3_history_upd @@ -262,6 +266,7 @@ create table migtest_e_history4_history( ); create view migtest_e_history4_with_history as select * from migtest_e_history4 union all select * from migtest_e_history4_history; create or replace function migtest_e_history4_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -277,6 +282,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history4_history_upd @@ -291,6 +297,7 @@ create table migtest_e_history5_history( ); create view migtest_e_history5_with_history as select * from migtest_e_history5 union all select * from migtest_e_history5_history; create or replace function migtest_e_history5_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -306,6 +313,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history5_history_upd @@ -321,6 +329,7 @@ create table migtest_e_history6_history( ); create view migtest_e_history6_with_history as select * from migtest_e_history6 union all select * from migtest_e_history6_history; create or replace function migtest_e_history6_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -336,6 +345,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history6_history_upd @@ -354,6 +364,7 @@ create table table_history( ); create view table_with_history as select * from "table" union all select * from table_history; create or replace function table_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -369,6 +380,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger table_history_upd diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.1.sql index c20522fc49..4bad0df524 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.1.sql @@ -254,6 +254,7 @@ create table migtest_e_history_history( ); create view migtest_e_history_with_history as select * from migtest_e_history union all select * from migtest_e_history_history; create or replace function migtest_e_history_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -269,6 +270,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history_history_upd @@ -280,6 +282,7 @@ comment on column migtest_e_history.test_string is 'Column altered to long now'; comment on table migtest_e_history is 'We have history now'; create view migtest_e_history2_with_history as select * from migtest_e_history2 union all select * from migtest_e_history2_history; create or replace function migtest_e_history2_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -295,6 +298,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history2_history_upd @@ -303,6 +307,7 @@ create trigger migtest_e_history2_history_upd create view migtest_e_history3_with_history as select * from migtest_e_history3 union all select * from migtest_e_history3_history; create or replace function migtest_e_history3_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -318,6 +323,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history3_history_upd @@ -326,6 +332,7 @@ create trigger migtest_e_history3_history_upd create view migtest_e_history4_with_history as select * from migtest_e_history4 union all select * from migtest_e_history4_history; create or replace function migtest_e_history4_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -341,6 +348,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history4_history_upd @@ -349,6 +357,7 @@ create trigger migtest_e_history4_history_upd create view migtest_e_history5_with_history as select * from migtest_e_history5 union all select * from migtest_e_history5_history; create or replace function migtest_e_history5_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -364,6 +373,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history5_history_upd @@ -372,6 +382,7 @@ create trigger migtest_e_history5_history_upd create view migtest_e_history6_with_history as select * from migtest_e_history6 union all select * from migtest_e_history6_history; create or replace function migtest_e_history6_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -387,6 +398,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history6_history_upd @@ -396,6 +408,7 @@ create trigger migtest_e_history6_history_upd comment on column "table"."index" is 'this is an other comment'; create view table_with_history as select * from "table" union all select * from table_history; create or replace function table_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -411,6 +424,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger table_history_upd diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.2__dropsFor_1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.2__dropsFor_1.1.sql index 7e6c962280..f89073040b 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.2__dropsFor_1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.2__dropsFor_1.1.sql @@ -16,6 +16,7 @@ alter table migtest_e_history2_history drop column obsolete_string2; -- apply post alter create view migtest_e_history2_with_history as select * from migtest_e_history2 union all select * from migtest_e_history2_history; create or replace function migtest_e_history2_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -31,6 +32,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history2_history_upd diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.3.sql index b62145bd5a..b38d9d771f 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.3.sql @@ -108,6 +108,7 @@ comment on column migtest_e_history.test_string is ''; comment on table migtest_e_history is ''; create view migtest_e_history2_with_history as select * from migtest_e_history2 union all select * from migtest_e_history2_history; create or replace function migtest_e_history2_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -123,6 +124,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history2_history_upd @@ -131,6 +133,7 @@ create trigger migtest_e_history2_history_upd create view migtest_e_history3_with_history as select * from migtest_e_history3 union all select * from migtest_e_history3_history; create or replace function migtest_e_history3_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -146,6 +149,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history3_history_upd @@ -154,6 +158,7 @@ create trigger migtest_e_history3_history_upd create view migtest_e_history4_with_history as select * from migtest_e_history4 union all select * from migtest_e_history4_history; create or replace function migtest_e_history4_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -169,6 +174,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history4_history_upd @@ -177,6 +183,7 @@ create trigger migtest_e_history4_history_upd create view migtest_e_history6_with_history as select * from migtest_e_history6 union all select * from migtest_e_history6_history; create or replace function migtest_e_history6_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -192,6 +199,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history6_history_upd diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.4__dropsFor_1.3.sql index 784d289fb2..3320cad4ce 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.4__dropsFor_1.3.sql @@ -46,6 +46,7 @@ alter table table_history drop column textfield2; -- apply post alter create view migtest_e_history2_with_history as select * from migtest_e_history2 union all select * from migtest_e_history2_history; create or replace function migtest_e_history2_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -61,6 +62,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history2_history_upd @@ -69,6 +71,7 @@ create trigger migtest_e_history2_history_upd create view migtest_e_history5_with_history as select * from migtest_e_history5 union all select * from migtest_e_history5_history; create or replace function migtest_e_history5_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -84,6 +87,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger migtest_e_history5_history_upd @@ -92,6 +96,7 @@ create trigger migtest_e_history5_history_upd create view table_with_history as select * from "table" union all select * from table_history; create or replace function table_history_version() returns trigger as $$ +-- play-ebean-start declare lowerTs timestamptz; upperTs timestamptz; @@ -107,6 +112,7 @@ begin return old; end if; end; +-- play-ebean-end $$ LANGUAGE plpgsql; create trigger table_history_upd diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/idx_yugabyte.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/idx_yugabyte.migrations index 82bd8781ca..7c3c2100e1 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/idx_yugabyte.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/idx_yugabyte.migrations @@ -1,7 +1,7 @@ --1646972843, 1.0__initial.sql --698093883, 1.1.sql --261111052, 1.2__dropsFor_1.1.sql -1532176380, 1.3.sql -1188958800, 1.4__dropsFor_1.3.sql +1940582862, 1.0__initial.sql +300985805, 1.1.sql +-328303888, 1.2__dropsFor_1.1.sql +-2011077112, 1.3.sql +-1371008923, 1.4__dropsFor_1.3.sql 561281075, R__order_views.sql