Files
thetool/db/migrations/20250612124000_add_new_indexes_adb.php
Frank Schubert 568f62bcf9 fixed migration
2025-11-18 20:54:50 +01:00

42 lines
1.2 KiB
PHP

<?php /** @noinspection ALL */
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class AddNewIndexesAdb extends AbstractMigration
{
public function up(): void
{
if ($this->getEnvironment() == "addressdb") {
$wohneinheit = $this->table("Wohneinheit");
$wohneinheit->removeIndexByName('oaid')
->addIndex('oaid', ['name' => 'idx_oaid_full'])
->save();
$wohneinheit->removeIndexByName('extref')
->addIndex('extref', ['name' => 'idx_extref_full', 'limit' => 32])
->save();
}
}
public function down(): void
{
if ($this->getEnvironment() == "addressdb") {
$wohneinheit = $this->table("Wohneinheit");
$wohneinheit->removeIndexByName('idx_oaid_full')
->addIndex('oaid', [
'name' => 'oaid',
'limit' => 10
])
->save();
$wohneinheit->removeIndexByName('idx_extref_full')
->addIndex('extref', [
'name' => 'extref',
'limit' => 10
])
->save();
}
}
}