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');