update db migrations

This commit is contained in:
Flatlogic Bot 2026-04-13 16:33:50 +00:00
parent 80a446c20f
commit 06c06718a0

View File

@ -11,6 +11,20 @@ $can_add = canAdd('events');
$can_edit = canEdit('events');
$can_delete = canDelete('events');
// Auto-create table if missing (useful for deployed environments that haven't run migrations)
try {
db()->query("SELECT 1 FROM events LIMIT 1");
} catch (Exception $e) {
try {
$sql = file_get_contents(__DIR__ . '/db/migrations/037_add_events_module.sql');
if ($sql) {
db()->exec($sql);
}
} catch (Exception $e2) {
// Silently ignore, let the AJAX or save functions report the error
}
}
// Handle AJAX requests
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_GET['ajax'])) {
ob_clean(); header('Content-Type: application/json');