Skip to content

Commit

Permalink
FINERACT-2081: Add missing index on GL annual summary table
Browse files Browse the repository at this point in the history
  • Loading branch information
adamsaghy committed Jan 9, 2025
1 parent 9fc4e2f commit 81883a1
Showing 1 changed file with 53 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>
Expand Down Expand Up @@ -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 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 concurrently acc_gl_journal_entry_annual_summary_idx_1 on acc_gl_journal_entry_annual_summary(gl_code,product_name);
create index acc_gl_journal_entry_annual_summary_idx_1 on acc_gl_journal_entry_annual_summary(gl_code,product_id);
</sql>
</changeSet>
</databaseChangeLog>

0 comments on commit 81883a1

Please sign in to comment.