-- This is a dedicated, optional database, not the social connection service. CREATE TABLE sponsored_members ( subject TEXT PRIMARY KEY, token_digest TEXT NOT NULL UNIQUE, enabled INTEGER NOT NULL DEFAULT 1 CHECK (enabled IN (0, 1)), expires_at INTEGER NOT NULL ); CREATE TABLE sponsored_usage ( id TEXT PRIMARY KEY, subject TEXT NOT NULL, minute INTEGER NOT NULL, day TEXT NOT NULL, month TEXT NOT NULL, operation TEXT NOT NULL, credits INTEGER NOT NULL CHECK (credits > 0) ); CREATE INDEX sponsored_usage_member_day ON sponsored_usage(subject, day); CREATE INDEX sponsored_usage_day ON sponsored_usage(day); CREATE INDEX sponsored_usage_month ON sponsored_usage(month); CREATE INDEX sponsored_usage_minute ON sponsored_usage(minute);