35 lines
877 B
PHP
35 lines
877 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use Phinx\Migration\AbstractMigration;
|
|
|
|
final class AdbWohneinheitAddContact extends AbstractMigration
|
|
{
|
|
public function up(): void
|
|
{
|
|
if ($this->getEnvironment() == 'addressdb') {
|
|
$table = $this->table('Wohneinheit');
|
|
if (!$table->hasColumn('contact')) {
|
|
$table->addColumn('contact', 'text', [
|
|
'null' => true,
|
|
'default' => null,
|
|
'after' => 'note'
|
|
])
|
|
->save();
|
|
}
|
|
}
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
if ($this->getEnvironment() == 'addressdb') {
|
|
$table = $this->table('Wohneinheit');
|
|
if ($table->hasColumn('contact')) {
|
|
$table->removeColumn('contact')
|
|
->save();
|
|
}
|
|
}
|
|
}
|
|
}
|