···11+CREATE TABLE IF NOT EXISTS "user_app_stats" (
22+ "did" text NOT NULL REFERENCES "profiles"("did") ON DELETE CASCADE,
33+ "app_id" text NOT NULL,
44+ "is_active" boolean NOT NULL DEFAULT false,
55+ "recent_count" integer NOT NULL DEFAULT 0,
66+ "latest_record_at" timestamptz,
77+ "refreshed_at" timestamptz NOT NULL DEFAULT now(),
88+ "visible" boolean NOT NULL DEFAULT true,
99+ "created_at" timestamptz NOT NULL DEFAULT now(),
1010+ PRIMARY KEY ("did", "app_id")
1111+);
1212+1313+CREATE INDEX IF NOT EXISTS "idx_user_app_stats_app_count" ON "user_app_stats" ("app_id", "recent_count");
1414+CREATE INDEX IF NOT EXISTS "idx_user_app_stats_refreshed" ON "user_app_stats" ("refreshed_at");
1515+CREATE INDEX IF NOT EXISTS "idx_user_app_stats_visible" ON "user_app_stats" ("did", "visible", "recent_count");
1616+1717+CREATE TABLE IF NOT EXISTS "suppressed_dids" (
1818+ "did" text PRIMARY KEY,
1919+ "requested_at" timestamptz NOT NULL DEFAULT now()
2020+);