mirror of
https://gitea.gofwd.group/dstrawsb/ballistic-builder.git
synced 2025-12-06 10:46:44 -05:00
fixes, more fixes
This commit is contained in:
18
src/db/schema/UserActivity.ts
Normal file
18
src/db/schema/UserActivity.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
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"),
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user