mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-07 12:27:44 +00:00
42 lines
1.0 KiB
TypeScript
42 lines
1.0 KiB
TypeScript
import {
|
|
pgTable,
|
|
text,
|
|
integer,
|
|
timestamp,
|
|
boolean,
|
|
} from "drizzle-orm/pg-core";
|
|
|
|
export const user = pgTable("user", {
|
|
id: text("id").primaryKey(),
|
|
name: text("name").notNull(),
|
|
email: text("email").notNull().unique(),
|
|
emailVerified: boolean("emailVerified").notNull(),
|
|
image: text("image"),
|
|
createdAt: timestamp("createdAt").notNull(),
|
|
updatedAt: timestamp("updatedAt").notNull(),
|
|
});
|
|
|
|
export const session = pgTable("session", {
|
|
id: text("id").primaryKey(),
|
|
expiresAt: timestamp("expiresAt").notNull(),
|
|
ipAddress: text("ipAddress"),
|
|
userAgent: text("userAgent"),
|
|
userId: text("userId")
|
|
.notNull()
|
|
.references(() => user.id),
|
|
});
|
|
|
|
export const account = pgTable("account", {
|
|
id: text("id").primaryKey(),
|
|
accountId: text("accountId").notNull(),
|
|
providerId: text("providerId").notNull(),
|
|
userId: text("userId")
|
|
.notNull()
|
|
.references(() => user.id),
|
|
accessToken: text("accessToken"),
|
|
refreshToken: text("refreshToken"),
|
|
idToken: text("idToken"),
|
|
expiresAt: timestamp("expiresAt"),
|
|
password: text("password"),
|
|
});
|