37338-vm/db/migrations/033_fix_person_id_in_meeting_attendance.php
2026-01-11 12:14:53 +00:00

23 lines
557 B
PHP

<?php
require_once __DIR__ . '/../../db/config.php';
try {
$db = db();
$db->exec("
ALTER TABLE meeting_attendance
MODIFY COLUMN person_id INT(11) UNSIGNED NOT NULL;
");
$db->exec("
ALTER TABLE meeting_attendance
ADD CONSTRAINT fk_person_id FOREIGN KEY (person_id) REFERENCES people(id) ON DELETE CASCADE;
");
echo "Migration 033 run successfully: Changed person_id to UNSIGNED and added foreign key.\n";
} catch (PDOException $e) {
die("Migration 033 failed: " . $e->getMessage() . "\n");
}