Pop Erweiterung auf Adressen

This commit is contained in:
Daniel Spitzer
2026-02-20 11:22:21 +01:00
parent 86bc518663
commit 4d518981fa
7 changed files with 205 additions and 13 deletions

View File

@@ -0,0 +1,36 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class PopAddAddressFields extends AbstractMigration
{
public function up(): void
{
$table = $this->table('Pop');
if (!$table->hasColumn('zip')) {
$table->addColumn('zip', 'string', ['null' => true, 'limit' => 10, 'after' => 'location']);
}
if (!$table->hasColumn('city')) {
$table->addColumn('city', 'string', ['null' => true, 'limit' => 255, 'after' => 'zip']);
}
if (!$table->hasColumn('street')) {
$table->addColumn('street', 'string', ['null' => true, 'limit' => 255, 'after' => 'city']);
}
if (!$table->hasColumn('number')) {
$table->addColumn('number', 'string', ['null' => true, 'limit' => 20, 'after' => 'street']);
}
$table->update();
}
public function down(): void
{
$table = $this->table('Pop');
$table->removeColumn('zip')
->removeColumn('city')
->removeColumn('street')
->removeColumn('number')
->update();
}
}