Files
sim/packages/db/migrations/0056_adorable_franklin_richards.sql
Vikhyath Mondreti 9de7a00373 improvement(code-structure): move db into separate package (#1364)
* improvement(code-structure): move db into separate package

* make db separate package

* remake bun lock

* update imports to not maintain two separate ones

* fix CI for tests by adding dummy url

* vercel build fix attempt

* update bun lock

* regenerate bun lock

* fix mocks

* remove db commands from apps/sim package json
2025-09-17 15:41:13 -07:00

11 lines
565 B
SQL

CREATE TABLE "user_rate_limits" (
"user_id" text PRIMARY KEY NOT NULL,
"sync_api_requests" integer DEFAULT 0 NOT NULL,
"async_api_requests" integer DEFAULT 0 NOT NULL,
"window_start" timestamp DEFAULT now() NOT NULL,
"last_request_at" timestamp DEFAULT now() NOT NULL,
"is_rate_limited" boolean DEFAULT false NOT NULL,
"rate_limit_reset_at" timestamp
);
--> statement-breakpoint
ALTER TABLE "user_rate_limits" ADD CONSTRAINT "user_rate_limits_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;