Skip to content

Commit 07ae1ca

Browse files
committed
Add NSEntityMigrationPolicy to mapping migration
1 parent e08e392 commit 07ae1ca

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Storage/Storage/Model/WooCommerceModelV74toV75.xcmappingmodel/xcmapping.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0"?>
1+
<?xml version="1.0" standalone="yes"?>
22
<!DOCTYPE database SYSTEM "file:///System/Library/DTDs/CoreData.dtd">
33

44
<database>
@@ -278,6 +278,7 @@
278278
<relationship name="entitymapping" type="1/1" destination="XDDEVENTITYMAPPING" idrefs="z791"></relationship>
279279
</object>
280280
<object type="XDDEVENTITYMAPPING" id="z150">
281+
<attribute name="migrationpolicyclassname" type="string">Storage.DeleteEntityObjectsMigrationPolicy</attribute>
281282
<attribute name="sourcename" type="string">CustomerSearchResult</attribute>
282283
<attribute name="mappingtypename" type="string">Undefined</attribute>
283284
<attribute name="mappingnumber" type="int16">56</attribute>
@@ -1497,13 +1498,14 @@ dmVyVCR0b3BYJG9iamVjdHMSAAGGoF8QD05TS2V5ZWRBcmNoaXZlctEAAAAIAAAACVRyb290gAGvEUYr
14971498
<relationship name="entitymapping" type="1/1" destination="XDDEVENTITYMAPPING" idrefs="z581"></relationship>
14981499
</object>
14991500
<object type="XDDEVENTITYMAPPING" id="z410">
1501+
<attribute name="migrationpolicyclassname" type="string">Storage.DeleteEntityObjectsMigrationPolicy</attribute>
15001502
<attribute name="sourcename" type="string">Customer</attribute>
15011503
<attribute name="mappingtypename" type="string">Undefined</attribute>
15021504
<attribute name="mappingnumber" type="int16">22</attribute>
15031505
<attribute name="destinationname" type="string">Customer</attribute>
15041506
<attribute name="autogenerateexpression" type="bool">1</attribute>
15051507
<relationship name="mappingmodel" type="1/1" destination="XDDEVMAPPINGMODEL" idrefs="z176"></relationship>
1506-
<relationship name="attributemappings" type="0/0" destination="XDDEVATTRIBUTEMAPPING" idrefs="z531 z662 z442 z570 z704 z824 z186 z320 z449 z575 z705 z487 z613 z738 z102 z230 z361 z495 z616 z742 z401 z528 z660 z786 z146 z272 z405"></relationship>
1508+
<relationship name="attributemappings" type="0/0" destination="XDDEVATTRIBUTEMAPPING" idrefs="z705 z401 z786 z186 z704 z495 z660 z528 z824 z405 z531 z361 z442 z449 z570 z662 z230 z616 z738 z487 z146 z613 z575 z742 z272 z102 z320"></relationship>
15071509
<relationship name="relationshipmappings" type="0/0" destination="XDDEVRELATIONSHIPMAPPING" idrefs="z788"></relationship>
15081510
</object>
15091511
<object type="XDDEVATTRIBUTEMAPPING" id="z411">

Storage/StorageTests/CoreData/MigrationTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,8 +1415,8 @@ final class MigrationTests: XCTestCase {
14151415
// Then
14161416
// After migration, we're deleting the entities and regenerating them due to heavyweight migration
14171417
// in WooCommerceModelV74toV75, as the new ones have siteID
1418-
XCTAssertEqual(try sourceContext.count(entityName: "Customer"), 0)
1419-
XCTAssertEqual(try sourceContext.count(entityName: "CustomerSearchResult"), 0)
1418+
XCTAssertEqual(try targetContext.count(entityName: "Customer"), 0)
1419+
XCTAssertEqual(try targetContext.count(entityName: "CustomerSearchResult"), 0)
14201420
// Inserting new objects after the migration to confirm the new attributes are correct
14211421
let newCustomer = insertCustomer(to: targetContext, forModel: 75)
14221422
let newCustomerSearchResult = targetContext.insert(

0 commit comments

Comments
 (0)