From a19cfa98f0958a36abef89479e07b9021bcbb971 Mon Sep 17 00:00:00 2001 From: Gemini Agent Date: Mon, 8 Dec 2025 21:28:29 +0000 Subject: [PATCH] Fix: Add Auto-Migration for 'is_template' column in packing_lists.php to prevent SQL errors on deployment --- src/packing_lists.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/packing_lists.php b/src/packing_lists.php index f24a999..94a8e5d 100644 --- a/src/packing_lists.php +++ b/src/packing_lists.php @@ -15,6 +15,14 @@ require_once 'db_connect.php'; require_once 'header.php'; $current_user_id = $_SESSION['user_id']; + +// AUTO-MIGRATION: Check columns to prevent SQL errors +$check_col = $conn->query("SHOW COLUMNS FROM packing_lists LIKE 'is_template'"); +if ($check_col && $check_col->num_rows == 0) { + // Add column if missing + $conn->query("ALTER TABLE packing_lists ADD COLUMN is_template TINYINT(1) NOT NULL DEFAULT 0 AFTER share_token"); +} + $view = isset($_GET['view']) && $_GET['view'] === 'templates' ? 'templates' : 'lists'; $is_template_view = ($view === 'templates');