Commit c89a79d7 authored by Jürgen Hannus's avatar Jürgen Hannus
Browse files

Merge branch 'develop' into 'master'

Release: merge 'develop' into 'master' created by Jürgen Hannus

See merge request teis/classifiers-service!72
parents 71af657e 0a3f6be8
# Changelog
## [1.16.0] - 2021-01-22
* added classifier for new risk assessment status PUBLISHED
* updated classifier attribute definition DOCUMENT_ACCESS_RESTRICTION_TYPE__DEADLINE mandatory value to TRUE
* filled created_at and modified_at null values where values were missing
* added missing classifier OBJECT_TYPE__RISK_FACTOR_ASSESSMENT
* create dwh DB schema for datawarehouse views
## [1.14.0] - 2020-12-14
* added new classifier item: TASK_TAG__HIGH_PRIORITY
......@@ -8,5 +16,6 @@
* removed Camunda BPMN dependency
* updated Spring Boot framework to version 2.3.4.RELEASE
* updated teis-gradle-plugin version to latest which contains different Gradle dependency configuration sets (functionalities) and therefore Gradle configuration was stripped down from microservice configuration
* updated teis-gradle-plugin version to latest which contains different Gradle dependency configuration sets (
functionalities) and therefore Gradle configuration was stripped down from microservice configuration
* updated Gradle Wrapper to version 5.6.4
theGroup=ee.sm.ti.teis
theVersion=1.15.0
commonsVersion=1.14.0
officeApiGatewayVersion=1.14.0
theVersion=1.16.0
commonsVersion=1.17.0
officeApiGatewayVersion=1.17.0
schedulerVersion=1.12.0
pluginVersion=1.2.0
--liquibase formatted sql
--changeset kristel:2021-01-11.add-risk-assessment-published-status
UPDATE classifier_item SET seq_no = 4 WHERE id = 'RISK_ASSESSMENT_STATUS__ARCHIVED';
INSERT INTO classifier_item (id, classifier_definition_id, code, editable, name, object_status, seq_no, upper_classifier_item_id, valid_from, valid_until, level)
VALUES ('RISK_ASSESSMENT_STATUS__PUBLISHED', 'RISK_ASSESSMENT_STATUS', 'PUBLISHED', false, 'Avaldatud', 'CURRENT', 3, null, now(), null, null);
--liquibase formatted sql
--changeset jyrgen:2021-01-11.update-document-access-restriction-type-deadline-mandatory
UPDATE classifier_attribute_definition SET mandatory = true WHERE id = 'DOCUMENT_ACCESS_RESTRICTION_TYPE__DEADLINE';
\ No newline at end of file
--liquibase formatted sql
--changeset enriko:2021-01-14.TEIS-924.generate-created_at-values.sql splitStatements:false
create or replace function fill_created_at_value(tableName varchar, idType varchar)
returns void
as $$
declare
createdAt timestamp;
rec record;
begin
select to_timestamp('2020-03-31 08:00:00', 'YYYY-MM-DD HH24:MI:SS') into createdAt;
for rec in execute 'select * from ' || quote_ident(tableName) || ' where created_at is null' LOOP
select createdAt + interval '1 second' into createdAt;
if idType = 'uuid' then
-- RAISE NOTICE 'ID= "%"', rec.id::text;
execute 'update ' || quote_ident(tableName) || ' set created_by = ''SYSTEM'', created_at = ''' || createdAt || ''', modified_at = ''' || createdAt || ''' where id=''' || rec.id::text || '''';
else
-- RAISE NOTICE 'ID str= "%"', rec.id;
execute 'update ' || quote_ident(tableName) || ' set created_by = ''SYSTEM'', created_at = ''' || createdAt || ''', modified_at = ''' || createdAt || ''' where id=''' || rec.id || '''';
end if;
-- RAISE NOTICE 'createdAt "%"', createdAt;
end loop;
end $$
language plpgsql;
select fill_created_at_value('classifier_definition', 'string');
select fill_created_at_value('classifier_item', 'string');
select fill_created_at_value('classifier_item_link', 'uuid');
select fill_created_at_value('classifier_attribute_definition', 'string');
select fill_created_at_value('classifier_attribute_value', 'uuid');
drop function if exists fill_created_at_value(varchar, varchar);
--liquibase formatted sql
--changeset jyrgen:2021-01-18.TEIS-1333.add-object-type-risk-factor-assessment
INSERT INTO classifier_item (id, classifier_definition_id, code, editable, name, object_status, seq_no, upper_classifier_item_id, valid_from, valid_until, level)
VALUES ('OBJECT_TYPE__RISK_FACTOR_ASSESSMENT', 'OBJECT_TYPE', 'RISK_FACTOR_ASSESSMENT', false, 'Riskiteguri hinnang', 'CURRENT', 13, null, now(), null, null);
\ No newline at end of file
......@@ -6,5 +6,6 @@
<includeAll path="domain" relativeToChangelogFile="true" />
<include file="classpath:db/changelog/cache-master.xml" />
<includeAll path="data" relativeToChangelogFile="true" />
<includeAll path="views-dwh" relativeToChangelogFile="true"/>
</databaseChangeLog>
--liquibase formatted sql
--changeset enriko:2021-01-12.TEIS-924.alter-table-classifier_definition-imported_at
ALTER TABLE classifier_definition ALTER COLUMN imported_at TYPE timestamp;
<?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-3.6.xsd">
<changeSet author="enriko" id="2021-01-14.TEIS-924.create-dwh-schema">
<sql>
CREATE SCHEMA IF NOT EXISTS dwh;
</sql>
</changeSet>
<!-- Define app DB user in application.yaml: spring.liquibase.parameters.db_app_username: ${DB_APP_USERNAME:teisdb_user}-->
<changeSet author="enriko" id="2021-01-14.TEIS-924.grant-dwh-schema-to-app-user" failOnError="false" runOnChange="true">
<preConditions onFail="CONTINUE">
<changeLogPropertyDefined property="db_app_username" />
</preConditions>
<sql>
GRANT USAGE ON SCHEMA dwh TO ${db_app_username};
GRANT SELECT ON ALL TABLES IN SCHEMA dwh TO ${db_app_username};
ALTER DEFAULT PRIVILEGES IN SCHEMA dwh
GRANT SELECT ON TABLES TO ${db_app_username};
</sql>
</changeSet>
</databaseChangeLog>
--liquibase formatted sql
--changeset enriko:2021-01-18.TEIS-924.create_dwh_classifier_views context:local,dev,integtest,test
drop view if exists dwh.classifier_definition;
create view dwh.classifier_definition as
select * from public.classifier_definition;
drop view if exists dwh.classifier_item;
create view dwh.classifier_item as
select * from public.classifier_item;
drop view if exists dwh.classifier_item_link;
create view dwh.classifier_item_link as
select * from public.classifier_item_link;
drop view if exists dwh.classifier_attribute_definition;
create view dwh.classifier_attribute_definition as
select * from public.classifier_attribute_definition;
drop view if exists dwh.classifier_attribute_value;
create view dwh.classifier_attribute_value as
select id, value as value_, classifier_attribute_definition_id, classifier_item_id,
created_at, created_by, modified_at, modified_by, object_status from public.classifier_attribute_value;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment