Files
zibo-dashboard/db/migrations/20260907130003_add_preferred_line_to_auth_users.php
T
2026-09-07 15:02:36 +02:00

27 lines
841 B
PHP

<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class AddPreferredLineToAuthUsers extends AbstractMigration
{
public function change(): void
{
$this->table('auth_users')
->addColumn('preferred_line_id', 'integer', [
'signed' => true, // production_lines.id è int(11) SIGNED → deve combaciare
'limit' => 11,
'null' => true,
'default' => null,
'after' => 'notify_webapp',
'comment' => 'Linea di produzione preferita per la Line View (NULL = Tutte)',
])
->addForeignKey('preferred_line_id', 'production_lines', 'id', [
'delete' => 'SET_NULL',
'update' => 'NO_ACTION',
])
->update();
}
}