33 lines
827 B
TypeScript
33 lines
827 B
TypeScript
// db/schema.ts
|
|
// pnpm drizzle-kit generate:mysql
|
|
// pnpm tsx db/migrate.ts
|
|
import {
|
|
index,
|
|
int,
|
|
mysqlTable,
|
|
bigint,
|
|
varchar,
|
|
timestamp,
|
|
mysqlSchema,
|
|
} from "drizzle-orm/mysql-core";
|
|
|
|
// export const mySchema = mysqlSchema("drizzle_jefes") for creating a new db
|
|
|
|
export const users = mysqlTable(
|
|
"users",
|
|
{
|
|
id: bigint("id", { mode: "number" }).primaryKey().autoincrement(),
|
|
fullName: varchar("full_name", { length: 256 }),
|
|
email: varchar("email", { length: 256 }).notNull(),
|
|
},
|
|
(users) => ({
|
|
nameIdx: index("name_idx").on(users.fullName),
|
|
})
|
|
);
|
|
|
|
export const menuItems = mysqlTable("menu_item", {
|
|
id: bigint("id", { mode: "number" }).primaryKey().autoincrement(),
|
|
itemName: varchar("item_name", { length: 256 }),
|
|
itemDescription: varchar("item_description", { length: 256 }),
|
|
});
|