Merge branch 'spidev' into 'master'
Pop Erweiterung auf Adressen See merge request fronk/thetool!2099
This commit is contained in:
36
db/migrations/20260220100000_pop_add_address_fields.php
Normal file
36
db/migrations/20260220100000_pop_add_address_fields.php
Normal 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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user