44 lines
1.1 KiB
PHP
44 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use Phinx\Migration\AbstractMigration;
|
|
|
|
final class AddNotifyFunctionToScadDeadlines extends AbstractMigration
|
|
{
|
|
public function up(): void
|
|
{
|
|
if (!$this->hasTable('scad_deadlines')) {
|
|
throw new RuntimeException('Table scad_deadlines does not exist.');
|
|
}
|
|
|
|
$table = $this->table('scad_deadlines');
|
|
|
|
if (!$table->hasColumn('notify_function')) {
|
|
$table
|
|
->addColumn('notify_function', 'boolean', [
|
|
'null' => false,
|
|
'default' => false,
|
|
'after' => 'function_id',
|
|
'comment' => 'Send deadline reminder also to the linked function email',
|
|
])
|
|
->update();
|
|
}
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
if (!$this->hasTable('scad_deadlines')) {
|
|
return;
|
|
}
|
|
|
|
$table = $this->table('scad_deadlines');
|
|
|
|
if ($table->hasColumn('notify_function')) {
|
|
$table
|
|
->removeColumn('notify_function')
|
|
->update();
|
|
}
|
|
}
|
|
}
|