mirror of
https://gitea.gofwd.group/dstrawsb/ballistic-builder.git
synced 2025-12-06 02:36:44 -05:00
19 lines
755 B
TypeScript
19 lines
755 B
TypeScript
import { bigint, bigserial, foreignKey, pgTable, text, timestamp } from "drizzle-orm/pg-core";
|
|
import { users } from "./User";
|
|
|
|
export const userActivityLog = pgTable("user_activity_log", {
|
|
id: bigserial({ mode: "bigint" }).primaryKey().notNull(),
|
|
// You can use { mode: "bigint" } if numbers are exceeding js number limitations
|
|
userId: bigint("user_id", { mode: "number" }).notNull(),
|
|
activity: text().notNull(),
|
|
timestamp: timestamp({ mode: 'string' }).default(sql`CURRENT_TIMESTAMP`),
|
|
}, (table) => {
|
|
return {
|
|
userActivityLogUserIdFkey: foreignKey({
|
|
columns: [table.userId],
|
|
foreignColumns: [users.id],
|
|
name: "user_activity_log_user_id_fkey"
|
|
}).onDelete("cascade"),
|
|
}
|
|
});
|