Skip to content

Commit 0f2487b

Browse files
committed
Cache free-mode country access
1 parent 99b3d0a commit 0f2487b

9 files changed

Lines changed: 3828 additions & 47 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
CREATE TABLE "free_mode_country_access_cache" (
2+
"user_id" text NOT NULL,
3+
"client_ip_hash" text NOT NULL,
4+
"allowed" boolean NOT NULL,
5+
"country_code" text,
6+
"cf_country" text,
7+
"geoip_country" text,
8+
"country_block_reason" text,
9+
"ip_privacy_signals" text[],
10+
"checked_at" timestamp with time zone NOT NULL,
11+
"expires_at" timestamp with time zone NOT NULL,
12+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
13+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
14+
CONSTRAINT "free_mode_country_access_cache_user_id_client_ip_hash_pk" PRIMARY KEY("user_id","client_ip_hash")
15+
);
16+
--> statement-breakpoint
17+
ALTER TABLE "free_mode_country_access_cache" ADD CONSTRAINT "free_mode_country_access_cache_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
18+
CREATE INDEX "idx_free_mode_country_cache_expires_at" ON "free_mode_country_access_cache" USING btree ("expires_at");

0 commit comments

Comments
 (0)