diff --git a/spring-cloud-dataflow-server-core/src/main/java/org/springframework/cloud/dataflow/server/db/migration/AbstractAggregateContextViewMigration.java b/spring-cloud-dataflow-server-core/src/main/java/org/springframework/cloud/dataflow/server/db/migration/AbstractAggregateContextViewMigration.java new file mode 100644 index 0000000000..e839d25629 --- /dev/null +++ b/spring-cloud-dataflow-server-core/src/main/java/org/springframework/cloud/dataflow/server/db/migration/AbstractAggregateContextViewMigration.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.cloud.dataflow.server.db.migration; + +import org.springframework.cloud.dataflow.common.flyway.AbstractMigration; +import org.springframework.cloud.dataflow.common.flyway.SqlCommand; + +import java.util.Arrays; +import java.util.List; + +public abstract class AbstractAggregateContextViewMigration extends AbstractMigration { + public AbstractAggregateContextViewMigration() { + super(null); + } + + public final static String CREATE_AGGREGATE_JOB_EXECUTION_CONTEXT_VIEW = "CREATE VIEW AGGREGATE_JOB_EXECUTION_CONTEXT AS\n" + + " SELECT JOB_EXECUTION_ID, SHORT_CONTEXT, SERIALIZED_CONTEXT, 'boot2' AS SCHEMA_TARGET FROM BATCH_JOB_EXECUTION_CONTEXT\n" + + "UNION ALL\n" + + " SELECT JOB_EXECUTION_ID, SHORT_CONTEXT, SERIALIZED_CONTEXT, 'boot3' AS SCHEMA_TARGET FROM BOOT3_BATCH_JOB_EXECUTION_CONTEXT"; + + public final static String CREATE_AGGREGATE_STEP_EXECUTION_CONTEXT_VIEW = "CREATE VIEW AGGREGATE_STEP_EXECUTION_CONTEXT AS\n" + + " SELECT STEP_EXECUTION_ID, SHORT_CONTEXT, SERIALIZED_CONTEXT, 'boot2' AS SCHEMA_TARGET FROM BATCH_STEP_EXECUTION_CONTEXT\n" + + "UNION ALL\n" + + " SELECT STEP_EXECUTION_ID, SHORT_CONTEXT, SERIALIZED_CONTEXT, 'boot3' AS SCHEMA_TARGET FROM BOOT3_BATCH_STEP_EXECUTION_CONTEXT"; + + @Override + public List getCommands() { + return Arrays.asList( + SqlCommand.from(CREATE_AGGREGATE_JOB_EXECUTION_CONTEXT_VIEW), + SqlCommand.from(CREATE_AGGREGATE_STEP_EXECUTION_CONTEXT_VIEW) + ); + } +} diff --git a/spring-cloud-dataflow-server-core/src/main/java/org/springframework/cloud/dataflow/server/db/migration/db2/V10__AggregateContextView.java b/spring-cloud-dataflow-server-core/src/main/java/org/springframework/cloud/dataflow/server/db/migration/db2/V10__AggregateContextView.java new file mode 100644 index 0000000000..baef2c83e0 --- /dev/null +++ b/spring-cloud-dataflow-server-core/src/main/java/org/springframework/cloud/dataflow/server/db/migration/db2/V10__AggregateContextView.java @@ -0,0 +1,6 @@ +package org.springframework.cloud.dataflow.server.db.migration.db2; + +import org.springframework.cloud.dataflow.server.db.migration.AbstractAggregateContextViewMigration; + +public class V10__AggregateContextView extends AbstractAggregateContextViewMigration { +} diff --git a/spring-cloud-dataflow-server-core/src/main/java/org/springframework/cloud/dataflow/server/db/migration/mariadb/V11__AggregateContextView.java b/spring-cloud-dataflow-server-core/src/main/java/org/springframework/cloud/dataflow/server/db/migration/mariadb/V11__AggregateContextView.java new file mode 100644 index 0000000000..13ce671ef2 --- /dev/null +++ b/spring-cloud-dataflow-server-core/src/main/java/org/springframework/cloud/dataflow/server/db/migration/mariadb/V11__AggregateContextView.java @@ -0,0 +1,6 @@ +package org.springframework.cloud.dataflow.server.db.migration.mariadb; + +import org.springframework.cloud.dataflow.server.db.migration.AbstractAggregateContextViewMigration; + +public class V11__AggregateContextView extends AbstractAggregateContextViewMigration { +} diff --git a/spring-cloud-dataflow-server-core/src/main/java/org/springframework/cloud/dataflow/server/db/migration/mysql/V11__AggregateContextView.java b/spring-cloud-dataflow-server-core/src/main/java/org/springframework/cloud/dataflow/server/db/migration/mysql/V11__AggregateContextView.java new file mode 100644 index 0000000000..d75156e661 --- /dev/null +++ b/spring-cloud-dataflow-server-core/src/main/java/org/springframework/cloud/dataflow/server/db/migration/mysql/V11__AggregateContextView.java @@ -0,0 +1,6 @@ +package org.springframework.cloud.dataflow.server.db.migration.mysql; + +import org.springframework.cloud.dataflow.server.db.migration.AbstractAggregateContextViewMigration; + +public class V11__AggregateContextView extends AbstractAggregateContextViewMigration { +} diff --git a/spring-cloud-dataflow-server-core/src/main/java/org/springframework/cloud/dataflow/server/db/migration/oracle/V11__AggregateContextView.java b/spring-cloud-dataflow-server-core/src/main/java/org/springframework/cloud/dataflow/server/db/migration/oracle/V11__AggregateContextView.java new file mode 100644 index 0000000000..ee7734ba6e --- /dev/null +++ b/spring-cloud-dataflow-server-core/src/main/java/org/springframework/cloud/dataflow/server/db/migration/oracle/V11__AggregateContextView.java @@ -0,0 +1,6 @@ +package org.springframework.cloud.dataflow.server.db.migration.oracle; + +import org.springframework.cloud.dataflow.server.db.migration.AbstractAggregateContextViewMigration; + +public class V11__AggregateContextView extends AbstractAggregateContextViewMigration { +} diff --git a/spring-cloud-dataflow-server-core/src/main/java/org/springframework/cloud/dataflow/server/db/migration/postgresql/V12__AggregateContextView.java b/spring-cloud-dataflow-server-core/src/main/java/org/springframework/cloud/dataflow/server/db/migration/postgresql/V12__AggregateContextView.java new file mode 100644 index 0000000000..2a82381afb --- /dev/null +++ b/spring-cloud-dataflow-server-core/src/main/java/org/springframework/cloud/dataflow/server/db/migration/postgresql/V12__AggregateContextView.java @@ -0,0 +1,6 @@ +package org.springframework.cloud.dataflow.server.db.migration.postgresql; + +import org.springframework.cloud.dataflow.server.db.migration.AbstractAggregateContextViewMigration; + +public class V12__AggregateContextView extends AbstractAggregateContextViewMigration { +} diff --git a/spring-cloud-dataflow-server-core/src/main/java/org/springframework/cloud/dataflow/server/db/migration/sqlserver/V10__AggregateContextView.java b/spring-cloud-dataflow-server-core/src/main/java/org/springframework/cloud/dataflow/server/db/migration/sqlserver/V10__AggregateContextView.java new file mode 100644 index 0000000000..d103a68407 --- /dev/null +++ b/spring-cloud-dataflow-server-core/src/main/java/org/springframework/cloud/dataflow/server/db/migration/sqlserver/V10__AggregateContextView.java @@ -0,0 +1,6 @@ +package org.springframework.cloud.dataflow.server.db.migration.sqlserver; + +import org.springframework.cloud.dataflow.server.db.migration.AbstractAggregateContextViewMigration; + +public class V10__AggregateContextView extends AbstractAggregateContextViewMigration { +} diff --git a/spring-cloud-dataflow-server-core/src/main/resources/application-init-db2.yml b/spring-cloud-dataflow-server-core/src/main/resources/application-init-db2.yml index 11fbef17f4..5d52e1d80b 100644 --- a/spring-cloud-dataflow-server-core/src/main/resources/application-init-db2.yml +++ b/spring-cloud-dataflow-server-core/src/main/resources/application-init-db2.yml @@ -15,3 +15,4 @@ spring: - classpath*:/schemas/db2/V6-dataflow.sql - classpath*:/schemas/db2/V7-dataflow.sql - classpath*:/schemas/db2/V8-dataflow.sql + - classpath*:/schemas/db2/V9-dataflow.sql diff --git a/spring-cloud-dataflow-server-core/src/main/resources/application-init-mariadb.yml b/spring-cloud-dataflow-server-core/src/main/resources/application-init-mariadb.yml index 5c90c3e277..3704de3611 100644 --- a/spring-cloud-dataflow-server-core/src/main/resources/application-init-mariadb.yml +++ b/spring-cloud-dataflow-server-core/src/main/resources/application-init-mariadb.yml @@ -14,5 +14,7 @@ spring: - classpath*:/schemas/mariadb/V5-dataflow.sql - classpath*:/schemas/mariadb/V6-dataflow.sql - classpath*:/schemas/mariadb/V7-dataflow.sql + - classpath*:/schemas/mariadb/V8-dataflow.sql - classpath*:/schemas/mariadb/V9-dataflow.sql - - classpath*:/schemas/mariadb/V8-dataflow.sql \ No newline at end of file + - classpath*:/schemas/mariadb/V10-dataflow.sql + - classpath*:/schemas/mariadb/V11-dataflow.sql \ No newline at end of file diff --git a/spring-cloud-dataflow-server-core/src/main/resources/application-init-oracle.yml b/spring-cloud-dataflow-server-core/src/main/resources/application-init-oracle.yml index b0898e3e04..265270003a 100644 --- a/spring-cloud-dataflow-server-core/src/main/resources/application-init-oracle.yml +++ b/spring-cloud-dataflow-server-core/src/main/resources/application-init-oracle.yml @@ -15,3 +15,4 @@ spring: - classpath*:/schemas/oracle/V6-dataflow.sql - classpath*:/schemas/oracle/V7-dataflow.sql - classpath*:/schemas/oracle/V8-dataflow.sql + - classpath*:/schemas/oracle/V9-dataflow.sql diff --git a/spring-cloud-dataflow-server-core/src/main/resources/application-init-postgresql.yml b/spring-cloud-dataflow-server-core/src/main/resources/application-init-postgresql.yml index 2c19e0fbd5..4d386aba29 100644 --- a/spring-cloud-dataflow-server-core/src/main/resources/application-init-postgresql.yml +++ b/spring-cloud-dataflow-server-core/src/main/resources/application-init-postgresql.yml @@ -15,4 +15,5 @@ spring: - classpath*:/schemas/postgresql/V6-dataflow.sql - classpath*:/schemas/postgresql/V7-dataflow.sql - classpath*:/schemas/postgresql/V8-dataflow.sql - - classpath*:/schemas/postgresql/V9-dataflow.sql \ No newline at end of file + - classpath*:/schemas/postgresql/V9-dataflow.sql + - classpath*:/schemas/postgresql/V10-dataflow.sql \ No newline at end of file diff --git a/spring-cloud-dataflow-server-core/src/main/resources/application-init-sqlserver.yml b/spring-cloud-dataflow-server-core/src/main/resources/application-init-sqlserver.yml index 4da96b21e9..cd2a7f46da 100644 --- a/spring-cloud-dataflow-server-core/src/main/resources/application-init-sqlserver.yml +++ b/spring-cloud-dataflow-server-core/src/main/resources/application-init-sqlserver.yml @@ -16,3 +16,4 @@ spring: - classpath*:/schemas/sqlserver/V6-dataflow.sql - classpath*:/schemas/sqlserver/V7-dataflow.sql - classpath*:/schemas/sqlserver/V8-dataflow.sql + - classpath*:/schemas/sqlserver/V9-dataflow.sql diff --git a/spring-cloud-dataflow-server-core/src/main/resources/org/springframework/cloud/dataflow/server/db/migration/h2/V1__INITIAL_SETUP.sql b/spring-cloud-dataflow-server-core/src/main/resources/org/springframework/cloud/dataflow/server/db/migration/h2/V1__INITIAL_SETUP.sql index 38c633fc0b..8301256d77 100644 --- a/spring-cloud-dataflow-server-core/src/main/resources/org/springframework/cloud/dataflow/server/db/migration/h2/V1__INITIAL_SETUP.sql +++ b/spring-cloud-dataflow-server-core/src/main/resources/org/springframework/cloud/dataflow/server/db/migration/h2/V1__INITIAL_SETUP.sql @@ -337,6 +337,16 @@ CREATE VIEW AGGREGATE_STEP_EXECUTION AS UNION ALL SELECT STEP_EXECUTION_ID, VERSION, STEP_NAME, JOB_EXECUTION_ID, START_TIME, END_TIME, STATUS, COMMIT_COUNT, READ_COUNT, FILTER_COUNT, WRITE_COUNT, READ_SKIP_COUNT, WRITE_SKIP_COUNT, PROCESS_SKIP_COUNT, ROLLBACK_COUNT, EXIT_CODE, EXIT_MESSAGE, LAST_UPDATED, 'boot3' AS SCHEMA_TARGET FROM BOOT3_BATCH_STEP_EXECUTION; +CREATE VIEW AGGREGATE_JOB_EXECUTION_CONTEXT AS + SELECT JOB_EXECUTION_ID, SHORT_CONTEXT, SERIALIZED_CONTEXT, 'boot2' AS SCHEMA_TARGET FROM BATCH_JOB_EXECUTION_CONTEXT +UNION ALL + SELECT JOB_EXECUTION_ID, SHORT_CONTEXT, SERIALIZED_CONTEXT, 'boot3' AS SCHEMA_TARGET FROM BOOT3_BATCH_JOB_EXECUTION_CONTEXT; + +CREATE VIEW AGGREGATE_STEP_EXECUTION_CONTEXT AS + SELECT STEP_EXECUTION_ID, SHORT_CONTEXT, SERIALIZED_CONTEXT, 'boot2' AS SCHEMA_TARGET FROM BATCH_STEP_EXECUTION_CONTEXT +UNION ALL + SELECT STEP_EXECUTION_ID, SHORT_CONTEXT, SERIALIZED_CONTEXT, 'boot3' AS SCHEMA_TARGET FROM BOOT3_BATCH_STEP_EXECUTION_CONTEXT; + ALTER TABLE task_execution_metadata RENAME TO task_execution_metadata_lc; ALTER TABLE task_execution_metadata_lc RENAME TO TASK_EXECUTION_METADATA; CREATE SEQUENCE task_execution_metadata_seq_lc; diff --git a/spring-cloud-dataflow-server-core/src/main/resources/schemas/db2/V9-dataflow.sql b/spring-cloud-dataflow-server-core/src/main/resources/schemas/db2/V9-dataflow.sql new file mode 100644 index 0000000000..09d5f51d68 --- /dev/null +++ b/spring-cloud-dataflow-server-core/src/main/resources/schemas/db2/V9-dataflow.sql @@ -0,0 +1,9 @@ +CREATE VIEW AGGREGATE_JOB_EXECUTION_CONTEXT AS + SELECT JOB_EXECUTION_ID, SHORT_CONTEXT, SERIALIZED_CONTEXT, 'boot2' AS SCHEMA_TARGET FROM BATCH_JOB_EXECUTION_CONTEXT +UNION ALL + SELECT JOB_EXECUTION_ID, SHORT_CONTEXT, SERIALIZED_CONTEXT, 'boot3' AS SCHEMA_TARGET FROM BOOT3_BATCH_JOB_EXECUTION_CONTEXT; + +CREATE VIEW AGGREGATE_STEP_EXECUTION_CONTEXT AS + SELECT STEP_EXECUTION_ID, SHORT_CONTEXT, SERIALIZED_CONTEXT, 'boot2' AS SCHEMA_TARGET FROM BATCH_STEP_EXECUTION_CONTEXT +UNION ALL + SELECT STEP_EXECUTION_ID, SHORT_CONTEXT, SERIALIZED_CONTEXT, 'boot3' AS SCHEMA_TARGET FROM BOOT3_BATCH_STEP_EXECUTION_CONTEXT; \ No newline at end of file diff --git a/spring-cloud-dataflow-server-core/src/main/resources/schemas/mariadb/V11-dataflow.sql b/spring-cloud-dataflow-server-core/src/main/resources/schemas/mariadb/V11-dataflow.sql new file mode 100644 index 0000000000..09d5f51d68 --- /dev/null +++ b/spring-cloud-dataflow-server-core/src/main/resources/schemas/mariadb/V11-dataflow.sql @@ -0,0 +1,9 @@ +CREATE VIEW AGGREGATE_JOB_EXECUTION_CONTEXT AS + SELECT JOB_EXECUTION_ID, SHORT_CONTEXT, SERIALIZED_CONTEXT, 'boot2' AS SCHEMA_TARGET FROM BATCH_JOB_EXECUTION_CONTEXT +UNION ALL + SELECT JOB_EXECUTION_ID, SHORT_CONTEXT, SERIALIZED_CONTEXT, 'boot3' AS SCHEMA_TARGET FROM BOOT3_BATCH_JOB_EXECUTION_CONTEXT; + +CREATE VIEW AGGREGATE_STEP_EXECUTION_CONTEXT AS + SELECT STEP_EXECUTION_ID, SHORT_CONTEXT, SERIALIZED_CONTEXT, 'boot2' AS SCHEMA_TARGET FROM BATCH_STEP_EXECUTION_CONTEXT +UNION ALL + SELECT STEP_EXECUTION_ID, SHORT_CONTEXT, SERIALIZED_CONTEXT, 'boot3' AS SCHEMA_TARGET FROM BOOT3_BATCH_STEP_EXECUTION_CONTEXT; \ No newline at end of file diff --git a/spring-cloud-dataflow-server-core/src/main/resources/schemas/mysql/V10-dataflow.sql b/spring-cloud-dataflow-server-core/src/main/resources/schemas/mysql/V10-dataflow.sql new file mode 100644 index 0000000000..09d5f51d68 --- /dev/null +++ b/spring-cloud-dataflow-server-core/src/main/resources/schemas/mysql/V10-dataflow.sql @@ -0,0 +1,9 @@ +CREATE VIEW AGGREGATE_JOB_EXECUTION_CONTEXT AS + SELECT JOB_EXECUTION_ID, SHORT_CONTEXT, SERIALIZED_CONTEXT, 'boot2' AS SCHEMA_TARGET FROM BATCH_JOB_EXECUTION_CONTEXT +UNION ALL + SELECT JOB_EXECUTION_ID, SHORT_CONTEXT, SERIALIZED_CONTEXT, 'boot3' AS SCHEMA_TARGET FROM BOOT3_BATCH_JOB_EXECUTION_CONTEXT; + +CREATE VIEW AGGREGATE_STEP_EXECUTION_CONTEXT AS + SELECT STEP_EXECUTION_ID, SHORT_CONTEXT, SERIALIZED_CONTEXT, 'boot2' AS SCHEMA_TARGET FROM BATCH_STEP_EXECUTION_CONTEXT +UNION ALL + SELECT STEP_EXECUTION_ID, SHORT_CONTEXT, SERIALIZED_CONTEXT, 'boot3' AS SCHEMA_TARGET FROM BOOT3_BATCH_STEP_EXECUTION_CONTEXT; \ No newline at end of file diff --git a/spring-cloud-dataflow-server-core/src/main/resources/schemas/oracle/V9-dataflow.sql b/spring-cloud-dataflow-server-core/src/main/resources/schemas/oracle/V9-dataflow.sql new file mode 100644 index 0000000000..09d5f51d68 --- /dev/null +++ b/spring-cloud-dataflow-server-core/src/main/resources/schemas/oracle/V9-dataflow.sql @@ -0,0 +1,9 @@ +CREATE VIEW AGGREGATE_JOB_EXECUTION_CONTEXT AS + SELECT JOB_EXECUTION_ID, SHORT_CONTEXT, SERIALIZED_CONTEXT, 'boot2' AS SCHEMA_TARGET FROM BATCH_JOB_EXECUTION_CONTEXT +UNION ALL + SELECT JOB_EXECUTION_ID, SHORT_CONTEXT, SERIALIZED_CONTEXT, 'boot3' AS SCHEMA_TARGET FROM BOOT3_BATCH_JOB_EXECUTION_CONTEXT; + +CREATE VIEW AGGREGATE_STEP_EXECUTION_CONTEXT AS + SELECT STEP_EXECUTION_ID, SHORT_CONTEXT, SERIALIZED_CONTEXT, 'boot2' AS SCHEMA_TARGET FROM BATCH_STEP_EXECUTION_CONTEXT +UNION ALL + SELECT STEP_EXECUTION_ID, SHORT_CONTEXT, SERIALIZED_CONTEXT, 'boot3' AS SCHEMA_TARGET FROM BOOT3_BATCH_STEP_EXECUTION_CONTEXT; \ No newline at end of file diff --git a/spring-cloud-dataflow-server-core/src/main/resources/schemas/postgresql/V10-dataflow.sql b/spring-cloud-dataflow-server-core/src/main/resources/schemas/postgresql/V10-dataflow.sql new file mode 100644 index 0000000000..09d5f51d68 --- /dev/null +++ b/spring-cloud-dataflow-server-core/src/main/resources/schemas/postgresql/V10-dataflow.sql @@ -0,0 +1,9 @@ +CREATE VIEW AGGREGATE_JOB_EXECUTION_CONTEXT AS + SELECT JOB_EXECUTION_ID, SHORT_CONTEXT, SERIALIZED_CONTEXT, 'boot2' AS SCHEMA_TARGET FROM BATCH_JOB_EXECUTION_CONTEXT +UNION ALL + SELECT JOB_EXECUTION_ID, SHORT_CONTEXT, SERIALIZED_CONTEXT, 'boot3' AS SCHEMA_TARGET FROM BOOT3_BATCH_JOB_EXECUTION_CONTEXT; + +CREATE VIEW AGGREGATE_STEP_EXECUTION_CONTEXT AS + SELECT STEP_EXECUTION_ID, SHORT_CONTEXT, SERIALIZED_CONTEXT, 'boot2' AS SCHEMA_TARGET FROM BATCH_STEP_EXECUTION_CONTEXT +UNION ALL + SELECT STEP_EXECUTION_ID, SHORT_CONTEXT, SERIALIZED_CONTEXT, 'boot3' AS SCHEMA_TARGET FROM BOOT3_BATCH_STEP_EXECUTION_CONTEXT; \ No newline at end of file diff --git a/spring-cloud-dataflow-server-core/src/main/resources/schemas/sqlserver/V9-dataflow.sql b/spring-cloud-dataflow-server-core/src/main/resources/schemas/sqlserver/V9-dataflow.sql new file mode 100644 index 0000000000..09d5f51d68 --- /dev/null +++ b/spring-cloud-dataflow-server-core/src/main/resources/schemas/sqlserver/V9-dataflow.sql @@ -0,0 +1,9 @@ +CREATE VIEW AGGREGATE_JOB_EXECUTION_CONTEXT AS + SELECT JOB_EXECUTION_ID, SHORT_CONTEXT, SERIALIZED_CONTEXT, 'boot2' AS SCHEMA_TARGET FROM BATCH_JOB_EXECUTION_CONTEXT +UNION ALL + SELECT JOB_EXECUTION_ID, SHORT_CONTEXT, SERIALIZED_CONTEXT, 'boot3' AS SCHEMA_TARGET FROM BOOT3_BATCH_JOB_EXECUTION_CONTEXT; + +CREATE VIEW AGGREGATE_STEP_EXECUTION_CONTEXT AS + SELECT STEP_EXECUTION_ID, SHORT_CONTEXT, SERIALIZED_CONTEXT, 'boot2' AS SCHEMA_TARGET FROM BATCH_STEP_EXECUTION_CONTEXT +UNION ALL + SELECT STEP_EXECUTION_ID, SHORT_CONTEXT, SERIALIZED_CONTEXT, 'boot3' AS SCHEMA_TARGET FROM BOOT3_BATCH_STEP_EXECUTION_CONTEXT; \ No newline at end of file