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


The following commit(s) were added to refs/heads/develop by this push:
     new 0049a9e3f FINERACT-1758: Improve custom module example (fix)
0049a9e3f is described below

commit 0049a9e3f95b584bfd55d3628b5122848961509c
Author: Aleks <[email protected]>
AuthorDate: Thu Oct 20 15:42:02 2022 +0200

    FINERACT-1758: Improve custom module example (fix)
---
 .../{parts => }/0001_acme_note_initial.xml         |  0
 .../db/custom-changelog/changelog-acme-note.xml    | 26 ----------------------
 .../src/docs/en/chapters/architecture/modules.adoc |  9 ++++++++
 .../resources/db/changelog/db.changelog-master.xml |  2 +-
 4 files changed, 10 insertions(+), 27 deletions(-)

diff --git 
a/custom/acme/note/starter/src/main/resources/db/custom-changelog/parts/0001_acme_note_initial.xml
 
b/custom/acme/note/starter/src/main/resources/db/custom-changelog/0001_acme_note_initial.xml
similarity index 100%
rename from 
custom/acme/note/starter/src/main/resources/db/custom-changelog/parts/0001_acme_note_initial.xml
rename to 
custom/acme/note/starter/src/main/resources/db/custom-changelog/0001_acme_note_initial.xml
diff --git 
a/custom/acme/note/starter/src/main/resources/db/custom-changelog/changelog-acme-note.xml
 
b/custom/acme/note/starter/src/main/resources/db/custom-changelog/changelog-acme-note.xml
deleted file mode 100644
index 601ba8f08..000000000
--- 
a/custom/acme/note/starter/src/main/resources/db/custom-changelog/changelog-acme-note.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?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.1.xsd";>
-    <include file="parts/0001_acme_note_initial.xml" 
relativeToChangelogFile="true"/>
-</databaseChangeLog>
diff --git a/fineract-doc/src/docs/en/chapters/architecture/modules.adoc 
b/fineract-doc/src/docs/en/chapters/architecture/modules.adoc
index 50d63367b..0349c060c 100644
--- a/fineract-doc/src/docs/en/chapters/architecture/modules.adoc
+++ b/fineract-doc/src/docs/en/chapters/architecture/modules.adoc
@@ -63,6 +63,15 @@ If database migrations are needed as part of your 
customizations then you can ad
 include::{diagramsdir}/custom-db-migration-folder-structure.puml[]
 ----
 
+And here an example migration script:
+
+[source,xml]
+----
+include::{rootdir}/custom/acme/note/starter/src/main/resources/db/custom-changelog/0001_acme_note_initial.xml[lines=22..]
+----
+
+IMPORTANT: By default custom database migration changelogs are executed in 
context `tenant_db`. That makes sure your changes will be applied to the tenant 
database (read: main database and not the tenant store database). In theory you 
could also target the tenant configuration database, but it's not recommended 
to do that.
+
 === Deployment
 
 Custom modules (better: the JAR files) only need to be dropped in Fineract's 
`libs` folder if you run Fineract from the Spring Boot JAR file. Dynamic 
loading of external JARs is provided since Fineract version 1.5.0. For your 
convenience we've created a separate Docker image module that automatically 
includes your custom modules (see `custom/docker`). You can build this Docker 
image with
diff --git 
a/fineract-provider/src/main/resources/db/changelog/db.changelog-master.xml 
b/fineract-provider/src/main/resources/db/changelog/db.changelog-master.xml
index 266a6ff77..1e3d3e114 100644
--- a/fineract-provider/src/main/resources/db/changelog/db.changelog-master.xml
+++ b/fineract-provider/src/main/resources/db/changelog/db.changelog-master.xml
@@ -31,5 +31,5 @@
     <include file="tenant-store/changelog-tenant-store.xml" 
relativeToChangelogFile="true" context="tenant_store_db AND !initial_switch"/>
     <include file="tenant/initial-switch-changelog-tenant.xml" 
relativeToChangelogFile="true" context="tenant_db AND initial_switch"/>
     <include file="tenant/changelog-tenant.xml" relativeToChangelogFile="true" 
context="tenant_db AND !initial_switch"/>
-    <includeAll path="db/custom-changelog" errorIfMissingOrEmpty="false" />
+    <includeAll path="db/custom-changelog" errorIfMissingOrEmpty="false" 
context="tenant_db" />
 </databaseChangeLog>

Reply via email to