@@ -207,7 +207,7 @@ private function exportUsers(int $batchSize)
207207 $ user ['localId ' ] ?? '' ,
208208 $ user ['email ' ] ?? '' ,
209209 $ user ['displayName ' ] ?? $ user ['email ' ] ?? '' ,
210- new Hash ($ user ['passwordHash ' ] ?? '' , $ user ['salt ' ] ?? '' , Hash::ALGORITHM_SCRYPT_MODIFIED , $ hashConfig ['saltSeparator ' ], $ hashConfig ['signerKey ' ]),
210+ new Hash ($ user ['passwordHash ' ] ?? '' , $ user ['salt ' ] ?? '' , Hash::ALGORITHM_SCRYPT_MODIFIED , $ hashConfig ['saltSeparator ' ] ?? '' , $ hashConfig ['signerKey ' ] ?? '' ),
211211 $ user ['phoneNumber ' ] ?? '' ,
212212 $ this ->calculateUserType ($ user ['providerUserInfo ' ] ?? []),
213213 '' ,
@@ -394,6 +394,7 @@ private function exportCollection(Collection $collection, int $batchSize, bool $
394394 $ nextPageToken = null ;
395395
396396 $ documentSchema = [];
397+ $ createdSchema = [];
397398
398399 // Transfer Documents and Calculate Schemas
399400 while (true ) {
@@ -426,7 +427,23 @@ private function exportCollection(Collection $collection, int $batchSize, bool $
426427
427428 // Transfer Documents
428429 if ($ transferDocuments ) {
429- $ this ->callback (array_values ($ documentSchema ));
430+ $ cachedAtrributes = $ this ->cache ->get (Attribute::getName ());
431+
432+ $ attributesToCreate = $ documentSchema ;
433+
434+ foreach ($ documentSchema as $ key => $ attribute ) {
435+ foreach ($ cachedAtrributes as $ cachedAttribute ) {
436+ /** @var Attribute $cachedAttribute */
437+ if ($ cachedAttribute ->getKey () == $ attribute ->getKey () && $ cachedAttribute ->getCollection ()->getId () == $ attribute ->getCollection ()->getId ()) {
438+ unset($ attributesToCreate [$ key ]);
439+ }
440+ }
441+ }
442+
443+ if (count ($ attributesToCreate ) > 0 ) {
444+ $ this ->callback (array_values ($ attributesToCreate ));
445+ }
446+
430447 $ this ->callback ($ documents );
431448 }
432449
0 commit comments