Refactor architecture: improve env loading and command workflow

This commit is contained in:
syntaxbullet
2025-12-05 12:06:29 +01:00
parent f4b72b93e4
commit 48995204a5
16 changed files with 362 additions and 30 deletions

View File

@@ -0,0 +1,22 @@
CREATE TABLE "transactions" (
"transaction_id" serial PRIMARY KEY NOT NULL,
"from_user_id" text,
"to_user_id" text,
"amount" integer NOT NULL,
"occured_at" timestamp DEFAULT now(),
"type" text NOT NULL,
"description" text,
CONSTRAINT "transactions_transaction_id_unique" UNIQUE("transaction_id")
);
--> statement-breakpoint
CREATE TABLE "users" (
"user_id" text PRIMARY KEY NOT NULL,
"balance" integer DEFAULT 0 NOT NULL,
"last_daily" timestamp,
"daily_streak" integer DEFAULT 0 NOT NULL,
"created_at" timestamp DEFAULT now(),
CONSTRAINT "users_user_id_unique" UNIQUE("user_id")
);
--> statement-breakpoint
ALTER TABLE "transactions" ADD CONSTRAINT "transactions_from_user_id_users_user_id_fk" FOREIGN KEY ("from_user_id") REFERENCES "public"."users"("user_id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "transactions" ADD CONSTRAINT "transactions_to_user_id_users_user_id_fk" FOREIGN KEY ("to_user_id") REFERENCES "public"."users"("user_id") ON DELETE no action ON UPDATE no action;