You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by al...@apache.org on 2022/08/09 08:42:30 UTC
[fineract] 02/07: FINERACT-1670: Add auditable fields to Client identifier
This is an automated email from the ASF dual-hosted git repository.
aleks pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git
commit 6e189fcc8992d48b9f6549435d8081a62e37b1b5
Author: Adam Saghy <ad...@gmail.com>
AuthorDate: Sun Aug 7 23:13:56 2022 +0200
FINERACT-1670: Add auditable fields to Client identifier
---
.../portfolio/client/domain/ClientIdentifier.java | 4 +-
.../db/changelog/tenant/changelog-tenant.xml | 1 +
...0031_add_audit_entries_to_client_identifier.xml | 77 ++++++++++++++++++++++
3 files changed, 80 insertions(+), 2 deletions(-)
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/ClientIdentifier.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/ClientIdentifier.java
index 58615477d..9c954a398 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/ClientIdentifier.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/ClientIdentifier.java
@@ -29,13 +29,13 @@ import javax.persistence.UniqueConstraint;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.infrastructure.codes.domain.CodeValue;
import org.apache.fineract.infrastructure.core.api.JsonCommand;
-import org.apache.fineract.infrastructure.core.domain.AbstractAuditableCustom;
+import org.apache.fineract.infrastructure.core.domain.AbstractAuditableWithUTCDateTimeCustom;
@Entity
@Table(name = "m_client_identifier", uniqueConstraints = {
@UniqueConstraint(columnNames = { "document_type_id", "document_key" }, name = "unique_identifier_key"),
@UniqueConstraint(columnNames = { "client_id", "document_key", "active" }, name = "unique_active_client_identifier") })
-public class ClientIdentifier extends AbstractAuditableCustom {
+public class ClientIdentifier extends AbstractAuditableWithUTCDateTimeCustom {
@ManyToOne
@JoinColumn(name = "client_id", nullable = false)
diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml b/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml
index 1d3bb1cfd..b1cbcb18f 100644
--- a/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml
+++ b/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml
@@ -50,4 +50,5 @@
<include file="parts/0028_add_charge_refund_charge_type_to_loan_transaction.xml" relativeToChangelogFile="true"/>
<include file="parts/0029_add_delinquency_buckets.xml" relativeToChangelogFile="true"/>
<include file="parts/0030_add_audit_entries_to_business_date.xml" relativeToChangelogFile="true"/>
+ <include file="parts/0031_add_audit_entries_to_client_identifier.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>
diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/parts/0031_add_audit_entries_to_client_identifier.xml b/fineract-provider/src/main/resources/db/changelog/tenant/parts/0031_add_audit_entries_to_client_identifier.xml
new file mode 100644
index 000000000..fe3aca120
--- /dev/null
+++ b/fineract-provider/src/main/resources/db/changelog/tenant/parts/0031_add_audit_entries_to_client_identifier.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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
+
+ http://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.
+
+-->
+<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">
+ <changeSet author="fineract" id="client_identifier-1" context="mysql">
+ <addColumn tableName="m_client_identifier">
+ <column name="created_on_utc" type="DATETIME"/>
+ <column name="last_modified_on_utc" type="DATETIME"/>
+ </addColumn>
+ </changeSet>
+ <changeSet author="fineract" id="client_identifier-1" context="postgresql">
+ <addColumn tableName="m_client_identifier">
+ <column name="created_on_utc" type="TIMESTAMP WITH TIME ZONE"/>
+ <column name="last_modified_on_utc" type="TIMESTAMP WITH TIME ZONE"/>
+ </addColumn>
+ </changeSet>
+
+ <changeSet id="client_identifier-2" author="fineract">
+ <dropNotNullConstraint tableName="m_client_identifier" columnName="created_date" columnDataType="datetime"/>
+ <dropNotNullConstraint tableName="m_client_identifier" columnName="lastmodified_date" columnDataType="datetime"/>
+ </changeSet>
+ <changeSet id="client_identifier-3" author="fineract">
+ <renameColumn tableName="m_client_identifier" oldColumnName="createdby_id" newColumnName="created_by" columnDataType="BIGINT"/>
+ <renameColumn tableName="m_client_identifier" oldColumnName="lastmodifiedby_id" newColumnName="last_modified_by" columnDataType="BIGINT"/>
+ </changeSet>
+ <changeSet author="fineract" id="client_identifier-4">
+ <addForeignKeyConstraint baseColumnNames="created_by" baseTableName="m_client_identifier"
+ constraintName="FK_client_identifier_created_by" deferrable="false" initiallyDeferred="false"
+ onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="id"
+ referencedTableName="m_appuser" validate="true"/>
+ <addForeignKeyConstraint baseColumnNames="last_modified_by" baseTableName="m_client_identifier"
+ constraintName="FK_client_identifier_last_modified_by" deferrable="false" initiallyDeferred="false"
+ onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="id"
+ referencedTableName="m_appuser" validate="true"/>
+ </changeSet>
+ <changeSet id="client_identifier-5" author="fineract" context="mysql">
+ <preConditions onFail="MARK_RAN">
+ <sqlCheck expectedResult="0">select count(*) from m_client_identifier</sqlCheck>
+ </preConditions>
+ <addNotNullConstraint tableName="m_client_identifier" columnName="created_on_utc" columnDataType="DATETIME"/>
+ <addNotNullConstraint tableName="m_client_identifier" columnName="last_modified_on_utc" columnDataType="DATETIME"/>
+ </changeSet>
+ <changeSet id="client_identifier-5" author="fineract" context="postgresql">
+ <preConditions onFail="MARK_RAN">
+ <sqlCheck expectedResult="0">select count(*) from m_client_identifier</sqlCheck>
+ </preConditions>
+ <addNotNullConstraint tableName="m_client_identifier" columnName="created_on_utc" columnDataType="TIMESTAMP WITH TIME ZONE"/>
+ <addNotNullConstraint tableName="m_client_identifier" columnName="last_modified_on_utc" columnDataType="TIMESTAMP WITH TIME ZONE"/>
+ </changeSet>
+ <changeSet id="client_identifier-6" author="fineract">
+ <preConditions onFail="MARK_RAN">
+ <sqlCheck expectedResult="0">select count(*) from m_client_identifier where created_by is null or last_modified_by is null</sqlCheck>
+ </preConditions>
+ <addNotNullConstraint tableName="m_client_identifier" columnName="created_by" columnDataType="BIGINT"/>
+ <addNotNullConstraint tableName="m_client_identifier" columnName="last_modified_by" columnDataType="BIGINT"/>
+ </changeSet>
+</databaseChangeLog>