All checks were successful
Docker Build & Push / build-and-push (push) Successful in 15s
- Created ToDo list functionality (CRUD) with household support. - Linked ToDo lists to packing lists and displayed them on the packing list overview page. - Added 'display_name' to users table, allowing separation of login name and display name. - Fixed the irregular '+' click bug in Phase 1 by completely decoupling the local UI state updates from the backend sync latency, relying purely on DOM syncing.
39 lines
1.3 KiB
PHP
39 lines
1.3 KiB
PHP
<?php
|
|
require_once 'src/db_connect.php';
|
|
|
|
$queries = [
|
|
"ALTER TABLE users ADD COLUMN display_name VARCHAR(255) DEFAULT NULL",
|
|
|
|
"CREATE TABLE IF NOT EXISTS todo_lists (
|
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
user_id INT NOT NULL,
|
|
household_id INT DEFAULT NULL,
|
|
name VARCHAR(255) NOT NULL,
|
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
|
|
FOREIGN KEY (household_id) REFERENCES households(id) ON DELETE CASCADE
|
|
)",
|
|
|
|
"CREATE TABLE IF NOT EXISTS todo_items (
|
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
todo_list_id INT NOT NULL,
|
|
title VARCHAR(255) NOT NULL,
|
|
is_completed TINYINT(1) DEFAULT 0,
|
|
order_index INT DEFAULT 0,
|
|
FOREIGN KEY (todo_list_id) REFERENCES todo_lists(id) ON DELETE CASCADE
|
|
)",
|
|
|
|
"ALTER TABLE packing_lists ADD COLUMN todo_list_id INT DEFAULT NULL",
|
|
"ALTER TABLE packing_lists ADD CONSTRAINT fk_packing_list_todo FOREIGN KEY (todo_list_id) REFERENCES todo_lists(id) ON DELETE SET NULL"
|
|
];
|
|
|
|
foreach ($queries as $q) {
|
|
echo "Running: $q\n";
|
|
if (!$conn->query($q)) {
|
|
echo "Error: " . $conn->error . "\n";
|
|
} else {
|
|
echo "Success.\n";
|
|
}
|
|
}
|
|
$conn->close();
|
|
?>
|