39 lines
1.4 KiB
PHP
39 lines
1.4 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
use Phinx\Migration\AbstractMigration;
|
|
|
|
final class AddWohneinheitDocumentation extends AbstractMigration
|
|
{
|
|
public function up(): void
|
|
{
|
|
// AddressDB modifications - add documentation table for Wohneinheit
|
|
if ($this->getEnvironment() == "addressdb") {
|
|
$table = $this->table('WohneinheitDocumentation', ['id' => 'id', 'primary_key' => 'id']);
|
|
if (!$table->exists()) {
|
|
$table
|
|
->addColumn('wohneinheit_id', 'integer', ['null' => false])
|
|
->addColumn('fileId', 'integer', ['null' => false])
|
|
->addColumn('description', 'text', ['null' => true])
|
|
->addColumn('documentType', 'string', ['limit' => 100, 'null' => false, 'default' => 'photo'])
|
|
->addColumn('create', 'integer', ['null' => false])
|
|
->addColumn('createBy', 'integer', ['null' => false])
|
|
->addIndex(['wohneinheit_id'], ['name' => 'wohneinheit_id_idx'])
|
|
->addIndex(['fileId'], ['name' => 'fileId_idx'])
|
|
->create();
|
|
}
|
|
}
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
// AddressDB modifications
|
|
if ($this->getEnvironment() == "addressdb") {
|
|
$table = $this->table('WohneinheitDocumentation');
|
|
if ($table->exists()) {
|
|
$table->drop()->save();
|
|
}
|
|
}
|
|
}
|
|
}
|