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(); } }