1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-23 23:09:37 +02:00
AdventureLog/src/lib/db/schema.ts

50 lines
1.2 KiB
TypeScript
Raw Normal View History

2024-04-03 00:51:12 +00:00
import {
pgTable,
text,
timestamp,
json,
serial,
varchar,
} from "drizzle-orm/pg-core";
2024-04-02 22:02:20 +00:00
export const featuredAdventures = pgTable("featuredAdventures", {
id: serial("id").primaryKey(),
name: text("name").notNull(),
location: text("location"),
});
2024-04-02 22:02:20 +00:00
export const sharedAdventures = pgTable("sharedAdventures", {
id: text("id").primaryKey(),
data: json("data").notNull(),
});
2024-04-03 00:51:12 +00:00
export const userTable = pgTable("user", {
id: text("id").primaryKey(),
username: text("username").notNull(),
first_name: text("first_name").notNull(),
last_name: text("last_name").notNull(),
2024-04-03 00:51:12 +00:00
hashed_password: varchar("hashed_password").notNull(),
});
// export type SelectUser = typeof userTable.$inferSelect;
export const sessionTable = pgTable("session", {
id: text("id").primaryKey(),
userId: text("user_id")
.notNull()
.references(() => userTable.id),
expiresAt: timestamp("expires_at", {
withTimezone: true,
mode: "date",
}).notNull(),
});
export const userVisitedAdventures = pgTable("userVisitedAdventures", {
userId: text("user_id")
.notNull()
.references(() => userTable.id),
adventureName: text("adventure_name").notNull(),
location: text("location"),
adventureVistied: text("adventure_visited"),
});