···11+-- Users table
22+CREATE TABLE IF NOT EXISTS users (
33+ id INTEGER PRIMARY KEY AUTOINCREMENT,
44+ did TEXT UNIQUE NOT NULL,
55+ handle TEXT NOT NULL,
66+ created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
77+ updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
88+);
99+1010+-- Recipes table
1111+CREATE TABLE IF NOT EXISTS recipes (
1212+ id INTEGER PRIMARY KEY AUTOINCREMENT,
1313+ did TEXT NOT NULL,
1414+ title TEXT NOT NULL,
1515+ description TEXT,
1616+ prep_time INTEGER NOT NULL,
1717+ cook_time INTEGER NOT NULL,
1818+ servings TEXT NOT NULL,
1919+ ingredients TEXT NOT NULL,
2020+ steps TEXT NOT NULL,
2121+ type TEXT NOT NULL,
2222+ at_uri TEXT UNIQUE NOT NULL,
2323+ cid TEXT NOT NULL,
2424+ created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
2525+ updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
2626+ FOREIGN KEY (did) REFERENCES users(did)
2727+);
2828+2929+-- Index for faster lookups
3030+CREATE INDEX IF NOT EXISTS idx_recipes_did ON recipes(did);
3131+CREATE INDEX IF NOT EXISTS idx_recipes_type ON recipes(type);
3232+CREATE INDEX IF NOT EXISTS idx_recipes_created ON recipes(created_at DESC);