Commit ec725ab5 authored by Mahmoud Aglan's avatar Mahmoud Aglan

fix(service-desk): make carnet_id/member_id nullable for walk-in guests

The service desk ticket form allows issuing tickets to walk-in guests
without a carnet or membership, but the carnet_guest_entries table had
NOT NULL + FK constraints on both columns, causing a 500 error.
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 66ed84c2
<?php
declare(strict_types=1);
return function (\App\Core\Database $db): void {
$db->raw("ALTER TABLE carnet_guest_entries DROP FOREIGN KEY fk_cge_carnet");
$db->raw("ALTER TABLE carnet_guest_entries DROP FOREIGN KEY fk_cge_member");
$db->raw("ALTER TABLE carnet_guest_entries MODIFY carnet_id BIGINT UNSIGNED NULL DEFAULT NULL");
$db->raw("ALTER TABLE carnet_guest_entries MODIFY member_id BIGINT UNSIGNED NULL DEFAULT NULL");
$db->raw("ALTER TABLE carnet_guest_entries ADD CONSTRAINT fk_cge_carnet FOREIGN KEY (carnet_id) REFERENCES carnets(id) ON DELETE SET NULL");
$db->raw("ALTER TABLE carnet_guest_entries ADD CONSTRAINT fk_cge_member FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL");
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment