kioai / lib /db /src /schema /creditTransactions.ts
kinaiok
Initial deployment setup for Hugging Face Spaces
5ef6e9d
import { pgTable, serial, integer, text, timestamp } from "drizzle-orm/pg-core";
import { usersTable } from "./users";
export const creditTransactionsTable = pgTable("credit_transactions", {
id: serial("id").primaryKey(),
userId: integer("user_id").notNull().references(() => usersTable.id, { onDelete: "cascade" }),
amount: integer("amount").notNull(),
type: text("type").notNull(),
description: text("description"),
createdAt: timestamp("created_at").defaultNow().notNull(),
});
export type CreditTransaction = typeof creditTransactionsTable.$inferSelect;