Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #184 from tesler-platform/feature/tesler-quartz-st…
Browse files Browse the repository at this point in the history
…arter-liquibase-migration

1) liquibase migrations are now included in tesler-starter-quartz
  • Loading branch information
IgorNB authored Aug 24, 2021
2 parents 7ed8237 + e3cbed8 commit 6ef2f7c
Show file tree
Hide file tree
Showing 3 changed files with 152 additions and 1 deletion.
32 changes: 32 additions & 0 deletions tesler-starters/tesler-starter-quartz/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Tesler starter for Quartz

## Prerequisites
Your project uses tesler with tesler-starter-parent, e.g. you have in your pom.xml:
```
<parent>
<groupId>io.tesler</groupId>
<artifactId>tesler-starter-parent</artifactId>
<version>CHANGE_ME</version>
</parent>
```

## Getting started
### Dependency
In your pom.xml add
```
<dependency>
<groupId>io.tesler</groupId>
<artifactId>tesler-starter-quartz</artifactId>
</dependency>
```
### Liquibase migrations

In your liquibase change log check following line is included:

```
<include file="classpath:io/tesler/db/changelog/quartz/tesler-starter-quartz.xml" relativeToChangelogFile="false"/>
```

### (Optional) Liquibase migrations
Alternatively one can copy Liquibase migrations files directly to project

5 changes: 4 additions & 1 deletion tesler-starters/tesler-starter-quartz/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@
</properties>

<dependencies>

<dependency>
<groupId>io.tesler</groupId>
<artifactId>tesler-core</artifactId>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
</dependency>
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.3.xsd"
logicalFilePath="io/tesler/db/changelog/quartz/tesler-starter-quartz.xml">

<include file="classpath:/org/quartz/impl/jdbcjobstore/liquibase.quartz.init.xml" relativeToChangelogFile="false"/>

<changeSet author="initial" id="SCHEDULED_JOB TABLE">
<createTable tableName="SCHEDULED_JOB">
<column name="ID" remarks="Суррогатный идентификатор" type="NUMBER(19, 0)">
<constraints primaryKey="true" primaryKeyName="SCHEDULED_JOB_PK"/>
</column>
<column name="SERVICE_NAME" remarks="Название сервиса" type="VARCHAR2(255)"/>
<column name="CRON_EXPRESSION" remarks="Расписание" type="VARCHAR2(255)"/>
<column defaultValueNumeric="0" name="ACTIVE_FLAG" remarks="Признак активности" type="BOOLEAN">
<constraints nullable="false"/>
</column>
<column defaultValueNumeric="0" name="SYSTEM_FLAG" remarks="Признак системного задания" type="BOOLEAN">
<constraints nullable="false"/>
</column>
<column defaultValueNumeric="0" name="LAUNCH_ON_CREATE" remarks="Запускать сразу после создания"
type="BOOLEAN">
<constraints nullable="false"/>
</column>
<column name="LAST_LAUNCH_STATUS_CD" remarks="Статус последнего запуска" type="VARCHAR2(255)"/>
<column name="LAST_LAUNCH_DATE" remarks="Дата последнего запуска" type="TIMESTAMP(6)"/>
<column name="LAST_LAUNCH_CNT" remarks="Кол-во попыток последнего запуска" type="NUMBER(19, 0)"/>
<column defaultValueNumeric="0" name="LAUNCH_CNT" remarks="Кол-во запусков" type="NUMBER(19, 0)">
<constraints nullable="false"/>
</column>
<column defaultValueNumeric="0" name="LAUNCH_FAILED_CNT" remarks="Кол-во запусков с ошибкой"
type="NUMBER(19, 0)">
<constraints nullable="false"/>
</column>
<column defaultValueNumeric="0" name="LAUNCH_FAILED_LAST_CNT"
remarks="Кол-во запусков с ошибкой с момента последнего успешного" type="NUMBER(19, 0)">
<constraints nullable="false"/>
</column>
<column name="LAST_SUCCESS_LAUNCH_DURATION" remarks="Длительность последнего успешного запуска"
type="NUMBER(19, 0)"/>
<column defaultValueComputed="current_timestamp" name="CREATED_DATE" type="TIMESTAMP(6)">
<constraints nullable="false"/>
</column>
<column defaultValueComputed="current_timestamp" name="UPDATED_DATE" type="TIMESTAMP(6)">
<constraints nullable="false"/>
</column>
<column defaultValueNumeric="1" name="CREATED_BY_USER_ID" type="NUMBER(19, 0)">
<constraints nullable="false"/>
</column>
<column defaultValueNumeric="1" name="LAST_UPD_BY_USER_ID" type="NUMBER(19, 0)">
<constraints nullable="false"/>
</column>
<column name="LAST_SUCCESS_LAUNCH_DATE" remarks="Дата последнего успешного запуска" type="TIMESTAMP(6)"/>
<column defaultValueNumeric="0" name="VSTAMP" type="NUMBER(19, 0)">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
<changeSet author="initial" id="SCHEDULED_JOB_PARAM TABLE">
<createTable remarks="Параметры запуска фонового задания" tableName="SCHEDULED_JOB_PARAM">
<column name="ID" remarks="Индентификатор" type="NUMBER(19, 0)">
<constraints primaryKey="true" primaryKeyName="PK_SCHEDULED_JOB_PARAM"/>
</column>
<column name="SCHEDULED_JOB_ID" remarks="Идентификатор фонового задания" type="NUMBER(19, 0)">
<constraints nullable="false"/>
</column>
<column name="PARAM_NAME" remarks="Название параметра" type="VARCHAR2(255)"/>
<column name="PARAM_VALUE" remarks="Значение параметра" type="VARCHAR2(255)"/>
<column defaultValueComputed="current_timestamp" name="CREATED_DATE" remarks="Дата создания"
type="TIMESTAMP(6)">
<constraints nullable="false"/>
</column>
<column defaultValueComputed="current_timestamp" name="UPDATED_DATE" remarks="Дата изменения"
type="TIMESTAMP(6)">
<constraints nullable="false"/>
</column>
<column defaultValueNumeric="1" name="CREATED_BY_USER_ID" remarks="Кто создал" type="NUMBER(19, 0)">
<constraints nullable="false"/>
</column>
<column defaultValueNumeric="1" name="LAST_UPD_BY_USER_ID" remarks="Кто изменил" type="NUMBER(19, 0)">
<constraints nullable="false"/>
</column>
<column defaultValueNumeric="0" name="VSTAMP" type="NUMBER(19, 0)">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>

