54 lines
1.8 KiB
PHP
54 lines
1.8 KiB
PHP
<?php
|
|
|
|
use Phinx\Migration\AbstractMigration;
|
|
|
|
final class CreateNotificationlogTable extends AbstractMigration
|
|
{
|
|
public function change(): void
|
|
{
|
|
$this->table('notificationlog', ['id' => 'idnotificationlog'])
|
|
->addColumn('iduser', 'integer', [
|
|
'null' => false,
|
|
'comment' => 'auth_users.id',
|
|
])
|
|
->addColumn('notificationtype', 'string', [
|
|
'limit' => 30,
|
|
'null' => false,
|
|
'comment' => 'lesson / order / certificate',
|
|
])
|
|
->addColumn('idreference', 'integer', [
|
|
'null' => false,
|
|
'comment' => 'Id della lezione, ordine o certificato',
|
|
])
|
|
->addColumn('daysbefore', 'integer', [
|
|
'null' => false,
|
|
'default' => 0,
|
|
])
|
|
->addColumn('sent_at', 'datetime', [
|
|
'default' => 'CURRENT_TIMESTAMP',
|
|
'null' => false,
|
|
])
|
|
->addColumn('status', 'string', [
|
|
'limit' => 20,
|
|
'null' => false,
|
|
'default' => 'sent',
|
|
'comment' => 'sent / failed',
|
|
])
|
|
->addColumn('devicecount', 'integer', [
|
|
'null' => false,
|
|
'default' => 0,
|
|
'comment' => 'A quanti dispositivi e stata inviata',
|
|
])
|
|
->addColumn('errormessage', 'string', [
|
|
'limit' => 255,
|
|
'null' => true,
|
|
])
|
|
->addIndex(
|
|
['iduser', 'notificationtype', 'idreference', 'daysbefore'],
|
|
['unique' => true, 'name' => 'uq_notificationlog_invio']
|
|
)
|
|
->addIndex(['sent_at'], ['name' => 'idx_notificationlog_data'])
|
|
->create();
|
|
}
|
|
}
|