feat: update database schema for user tracking

main
borja (aider) 3 months ago
parent b00fa4ac23
commit 284e35b0eb

@ -11,7 +11,9 @@ export function initializeDatabase() {
due_date TIMESTAMP NULL,
completed BOOLEAN DEFAULT FALSE,
completed_at TIMESTAMP NULL,
group_id TEXT NOT NULL
group_id TEXT NULL,
created_by TEXT NOT NULL,
FOREIGN KEY (created_by) REFERENCES users(id)
);
CREATE TABLE IF NOT EXISTS task_assignments (
@ -24,10 +26,9 @@ export function initializeDatabase() {
);
CREATE TABLE IF NOT EXISTS users (
phone_number TEXT PRIMARY KEY,
wa_id TEXT NOT NULL, -- WhatsApp's @s.whatsapp.net ID
name TEXT,
last_seen TIMESTAMP
id TEXT PRIMARY KEY, -- WhatsApp user ID (normalized phone number without +)
first_seen TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
last_seen TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS groups (

Loading…
Cancel
Save