<changeSet author="initial" id="SCHEDULED_JOB_PARAM CONSTRAINTS">
<addForeignKeyConstraint baseColumnNames="CREATED_BY_USER_ID" baseTableName="SCHEDULED_JOB_PARAM"
constraintName="FK_JOB_PARAM_CREATED_BY" deferrable="false" initiallyDeferred="false"
onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="ID"
referencedTableName="USERS" validate="true"/>
<addForeignKeyConstraint baseColumnNames="LAST_UPD_BY_USER_ID" baseTableName="SCHEDULED_JOB_PARAM"
constraintName="FK_JOB_PARAM_UPDATED_BY" deferrable="false" initiallyDeferred="false"
onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="ID"
referencedTableName="USERS" validate="true"/>
<addForeignKeyConstraint baseColumnNames="SCHEDULED_JOB_ID" baseTableName="SCHEDULED_JOB_PARAM"
constraintName="FK_SCHEDULED_JOB_ARG" deferrable="false" initiallyDeferred="false"
onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="ID"
referencedTableName="SCHEDULED_JOB" validate="true"/>
</changeSet>

<changeSet author="initial" id="SCHEDULED_JOB CONSTRAINTS">
<addForeignKeyConstraint baseColumnNames="CREATED_BY_USER_ID" baseTableName="SCHEDULED_JOB"
constraintName="FK_SCHEDULED_JOB_CREATED_BY" deferrable="false"
initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT"
referencedColumnNames="ID" referencedTableName="USERS" validate="true"/>
<addForeignKeyConstraint baseColumnNames="LAST_UPD_BY_USER_ID" baseTableName="SCHEDULED_JOB"
constraintName="FK_SCHEDULED_JOB_UPDATED_BY" deferrable="false"
initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT"
referencedColumnNames="ID" referencedTableName="USERS" validate="true"/>
</changeSet>

</databaseChangeLog>

0 comments on commit 6ef2f7c

Please sign in to comment.