42 lines
1.2 KiB
PHP
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();
|
|
}
|
|
}
|
|
} |