1
0
Fork 0
mirror of synced 2024-07-12 18:05:55 +12:00

review changes

This commit is contained in:
prateek banga 2023-11-20 23:31:34 +05:30
parent b2381798ab
commit da3798e52f

View file

@ -648,17 +648,17 @@ class V19 extends Migration
private function migrateEnumAttributeSize(): void private function migrateEnumAttributeSize(): void
{ {
\Co\run(function () {
foreach ($this->documentsIterator('attributes') as $attribute) { foreach ($this->documentsIterator('attributes') as $attribute) {
go(function ($attribute) { if ($attribute->getAttribute('format') !== 'enum' || $attribute->getAttribute('size') >= Database::LENGTH_KEY) {
return;
}
$attribute->setAttribute('size', Database::LENGTH_KEY); $attribute->setAttribute('size', Database::LENGTH_KEY);
$this->projectDB->updateDocument('attributes', $attribute->getId(), $attribute); $this->projectDB->updateDocument('attributes', $attribute->getId(), $attribute);
$databaseInternalId = $attribute->getAttribute('databaseInternalId'); $databaseInternalId = $attribute->getAttribute('databaseInternalId');
$collectionInternalId = $attribute->getAttribute('collectionInternalId'); $collectionInternalId = $attribute->getAttribute('collectionInternalId');
$this->changeAttributeInternalType('database_' . $databaseInternalId . '_collection_' . $collectionInternalId, $attribute->getAttribute('key'), 'varchar(255)'); $this->projectDB->updateAttribute('database_' . $databaseInternalId . '_collection_' . $collectionInternalId, $attribute->getAttribute('key'), size: 255);
}, $attribute);
} }
});
} }
/** /**