feat: Initialize database and restructure application source code.

This commit is contained in:
syntaxbullet
2025-12-05 18:52:20 +01:00
parent 1fb59a26cc
commit fdfb2508ae
24 changed files with 55 additions and 255 deletions

19
src/db/schema.ts Normal file
View File

@@ -0,0 +1,19 @@
import { pgTable, integer, text, timestamp, serial } from "drizzle-orm/pg-core";
export const users = pgTable("users", {
userId: text("user_id").primaryKey().notNull(),
balance: integer("balance").notNull().default(0),
lastDaily: timestamp("last_daily"),
dailyStreak: integer("daily_streak").notNull().default(0),
createdAt: timestamp("created_at").defaultNow(),
});
export const transactions = pgTable("transactions", {
transactionId: serial("transaction_id").primaryKey().notNull(),
fromUserId: text("from_user_id").references(() => users.userId),
toUserId: text("to_user_id").references(() => users.userId),
amount: integer("amount").notNull(),
occuredAt: timestamp("occured_at").defaultNow(),
type: text("type").notNull(),
description: text("description"),
});