27 lines
578 B
TypeScript
27 lines
578 B
TypeScript
// db/schema.ts
|
|
|
|
import {
|
|
index,
|
|
int,
|
|
mysqlTable,
|
|
bigint,
|
|
varchar,
|
|
} from "drizzle-orm/mysql-core";
|
|
|
|
export const users = mysqlTable(
|
|
"users",
|
|
{
|
|
id: bigint("id", { mode: "number" }).primaryKey().autoincrement(),
|
|
fullName: varchar("full_name", { length: 256 }),
|
|
},
|
|
(users) => ({
|
|
nameIdx: index("name_idx").on(users.fullName),
|
|
})
|
|
);
|
|
|
|
export const emails = mysqlTable("email", {
|
|
id: bigint("id", { mode: "number" }).primaryKey().autoincrement(),
|
|
phone: varchar("phone", { length: 256 }),
|
|
userId: int("user_id").references(() => users.id),
|
|
});
|