init: initial commit

This commit is contained in:
syntaxbullet
2025-12-02 20:53:49 +01:00
commit 25c7ba46f0
17 changed files with 578 additions and 0 deletions

19
app/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().unique(),
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().unique(),
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"),
});