Skip to content

Add indexes on patient appointment start_date_time and status columns…#163

Open
ojwanganto wants to merge 2 commits intoBahmni:masterfrom
ojwanganto:BAH-4145
Open

Add indexes on patient appointment start_date_time and status columns…#163
ojwanganto wants to merge 2 commits intoBahmni:masterfrom
ojwanganto:BAH-4145

Conversation

@ojwanganto
Copy link
Contributor

This PR adds indexes on start_date_time and status columns for improved query perfornance

@ojwanganto
Copy link
Contributor Author

I have updated the PR. Please re-review @gsluthra

@ojwanganto
Copy link
Contributor Author

ping @gsluthra @angshu

</changeSet>
<changeSet author="bahmni-appointments" id="add_index_on_patient_appointment_start_date_time_202411281139">
<comment>add index on patient_appointment start_date_time column</comment>
<createIndex indexName="patient_appointment_start_date_time_index" tableName="patient_appointment">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ojwanganto Thank you for the update! The changeset correctly adds an index to the start_date_time column in the patient_appointment table. However, to prevent duplicate index creation errors, it would be best to include a precondition to check if the index already exists before creating it.

Please add the following precondition before the <createIndex> tag:

<preConditions onFail="MARK_RAN">
    <not>
        <indexExists indexName="patient_appointment_start_date_time_index" tableName="patient_appointment"/>
    </not>
</preConditions>

Adding a precondition would prevents redundant index creation, help avoid migration failures if the index already exists and will ensure safe and idempotent schema updates.

Could you please update the changeset accordingly? Let me know if you have any questions. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants