mirror of
https://github.com/sern-handler/automata
synced 2026-06-28 02:32:16 +00:00
48 lines
1.8 KiB
JavaScript
48 lines
1.8 KiB
JavaScript
import { timestamp, pgTable, text, primaryKey, integer, } from "drizzle-orm/pg-core";
|
|
// automata schemas
|
|
export const guideFeedback = pgTable("guideFeedback", {
|
|
id: text("id").notNull().primaryKey(),
|
|
feedback: text("feedback").notNull(),
|
|
route: text("route").notNull(),
|
|
inputText: text("inputText"),
|
|
});
|
|
// next-auth schema
|
|
export const users = pgTable("user", {
|
|
id: text("id").notNull().primaryKey(),
|
|
name: text("name"),
|
|
email: text("email").notNull(),
|
|
emailVerified: timestamp("emailVerified", { mode: "date" }),
|
|
image: text("image"),
|
|
});
|
|
export const accounts = pgTable("account", {
|
|
userId: text("userId")
|
|
.notNull()
|
|
.references(() => users.id, { onDelete: "cascade" }),
|
|
type: text("type").$type().notNull(),
|
|
provider: text("provider").notNull(),
|
|
providerAccountId: text("providerAccountId").notNull(),
|
|
refresh_token: text("refresh_token"),
|
|
access_token: text("access_token"),
|
|
expires_at: integer("expires_at"),
|
|
token_type: text("token_type"),
|
|
scope: text("scope"),
|
|
id_token: text("id_token"),
|
|
session_state: text("session_state"),
|
|
}, (account) => ({
|
|
compoundKey: primaryKey(account.provider, account.providerAccountId),
|
|
}));
|
|
export const sessions = pgTable("session", {
|
|
sessionToken: text("sessionToken").notNull().primaryKey(),
|
|
userId: text("userId")
|
|
.notNull()
|
|
.references(() => users.id, { onDelete: "cascade" }),
|
|
expires: timestamp("expires", { mode: "date" }).notNull(),
|
|
});
|
|
export const verificationTokens = pgTable("verificationToken", {
|
|
identifier: text("identifier").notNull(),
|
|
token: text("token").notNull(),
|
|
expires: timestamp("expires", { mode: "date" }).notNull(),
|
|
}, (vt) => ({
|
|
compoundKey: primaryKey(vt.identifier, vt.token),
|
|
}));
|