Skip to content

Commit

Permalink
feat: define type
Browse files Browse the repository at this point in the history
  • Loading branch information
guan404ming committed Apr 27, 2024
1 parent 1777073 commit 11e7a52
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/db/schema.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
import {
index,
pgTable,
serial,
varchar,
} from "drizzle-orm/pg-core";
import { index, pgTable, serial, varchar } from "drizzle-orm/pg-core";

export const userTable = pgTable(
"USER",
"users",
{
id: serial("id").primaryKey(),
username: varchar("username", { length: 100 }).notNull(),
username: varchar("name", { length: 100 }).notNull(),
email: varchar("email", { length: 100 }).notNull().unique(),
},
(table) => ({
emailIndex: index("email_index").on(table.email),
}),
);
);
3 changes: 3 additions & 0 deletions src/lib/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import type { userTable } from "@/db/schema";

export type SelectUser = typeof userTable.$inferSelect;

0 comments on commit 11e7a52

Please sign in to comment.