chore: [ANDROSDK-2128] Replace Auto-Increment _id Keys with UIDs and Composite Primary Keys#2438
Conversation
…DROSDK-2128 # Conflicts: # core/src/main/java/org/hisp/dhis/android/persistence/itemfilter/ItemFilterDB.kt
…mary key definitions
… are correctly defined
…ticsPeriodBoundaryType in primary key
…y key and enhance event filter assertions
…d delete ObjectShould.java
…DROSDK-2128 # Conflicts: # core/src/test/java/org/hisp/dhis/android/core/map/layer/internal/microsoft/BingServerResponseShould.kt
vgarciabnz
left a comment
There was a problem hiding this comment.
I have not reviewed the migration yet, I want to do it tomorrow. In the migration, The only thing I would consider is that primary keys that create new UNIQUE constraints might fail during the migration (probably because an existing inconsistent data). I will try to be permissive with those errors and just ignore them.
…. SonarQube issue
|
@vgarciabnz , about your comment:
Maybe we can just use |
…tDataElement, CustomIntentAttribute, and TrackerJobObject tables
…Type and uid columns
…nd closingDate in primary key
…EntityAttribute and dataElement in primary key
… update displayDescription instead of event
|



Description
This PR removes all legacy
_id INTEGER PRIMARY KEY AUTOINCREMENTcolumns and migrates each table to use meaningfulTEXTUIDs or composite unique constraints. It includes migration scripts (v175), refactors SQL definitions, updates model builders andtoDomain()mappings, adapts tests, and bumps the database version to 175.Highlights
_idcolumns, redefine PKs, updatesnapshot.sqlid(Long)from builders and core interfaces; refactor persistence stores and handlersinserttoupdateOrInsertin certain stores (e.g.,ForeignKeyViolationStorenow backed by anObjectWithoutUidStore)TrackerVisualizationDimensionandVisualizationDimensionItemmodels to preserve row order lost with autoincrementevent_data_elementandtracked_entity_instance_attributeindexes since they're primary keys now.Note