Skip to content

Commit

Permalink
feat: refactoring liquibase scripts (#2)
Browse files Browse the repository at this point in the history
* fix: update liquibase xsd

* feat: refactoring liquibase scripts
  • Loading branch information
andrejpetras authored Aug 22, 2023
1 parent 5708fde commit f90e710
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 161 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public class ApplicationParameterDataImportService implements DataImportService
@Override
@Transactional(Transactional.TxType.REQUIRES_NEW)
public void importData(DataImportConfig config) {
log.info("Import parameters from configuration {}", config);
try {
String operation = config.getMetadata().getOrDefault("operation", "NONE");

Expand Down
7 changes: 1 addition & 6 deletions src/main/resources/db/changeLog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@
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-3.1.xsd">
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">

<include relativeToChangelogFile="true" file="createTables.xml"/>
<include relativeToChangelogFile="true" file="createApplicationParametersTable.xml"/>
<include relativeToChangelogFile="true" file="data-import-tables.xml"/>
<include relativeToChangelogFile="true" file="refactoring-model.xml"/>
<include relativeToChangelogFile="true" file="job-table.xml"/>
<include relativeToChangelogFile="true" file="createApplicationParameterDataTable.xml"/>
</databaseChangeLog>
22 changes: 0 additions & 22 deletions src/main/resources/db/createApplicationParameterDataTable.xml

This file was deleted.

32 changes: 0 additions & 32 deletions src/main/resources/db/createApplicationParametersTable.xml

This file was deleted.

81 changes: 73 additions & 8 deletions src/main/resources/db/createTables.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:pro="http://www.liquibase.org/xml/ns/pro" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-3.8.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd">
<changeSet author="dev (generated)" id="1605788432439-1">
<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-latest.xsd"
objectQuotingStrategy="QUOTE_ONLY_RESERVED_WORDS">

<changeSet author="dev (generated)" id="create-tables">
<createTable tableName="apm_app_param">
<column name="guid" type="VARCHAR(255)">
<constraints nullable="false" primaryKey="true" primaryKeyName="apm_app_param_pkey"/>
Expand All @@ -16,15 +20,76 @@
<column name="param_description" type="VARCHAR(255)"/>
<column name="param_key" type="VARCHAR(255)"/>
<column name="param_name" type="VARCHAR(255)"/>
<column name="role_type" type="VARCHAR(255)"/>
<column name="param_type" type="VARCHAR(255)"/>
<column name="param_unit" type="VARCHAR(255)"/>
<column name="param_value" type="VARCHAR(255)"/>
<column name="import_value" type="VARCHAR(255)"/>
<column name="set_value" type="VARCHAR(255)"/>
<column name="value_type" type="VARCHAR(255)"/>
</createTable>
<createTable tableName="apm_app_param_data">
<column name="guid" type="VARCHAR(255)">
<constraints nullable="false" primaryKey="true" primaryKeyName="apm_app_param_data_pkey"/>
</column>
<column name="parameter_guid" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="range_from" type="INTEGER"/>
<column name="range_to" type="INTEGER"/>
<column name="unit" type="VARCHAR(255)"/>
</createTable>
<createTable tableName="apm_app_param_history">
<column name="guid" type="VARCHAR(255)">
<constraints nullable="false" primaryKey="true" primaryKeyName="apm_app_param_history_pkey"/>
</column>
<column name="creationdate" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="creationuser" type="VARCHAR(255)"/>
<column name="modificationdate" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="modificationuser" type="VARCHAR(255)"/>
<column name="optlock" type="INTEGER">
<constraints nullable="false"/>
</column>
<column name="application_id" type="VARCHAR(255)"/>
<column name="count" type="BIGINT"/>
<column name="default_value" type="VARCHAR(255)"/>
<column name="interval_end" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="instance_id" type="VARCHAR(255)"/>
<column name="param_key" type="VARCHAR(255)"/>
<column name="interval_start" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="value_type" type="VARCHAR(255)"/>
<column name="used_value" type="VARCHAR(255)"/>
</createTable>
<createTable tableName="apm_job">
<column name="guid" type="VARCHAR(255)">
<constraints nullable="false" primaryKey="true" primaryKeyName="apm_job_pkey"/>
</column>
<column name="creationdate" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="creationuser" type="VARCHAR(255)"/>
<column name="modificationdate" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="modificationuser" type="VARCHAR(255)"/>
<column name="optlock" type="INTEGER">
<constraints nullable="false"/>
</column>
</createTable>
<insert tableName="apm_job">
<column name="guid" value="maintenance.history"/>
<column name="optlock" value="1"/>
</insert>
</changeSet>

<changeSet author="dev (generated)" id="create-constraints">
<addUniqueConstraint columnNames="application_id, param_key" constraintName="app_id_param_key" tableName="apm_app_param"/>
<addUniqueConstraint columnNames="parameter_guid" constraintName="param_guid" tableName="apm_app_param_data"/>
</changeSet>
<changeSet author="dev (generated)" id="1605788432439-2">
<addUniqueConstraint columnNames="application_id, param_key" constraintName="ukdaqlpysgk1bxwt2xuqd3w1qh" tableName="apm_app_param"/>

<changeSet author="dev (generated)" id="create-data-import-log">
<createTable tableName="dataimportlog">
<column name="id" type="VARCHAR(255)">
<constraints nullable="false" primaryKey="true" primaryKeyName="dataimportlog_pkey"/>
</column>
<column name="creationdate" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="modificationdate" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="file" type="VARCHAR(255)"/>
<column name="md5" type="VARCHAR(255)"/>
<column name="error" type="VARCHAR(255)"/>
</createTable>
</changeSet>

</databaseChangeLog>
20 changes: 0 additions & 20 deletions src/main/resources/db/data-import-tables.xml

This file was deleted.

27 changes: 0 additions & 27 deletions src/main/resources/db/job-table.xml

This file was deleted.

46 changes: 0 additions & 46 deletions src/main/resources/db/refactoring-model.xml

This file was deleted.

0 comments on commit f90e710

Please sign in to comment.