31 lines
1.1 KiB
PHP
31 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use Phinx\Migration\AbstractMigration;
|
|
|
|
final class AddPropagationTracking extends AbstractMigration
|
|
{
|
|
public function change(): void
|
|
{
|
|
// Tabella che raggruppa ogni propagazione
|
|
$table = $this->table('propagation', ['id' => 'idpropagation']);
|
|
$table->addColumn('idservice', 'integer')
|
|
->addColumn('token', 'string', ['limit' => 64])
|
|
->addColumn('startdate', 'date', ['null' => true])
|
|
->addColumn('enddate', 'date', ['null' => true])
|
|
->addColumn('created_at', 'datetime', ['default' => 'CURRENT_TIMESTAMP'])
|
|
->addIndex(['token'], ['unique' => true])
|
|
->addIndex(['idservice'])
|
|
->create();
|
|
|
|
// Campo token sulle singole occorrenze del calendario
|
|
$schedule = $this->table('serviceschedule');
|
|
if (!$schedule->hasColumn('propagation_token')) {
|
|
$schedule->addColumn('propagation_token', 'string', ['limit' => 64, 'null' => true])
|
|
->addIndex(['propagation_token'])
|
|
->update();
|
|
}
|
|
}
|
|
}
|