-- Migration 003: Add simple user auth columns.
-- This migration adds token-based auth support for the web client.
-- Tables created by 002 (with TEXT ids) take precedence via IF NOT EXISTS.
-- We only add columns/indexes that don't already exist.

-- Add token column to users table if it doesn't exist.
-- SQLite doesn't support IF NOT EXISTS for ALTER TABLE ADD COLUMN,
-- so we check via pragma first.
CREATE TABLE IF NOT EXISTS _migration_003_check (done INTEGER);
INSERT OR IGNORE INTO _migration_003_check VALUES (1);

-- The web chat client's simple tables are only created if migration 002
-- didn't already create them with the ORM schema.
-- Since 002 creates all needed tables, 003 is effectively a no-op
-- when run after 002.
DROP TABLE IF EXISTS _migration_003_check;
