|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<!-- |
| 3 | +
|
| 4 | + Licensed to the Apache Software Foundation (ASF) under one |
| 5 | + or more contributor license agreements. See the NOTICE file |
| 6 | + distributed with this work for additional information |
| 7 | + regarding copyright ownership. The ASF licenses this file |
| 8 | + to you under the Apache License, Version 2.0 (the |
| 9 | + "License"); you may not use this file except in compliance |
| 10 | + with the License. You may obtain a copy of the License at |
| 11 | +
|
| 12 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 13 | +
|
| 14 | + Unless required by applicable law or agreed to in writing, |
| 15 | + software distributed under the License is distributed on an |
| 16 | + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 17 | + KIND, either express or implied. See the License for the |
| 18 | + specific language governing permissions and limitations |
| 19 | + under the License. |
| 20 | +
|
| 21 | +--> |
| 22 | +<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" |
| 23 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 24 | + xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.3.xsd"> |
| 25 | + |
| 26 | + <!-- ClientTrendsByWeek --> |
| 27 | + <changeSet author="fineract" id="postgresql-client-trends-week" context="postgresql"> |
| 28 | + <update tableName="stretchy_report"> |
| 29 | + <column name="report_sql" value="SELECT COUNT(cl.id) AS count, EXTRACT(WEEK FROM cl.activation_date) AS Weeks |
| 30 | + FROM m_office o LEFT JOIN m_client cl on o.id = cl.office_id |
| 31 | + WHERE o.hierarchy like concat((select ino.hierarchy from m_office ino where ino.id = ${officeId}),'%' ) |
| 32 | + AND (cl.activation_date BETWEEN (CURRENT_DATE - INTERVAL '12 weeks') AND CURRENT_DATE) |
| 33 | + GROUP BY Weeks"/> |
| 34 | + <where>report_name = 'ClientTrendsByWeek'</where> |
| 35 | + </update> |
| 36 | + </changeSet> |
| 37 | + |
| 38 | + <!-- ClientTrendsByMonth --> |
| 39 | + <changeSet author="fineract" id="postgresql-client-trends-month" context="postgresql"> |
| 40 | + <update tableName="stretchy_report"> |
| 41 | + <column name="report_sql" value="SELECT COUNT(cl.id) AS count, TO_CHAR(cl.activation_date, 'Month') AS Months |
| 42 | + FROM m_office o LEFT JOIN m_client cl on o.id = cl.office_id |
| 43 | + WHERE o.hierarchy like concat((select ino.hierarchy from m_office ino where ino.id = ${officeId}),'%' ) |
| 44 | + AND (cl.activation_date BETWEEN (CURRENT_DATE - INTERVAL '12 months') AND CURRENT_DATE) |
| 45 | + GROUP BY Months"/> |
| 46 | + <where>report_name = 'ClientTrendsByMonth'</where> |
| 47 | + </update> |
| 48 | + </changeSet> |
| 49 | + |
| 50 | +</databaseChangeLog> |
0 commit comments