Files
Cibello-app/infrastructure/migrations/0026_light_infant_terrible.sql
T
2026-08-13 02:06:44 +07:00

20 lines
958 B
SQL

CREATE TABLE "gemini_usage" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"task_type" text NOT NULL,
"prompt_tokens" integer,
"output_tokens" integer,
"total_tokens" integer,
"cost_microcents" bigint
);
--> statement-breakpoint
CREATE TABLE "user_terms_consents" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"user_id" uuid NOT NULL,
"terms_version" text NOT NULL,
"accepted_at" timestamp with time zone DEFAULT now() NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "user_terms_consents" ADD CONSTRAINT "user_terms_consents_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
CREATE UNIQUE INDEX "user_terms_consents_user_version_unique" ON "user_terms_consents" USING btree ("user_id","terms_version");