54 lines
2.9 KiB
PHP
54 lines
2.9 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use Phinx\Migration\AbstractMigration;
|
|
|
|
/**
|
|
* Schermo di reparto (kiosk) per la sala pausa.
|
|
*
|
|
* kiosk_settings impostazioni chiave/valore (durata slide, slide attive, sicurezza, meteo, codice di accesso)
|
|
* kiosk_items contenuti scritti dal manager: comunicazioni, benvenuti, turni, menu, avvisi scorrevoli
|
|
* kiosk_goals obiettivi con barra di avanzamento (manuali o calcolati dai dati di produzione)
|
|
*/
|
|
final class CreateKiosk extends AbstractMigration
|
|
{
|
|
public function change(): void
|
|
{
|
|
$this->table('kiosk_settings', ['id' => false, 'primary_key' => ['setting_key'], 'comment' => 'Impostazioni schermo di reparto'])
|
|
->addColumn('setting_key', 'string', ['limit' => 50])
|
|
->addColumn('setting_value', 'text', ['null' => true])
|
|
->addColumn('updated_at', 'datetime', ['null' => true])
|
|
->create();
|
|
|
|
$this->table('kiosk_items', ['comment' => 'Contenuti dello schermo di reparto'])
|
|
->addColumn('item_type', 'string', ['limit' => 20, 'comment' => 'comunicazione, benvenuto, turni, menu, ticker'])
|
|
->addColumn('title', 'string', ['limit' => 150, 'default' => ''])
|
|
->addColumn('body', 'text', ['null' => true])
|
|
->addColumn('image', 'string', ['limit' => 255, 'default' => ''])
|
|
->addColumn('valid_from', 'date', ['null' => true])
|
|
->addColumn('valid_to', 'date', ['null' => true])
|
|
->addColumn('sort', 'integer', ['default' => 0])
|
|
->addColumn('active', 'boolean', ['default' => true])
|
|
->addColumn('created_by', 'string', ['limit' => 100, 'default' => ''])
|
|
->addColumn('created_at', 'datetime', ['null' => true])
|
|
->addColumn('updated_at', 'datetime', ['null' => true])
|
|
->addIndex(['item_type', 'active'])
|
|
->create();
|
|
|
|
$this->table('kiosk_goals', ['comment' => 'Obiettivi mostrati sullo schermo di reparto'])
|
|
->addColumn('title', 'string', ['limit' => 150])
|
|
->addColumn('source', 'string', ['limit' => 30, 'default' => 'manuale', 'comment' => 'manuale, metri_mese, kg_mese, lavori_mese, scarto_mese, fermi_mese'])
|
|
->addColumn('unit', 'string', ['limit' => 20, 'default' => ''])
|
|
->addColumn('target', 'decimal', ['precision' => 15, 'scale' => 2, 'default' => 0])
|
|
->addColumn('current_value', 'decimal', ['precision' => 15, 'scale' => 2, 'null' => true, 'comment' => 'Solo per gli obiettivi manuali'])
|
|
->addColumn('lower_is_better', 'boolean', ['default' => false])
|
|
->addColumn('period_from', 'date', ['null' => true])
|
|
->addColumn('period_to', 'date', ['null' => true])
|
|
->addColumn('sort', 'integer', ['default' => 0])
|
|
->addColumn('active', 'boolean', ['default' => true])
|
|
->addColumn('updated_at', 'datetime', ['null' => true])
|
|
->create();
|
|
}
|
|
}
|