FINERACT-2081: Add missing index on GL annual summary table

This commit is contained in:
Adam Saghy
2025-01-09 19:35:55 +01:00
parent 9fc4e2f948
commit 81883a18aa
@@ -22,7 +22,7 @@
<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">
<changeSet id="1" author="fineract" runInTransaction="false" context="postgresql">
<changeSet id="1" author="fineract" context="postgresql">
<createTable tableName="acc_gl_journal_entry_annual_summary">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints nullable="false" primaryKey="true" primaryKeyName="pk_acc_gl_journal_entry_annual_summary"/>
@@ -56,12 +56,59 @@
</createTable>
</changeSet>
<changeSet author="fineract" id="2" runInTransaction="false" context="postgresql">
<preConditions onFail="MARK_RAN">
<indexExists tableName="acc_gl_journal_entry_annual_summary" indexName="acc_gl_journal_entry_annual_summary_idx_1"/>
</preConditions>
<changeSet id="3" author="fineract" context="mysql">
<createTable tableName="acc_gl_journal_entry_annual_summary">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints nullable="false" primaryKey="true" primaryKeyName="pk_acc_gl_journal_entry_annual_summary"/>
</column>
<column name="gl_code" type="VARCHAR(45)">
<constraints nullable="false"/>
</column>
<column name="product_id" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="office_id" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="opening_balance_amount" type="DECIMAL(19, 6)">
<constraints nullable="false"/>
</column>
<column name="currency_code" type="VARCHAR(3)">
<constraints nullable="false"/>
</column>
<column name="owner_external_id" type="VARCHAR(100)"/>
<column name="manual_entry" type="boolean" defaultValueBoolean="false">
<constraints nullable="false"/>
</column>
<column name="year_end_date" type="DATE">
<constraints nullable="false"/>
</column>
<column name="created_by" type="BIGINT"/>
<column name="created_on_utc" type="DATETIME"/>
<column name="last_modified_by" type="BIGINT"/>
<column name="last_modified_on_utc" type="DATETIME"/>
</createTable>
</changeSet>
<changeSet author="fineract" id="4">
<addForeignKeyConstraint baseColumnNames="created_by" baseTableName="acc_gl_journal_entry_annual_summary"
constraintName="FK_annual_report_created_by" deferrable="false" initiallyDeferred="false"
onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="id"
referencedTableName="m_appuser" validate="true"/>
<addForeignKeyConstraint baseColumnNames="last_modified_by" baseTableName="acc_gl_journal_entry_annual_summary"
constraintName="FK_annual_report_last_modified_by" deferrable="false" initiallyDeferred="false"
onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="id"
referencedTableName="m_appuser" validate="true"/>
</changeSet>
<changeSet author="fineract" id="5" runInTransaction="false" context="postgresql">
<sql>
create index concurrently acc_gl_journal_entry_annual_summary_idx_1 on acc_gl_journal_entry_annual_summary(gl_code,product_name);
create index concurrently if not exists acc_gl_journal_entry_annual_summary_idx_1 on acc_gl_journal_entry_annual_summary(gl_code,product_id);
</sql>
</changeSet>
<changeSet author="fineract" id="6" context="mysql">
<sql>
create index acc_gl_journal_entry_annual_summary_idx_1 on acc_gl_journal_entry_annual_summary(gl_code,product_id);
</sql>
</changeSet>
</databaseChangeLog>