`Failed Liquibase update: liquibase.exception.LiquibaseException: liquibase.exception.MigrationFailedException: Migration failed for changeset liquibase/changelog/380-update-unique-key-constraint-for-storage-profile-association-state.xml::update-storage-profile-association-state-unique-constraint-to-allow-unique-rows-only-for-non-delete-action-rowsReason: liquibase/changelog.xml : SQL Precondition failed. Expected '1' got '0'`Aria Automation 8.18.1 Patch 3
VCF Automation 9.0
The upgrade fails because both versions (Aria Automation 8.18.1 P3 and VCFA 9.0) attempt to manage the same constraint/index differently.
When the upgrade pre-check detects the missing index (uq_storage_profile_association_state_storage_item_id_storage_de), it conflicts with the expected state and halts the process.
Important:
Before initiating the upgrade to VCFA 9.0, execute the following SQL commands on the storage_profile_association_state table in the provisioning-db to update the unique key constraint and ensure a successful upgrade but only after taking a provisioning-db backup:
1. Drop the conflicting index (if exists)
2. Identify the conflicting rows
3. Deleting the DELETE document_update_action records.
4.Validate no conflicting data remains
It should return 0 as the result count.
5. Check if the unique constraint exists
If result is 0, then run the below query.
6. Re-create the original unique constraint (if missing)
Re-create the original unique index7. After completing the steps above and confirming no conflicting data remains, proceed with the upgrade to VCFA 9.0.
Notes:
Later patches of Aria automation 8.18.1 after P3 and VCFA 9.0.1 and later automatically handle the constraint conflict more gracefully.