Skip to content

Commit 3bcc312

Browse files
Model file: match key order with other SDKs
1 parent 8d33f39 commit 3bcc312

File tree

4 files changed

+44
-44
lines changed

4 files changed

+44
-44
lines changed

objectbox/lib/src/modelinfo/modelentity.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ class ModelEntity {
181181
ret['id'] = id.toString();
182182
ret['lastPropertyId'] = lastPropertyId.toString();
183183
ret['name'] = name;
184-
if (flags != 0) ret['flags'] = flags;
185184
if (externalName != null) ret['externalName'] = externalName;
185+
if (flags != 0) ret['flags'] = flags;
186186
ret['properties'] =
187187
properties.map((p) => p.toMap(forModelJson: forModelJson)).toList();
188188
ret['relations'] =

objectbox/lib/src/modelinfo/modelproperty.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,11 @@ class ModelProperty {
145145
final ret = <String, dynamic>{};
146146
ret['id'] = id.toString();
147147
ret['name'] = name;
148+
if (indexId != null) ret['indexId'] = indexId!.toString();
148149
ret['type'] = type;
149150
if (externalType != null) ret['externalType'] = externalType;
150151
if (externalName != null) ret['externalName'] = externalName;
151152
if (flags != 0) ret['flags'] = flags;
152-
if (indexId != null) ret['indexId'] = indexId!.toString();
153153
if (relationTarget != null) ret['relationTarget'] = relationTarget;
154154
if (!forModelJson) {
155155
if (_dartFieldType != null) {

objectbox/lib/src/modelinfo/modelrelation.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ class ModelRelation {
8787
final ret = <String, dynamic>{};
8888
ret['id'] = id.toString();
8989
ret['name'] = name;
90-
if (_targetId != null) ret['targetId'] = _targetId.toString();
9190
if (externalType != null) {
9291
ret['externalType'] = externalType;
9392
}
9493
if (externalName != null) {
9594
ret['externalName'] = externalName;
9695
}
96+
if (_targetId != null) ret['targetId'] = _targetId.toString();
9797
if (!forModelJson) {
9898
ret['targetName'] = _targetName;
9999
ret['uidRequest'] = uidRequest;

objectbox_test/test/objectbox-model.json

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -63,86 +63,86 @@
6363
{
6464
"id": "15:5960097736918862689",
6565
"name": "uByte",
66+
"indexId": "1:759265819613755228",
6667
"type": 2,
67-
"flags": 40,
68-
"indexId": "1:759265819613755228"
68+
"flags": 40
6969
},
7070
{
7171
"id": "16:3014870337091941693",
7272
"name": "uShort",
73+
"indexId": "2:3731424852781354288",
7374
"type": 3,
74-
"flags": 40,
75-
"indexId": "2:3731424852781354288"
75+
"flags": 40
7676
},
7777
{
7878
"id": "17:3004362051550241897",
7979
"name": "uChar",
80+
"indexId": "3:1180301620695216647",
8081
"type": 4,
81-
"flags": 40,
82-
"indexId": "3:1180301620695216647"
82+
"flags": 40
8383
},
8484
{
8585
"id": "18:1083874867412561588",
8686
"name": "uInt",
87+
"indexId": "4:9159391309201422019",
8788
"type": 5,
88-
"flags": 40,
89-
"indexId": "4:9159391309201422019"
89+
"flags": 40
9090
},
9191
{
9292
"id": "19:1849261948480372113",
9393
"name": "uString",
94+
"indexId": "5:7090314366957370493",
9495
"type": 9,
95-
"flags": 2080,
96-
"indexId": "5:7090314366957370493"
96+
"flags": 2080
9797
},
9898
{
9999
"id": "20:1700905145011245158",
100100
"name": "uLong",
101+
"indexId": "6:9146355272521890356",
101102
"type": 6,
102-
"flags": 40,
103-
"indexId": "6:9146355272521890356"
103+
"flags": 40
104104
},
105105
{
106106
"id": "21:1256214340403371310",
107107
"name": "iByte",
108+
"indexId": "7:2597915862881161952",
108109
"type": 2,
109-
"flags": 8,
110-
"indexId": "7:2597915862881161952"
110+
"flags": 8
111111
},
112112
{
113113
"id": "22:5768208836201983752",
114114
"name": "iShort",
115+
"indexId": "8:5900854653402683567",
115116
"type": 3,
116-
"flags": 8,
117-
"indexId": "8:5900854653402683567"
117+
"flags": 8
118118
},
119119
{
120120
"id": "23:2550226115516189529",
121121
"name": "iChar",
122+
"indexId": "9:6832522351412488843",
122123
"type": 4,
123-
"flags": 8,
124-
"indexId": "9:6832522351412488843"
124+
"flags": 8
125125
},
126126
{
127127
"id": "24:8654682464442924778",
128128
"name": "iInt",
129+
"indexId": "10:7301436684067319059",
129130
"type": 5,
130-
"flags": 8,
131-
"indexId": "10:7301436684067319059"
131+
"flags": 8
132132
},
133133
{
134134
"id": "25:6667369331692110338",
135135
"name": "iString",
136+
"indexId": "11:4395163045094957195",
136137
"type": 9,
137-
"flags": 2048,
138-
"indexId": "11:4395163045094957195"
138+
"flags": 2048
139139
},
140140
{
141141
"id": "26:3059114515142777989",
142142
"name": "iLong",
143+
"indexId": "12:5335419474465474748",
143144
"type": 6,
144-
"flags": 8,
145-
"indexId": "12:5335419474465474748"
145+
"flags": 8
146146
},
147147
{
148148
"id": "27:3303202230649375862",
@@ -167,17 +167,17 @@
167167
{
168168
"id": "31:2809605701582877706",
169169
"name": "relAId",
170+
"indexId": "16:2470631863336693263",
170171
"type": 11,
171172
"flags": 520,
172-
"indexId": "16:2470631863336693263",
173173
"relationTarget": "RelatedEntityA"
174174
},
175175
{
176176
"id": "32:8664662867703418562",
177177
"name": "relBId",
178+
"indexId": "17:1880235110135739998",
178179
"type": 11,
179180
"flags": 520,
180-
"indexId": "17:1880235110135739998",
181181
"relationTarget": "RelatedEntityB"
182182
},
183183
{
@@ -193,9 +193,9 @@
193193
{
194194
"id": "35:1724663621433823504",
195195
"name": "replaceLong",
196+
"indexId": "20:4846837430056399798",
196197
"type": 6,
197-
"flags": 32808,
198-
"indexId": "20:4846837430056399798"
198+
"flags": 32808
199199
}
200200
],
201201
"relations": [
@@ -220,9 +220,9 @@
220220
{
221221
"id": "2:1699553834502252174",
222222
"name": "value",
223+
"indexId": "18:8736709610628523744",
223224
"type": 6,
224-
"flags": 40,
225-
"indexId": "18:8736709610628523744"
225+
"flags": 40
226226
}
227227
],
228228
"relations": []
@@ -251,9 +251,9 @@
251251
{
252252
"id": "4:4770420600931409867",
253253
"name": "relBId",
254+
"indexId": "13:4152155418078636653",
254255
"type": 11,
255256
"flags": 520,
256-
"indexId": "13:4152155418078636653",
257257
"relationTarget": "RelatedEntityB"
258258
}
259259
],
@@ -283,17 +283,17 @@
283283
{
284284
"id": "4:2040461616972321497",
285285
"name": "relAId",
286+
"indexId": "14:9134773468347164958",
286287
"type": 11,
287288
"flags": 520,
288-
"indexId": "14:9134773468347164958",
289289
"relationTarget": "RelatedEntityA"
290290
},
291291
{
292292
"id": "5:4421486877612415347",
293293
"name": "relBId",
294+
"indexId": "15:1869174197194604432",
294295
"type": 11,
295296
"flags": 520,
296-
"indexId": "15:1869174197194604432",
297297
"relationTarget": "RelatedEntityB"
298298
}
299299
],
@@ -427,9 +427,9 @@
427427
{
428428
"id": "3:4230259646478779567",
429429
"name": "parentId",
430+
"indexId": "19:3009172190024929732",
430431
"type": 11,
431432
"flags": 520,
432-
"indexId": "19:3009172190024929732",
433433
"relationTarget": "TreeNode"
434434
}
435435
],
@@ -684,24 +684,24 @@
684684
{
685685
"id": "3:1316805984869681992",
686686
"name": "floatVector",
687+
"indexId": "21:979541882805401029",
687688
"type": 28,
688-
"flags": 8,
689-
"indexId": "21:979541882805401029"
689+
"flags": 8
690690
},
691691
{
692692
"id": "4:2308158275756661586",
693693
"name": "relId",
694+
"indexId": "22:6527315700526716999",
694695
"type": 11,
695696
"flags": 520,
696-
"indexId": "22:6527315700526716999",
697697
"relationTarget": "RelatedNamedEntity"
698698
},
699699
{
700700
"id": "5:1476994841170736323",
701701
"name": "floatVectorGeoCoordinates",
702+
"indexId": "23:6649884639373473085",
702703
"type": 28,
703-
"flags": 8,
704-
"indexId": "23:6649884639373473085"
704+
"flags": 8
705705
}
706706
],
707707
"relations": []
@@ -762,9 +762,9 @@
762762
{
763763
"id": "2:313640065593441165",
764764
"name": "mongoIdEntities",
765-
"targetId": "16:5931645853908059165",
766765
"externalType": 124,
767-
"externalName": "my-mongo-rel"
766+
"externalName": "my-mongo-rel",
767+
"targetId": "16:5931645853908059165"
768768
}
769769
]
770770
}

0 commit comments

Comments
 (0)