-- A small directory copy of each site's status (its rows live in RepoState), refreshed by the site scope's alarm, -- so platform-wide admin counts are one D1 query instead of a read of every site scope. CREATE TABLE IF NOT EXISTS site_directory ( site_id TEXT PRIMARY KEY, scope_id TEXT NOT NULL, owner_id TEXT, active INTEGER NOT NULL, scratch INTEGER NOT NULL, expires_at INTEGER, paused_at INTEGER, disabled INTEGER NOT NULL, updated_at INTEGER NOT NULL ); CREATE INDEX IF NOT EXISTS site_directory_scope ON site_directory(scope_id); CREATE INDEX IF NOT EXISTS site_directory_owner ON site_directory(owner_id);