added new fcp statistics

This commit is contained in:
2025-09-12 09:18:15 +02:00
parent 900b9232b4
commit 8e6ab15fef
5 changed files with 218 additions and 16 deletions
@@ -0,0 +1,53 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class AddRimoFcpIndex extends AbstractMigration
{
public function up(): void
{
if ($this->getEnvironment() == "addressdb") {
$table = $this->table('Hausnummer');
if (!$table->hasIndexByName('idx_fcp_id_rimo_type')) {
$table->addIndex(['fcp_id', 'rimo_type'], ['name' => 'idx_fcp_id_rimo_type'])
->update();
}
}
if ($this->getEnvironment() == "thetool") {
$table = $this->table('Preorder');
if (!$table->hasIndexByName('idx_adb_hausnummer_id')) {
$table->addIndex(['adb_hausnummer_id'], ['name' => 'idx_adb_hausnummer_id']);
}
if (!$table->hasIndexByName('idx_status_id')) {
$table->addIndex(['status_id'], ['name' => 'idx_status_id']);
}
$table->update();
}
}
public function down(): void
{
if ($this->getEnvironment() == "addressdb") {
$table = $this->table('Hausnummer');
if ($table->hasIndexByName('idx_fcp_id_rimo_type')) {
$table->removeIndexByName('idx_fcp_id_rimo_type')
->update();
}
}
if ($this->getEnvironment() == "thetool") {
$table = $this->table('Preorder');
if ($table->hasIndexByName('idx_adb_hausnummer_id')) {
$table->removeIndexByName('idx_adb_hausnummer_id');
}
if ($table->hasIndexByName('idx_status_id')) {
$table->removeIndexByName('idx_status_id');
}
$table->update();
}
}
}