2024-05-16 12:37:35 +00:00
|
|
|
import { drizzle } from "drizzle-orm/vercel-postgres";
|
|
|
|
import { sql } from "@vercel/postgres";
|
|
|
|
import {
|
|
|
|
pgTable,
|
|
|
|
serial,
|
|
|
|
text,
|
|
|
|
timestamp,
|
|
|
|
uniqueIndex,
|
|
|
|
} from "drizzle-orm/pg-core";
|
2024-05-16 13:29:41 +00:00
|
|
|
import { InferSelectModel } from "drizzle-orm";
|
2024-05-16 12:37:35 +00:00
|
|
|
|
|
|
|
export const UsersTable = pgTable(
|
|
|
|
"users",
|
|
|
|
{
|
|
|
|
id: serial("id").primaryKey(),
|
|
|
|
name: text("name").notNull(),
|
|
|
|
email: text("email").notNull(),
|
|
|
|
image: text("image").notNull(),
|
|
|
|
createdAt: timestamp("createdAt").defaultNow().notNull(),
|
|
|
|
},
|
|
|
|
(users) => {
|
|
|
|
return {
|
|
|
|
uniqueIdx: uniqueIndex("unique_idx").on(users.email),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
);
|
2024-05-16 13:29:41 +00:00
|
|
|
|
|
|
|
export type Users = InferSelectModel<typeof UsersTable>;
|