1
0
Fork 0
mirror of synced 2024-07-04 14:10:33 +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
{
\Co\run(function () {
foreach ($this->documentsIterator('attributes') as $attribute) {
go(function ($attribute) {
$attribute->setAttribute('size', Database::LENGTH_KEY);
$this->projectDB->updateDocument('attributes', $attribute->getId(), $attribute);
$databaseInternalId = $attribute->getAttribute('databaseInternalId');
$collectionInternalId = $attribute->getAttribute('collectionInternalId');
$this->changeAttributeInternalType('database_' . $databaseInternalId . '_collection_' . $collectionInternalId, $attribute->getAttribute('key'), 'varchar(255)');
}, $attribute);
foreach ($this->documentsIterator('attributes') as $attribute) {
if ($attribute->getAttribute('format') !== 'enum' || $attribute->getAttribute('size') >= Database::LENGTH_KEY) {
return;
}
});
$attribute->setAttribute('size', Database::LENGTH_KEY);
$this->projectDB->updateDocument('attributes', $attribute->getId(), $attribute);
$databaseInternalId = $attribute->getAttribute('databaseInternalId');
$collectionInternalId = $attribute->getAttribute('collectionInternalId');
$this->projectDB->updateAttribute('database_' . $databaseInternalId . '_collection_' . $collectionInternalId, $attribute->getAttribute('key'), size: 255);
}
}
/**