33 lines
1.1 KiB
PHP
33 lines
1.1 KiB
PHP
<?php
|
|
require_once __DIR__ . '/config.php';
|
|
|
|
try {
|
|
$pdo = db();
|
|
|
|
// Create clients table
|
|
$pdo->exec("CREATE TABLE IF NOT EXISTS clients (
|
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
name VARCHAR(255) NOT NULL,
|
|
job VARCHAR(255),
|
|
age_range VARCHAR(50),
|
|
hobbies TEXT,
|
|
current_day INT DEFAULT 1,
|
|
status ENUM('active', 'paused', 'completed') DEFAULT 'active',
|
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;");
|
|
|
|
// Create interactions table to log daily progress
|
|
$pdo->exec("CREATE TABLE IF NOT EXISTS interactions (
|
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
client_id INT NOT NULL,
|
|
day_number INT NOT NULL,
|
|
notes TEXT,
|
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
FOREIGN KEY (client_id) REFERENCES clients(id) ON DELETE CASCADE
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;");
|
|
|
|
} catch (PDOException $e) {
|
|
error_log("DB Init Error: " . $e->getMessage());
|
|
}
|