mirror of
https://github.com/simstudioai/sim.git
synced 2026-02-06 12:45:07 -05:00
* 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
16 lines
877 B
SQL
16 lines
877 B
SQL
CREATE TABLE "user_stats" (
|
|
"id" text PRIMARY KEY NOT NULL,
|
|
"user_id" text NOT NULL,
|
|
"total_manual_executions" integer DEFAULT 0 NOT NULL,
|
|
"total_api_calls" integer DEFAULT 0 NOT NULL,
|
|
"total_webhook_triggers" integer DEFAULT 0 NOT NULL,
|
|
"total_scheduled_executions" integer DEFAULT 0 NOT NULL,
|
|
"total_tokens_used" integer DEFAULT 0 NOT NULL,
|
|
"total_cost" numeric DEFAULT '0' NOT NULL,
|
|
"last_active" timestamp DEFAULT now() NOT NULL,
|
|
CONSTRAINT "user_stats_user_id_unique" UNIQUE("user_id")
|
|
);
|
|
--> statement-breakpoint
|
|
ALTER TABLE "workflow" ADD COLUMN "run_count" integer DEFAULT 0 NOT NULL;--> statement-breakpoint
|
|
ALTER TABLE "workflow" ADD COLUMN "last_run_at" timestamp;--> statement-breakpoint
|
|
ALTER TABLE "user_stats" ADD CONSTRAINT "user_stats_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action; |