Only iterate attributes once
This commit is contained in:
parent
d46f3092e5
commit
b0a6190394
1 changed files with 9 additions and 11 deletions
|
@ -54,12 +54,11 @@ class V18 extends Migration
|
||||||
foreach ($this->documentsIterator($databaseTable) as $collection) {
|
foreach ($this->documentsIterator($databaseTable) as $collection) {
|
||||||
$collectionTable = "{$databaseTable}_collection_{$collection->getInternalId()}";
|
$collectionTable = "{$databaseTable}_collection_{$collection->getInternalId()}";
|
||||||
|
|
||||||
$floats = \array_filter($collection['attributes'] ?? [], function ($attribute) {
|
foreach ($collection['attributes'] ?? [] as $attribute) {
|
||||||
return $attribute['type'] === Database::VAR_FLOAT;
|
if ($attribute['type'] !== Database::VAR_FLOAT) {
|
||||||
});
|
continue;
|
||||||
|
}
|
||||||
foreach ($floats as $attribute) {
|
$this->changeAttributeInternalType($collectionTable, $attribute['$id'], 'DOUBLE');
|
||||||
$this->changeAttributeInternalType($collectionTable, $attribute['key'], 'DOUBLE');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,11 +76,10 @@ class V18 extends Migration
|
||||||
|
|
||||||
Console::log("Migrating Collection \"{$id}\"");
|
Console::log("Migrating Collection \"{$id}\"");
|
||||||
|
|
||||||
$floats = \array_filter($collection['attributes'] ?? [], function ($attribute) {
|
foreach ($collection['attributes'] ?? [] as $attribute) {
|
||||||
return $attribute['type'] === Database::VAR_FLOAT;
|
if ($attribute['type'] !== Database::VAR_FLOAT) {
|
||||||
});
|
continue;
|
||||||
|
}
|
||||||
foreach ($floats as $attribute) {
|
|
||||||
$this->changeAttributeInternalType($id, $attribute['$id'], 'DOUBLE');
|
$this->changeAttributeInternalType($id, $attribute['$id'], 'DOUBLE');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue