commit e8d062b7a3742d6a87f4ee64b64322026ea9496e
parent 7bb71f25ea102117aa53ccbeafbb70abbea810fd
Author: Michael Camilleri <[email protected]>
Date: Thu, 2 Jul 2026 02:53:24 +0900
Index Core Data game and record lookups
This commit adds fetch indexes for the Core Data lookups that run every
time the app opens, synchronises, or applies CloudKit records. Game rows
are now indexed by id and ckRecordName, and PlayerEntity and MovesEntity
gain direct ckRecordName indexes for their record upsert paths.
These are local SQLite indexes only, so the change keeps the migration
lightweight and does not require any CloudKit schema update.
Co-Authored-By: Codex GPT 5.5 <[email protected]>
Diffstat:
1 file changed, 12 insertions(+), 0 deletions(-)
diff --git a/Crossmate/Models/CrossmateModel.xcdatamodeld/CrossmateModel.xcdatamodel/contents b/Crossmate/Models/CrossmateModel.xcdatamodeld/CrossmateModel.xcdatamodel/contents
@@ -41,6 +41,12 @@
<relationship name="moves" toMany="YES" deletionRule="Cascade" destinationEntity="MovesEntity" inverseName="game" inverseEntity="MovesEntity"/>
<relationship name="peerChanges" toMany="YES" deletionRule="Cascade" destinationEntity="PeerChangeEntity" inverseName="game" inverseEntity="PeerChangeEntity"/>
<relationship name="players" toMany="YES" deletionRule="Cascade" destinationEntity="PlayerEntity" inverseName="game" inverseEntity="PlayerEntity"/>
+ <fetchIndex name="byID">
+ <fetchIndexElement property="id" type="Binary" order="ascending"/>
+ </fetchIndex>
+ <fetchIndex name="byCKRecordName">
+ <fetchIndexElement property="ckRecordName" type="Binary" order="ascending"/>
+ </fetchIndex>
</entity>
<entity name="PlayerEntity" representedClassName="PlayerEntity" syncable="YES" codeGenerationType="class">
<attribute name="authorID" attributeType="String"/>
@@ -62,6 +68,9 @@
<fetchIndexElement property="game" type="Binary" order="ascending"/>
<fetchIndexElement property="authorID" type="Binary" order="ascending"/>
</fetchIndex>
+ <fetchIndex name="byCKRecordName">
+ <fetchIndexElement property="ckRecordName" type="Binary" order="ascending"/>
+ </fetchIndex>
</entity>
<entity name="MovesEntity" representedClassName="MovesEntity" syncable="YES" codeGenerationType="class">
<attribute name="authorID" attributeType="String"/>
@@ -76,6 +85,9 @@
<fetchIndexElement property="authorID" type="Binary" order="ascending"/>
<fetchIndexElement property="deviceID" type="Binary" order="ascending"/>
</fetchIndex>
+ <fetchIndex name="byCKRecordName">
+ <fetchIndexElement property="ckRecordName" type="Binary" order="ascending"/>
+ </fetchIndex>
</entity>
<entity name="CellEntity" representedClassName="CellEntity" syncable="YES" codeGenerationType="class">
<attribute name="ckRecordName" optional="YES" attributeType="String"/>