1+ ALTER TYPE " public" ." grant_type" ADD VALUE ' ad' ;-- > statement-breakpoint
2+ CREATE TABLE "ad_impression " (
3+ " id" text PRIMARY KEY NOT NULL ,
4+ " user_id" text NOT NULL ,
5+ " ad_text" text NOT NULL ,
6+ " title" text NOT NULL ,
7+ " url" text NOT NULL ,
8+ " favicon" text NOT NULL ,
9+ " click_url" text NOT NULL ,
10+ " imp_url" text NOT NULL ,
11+ " payout" numeric (10 , 6 ) NOT NULL ,
12+ " credits_granted" integer NOT NULL ,
13+ " grant_operation_id" text ,
14+ " served_at" timestamp with time zone DEFAULT now() NOT NULL ,
15+ " impression_fired_at" timestamp with time zone ,
16+ " clicked_at" timestamp with time zone ,
17+ CONSTRAINT " ad_impression_imp_url_unique" UNIQUE(" imp_url" )
18+ );
19+ -- > statement-breakpoint
20+ ALTER TABLE " ad_impression" ADD CONSTRAINT " ad_impression_user_id_user_id_fk" FOREIGN KEY (" user_id" ) REFERENCES " public" ." user" (" id" ) ON DELETE cascade ON UPDATE no action;-- > statement-breakpoint
21+ CREATE INDEX "idx_ad_impression_user " ON " ad_impression" USING btree (" user_id" ," served_at" );-- > statement-breakpoint
22+ CREATE INDEX "idx_ad_impression_imp_url " ON " ad_impression" USING btree (" imp_url" );
0 commit comments