// /__prefabs.ts
import { sql } from "drizzle-orm"
import { datetime, varchar, int } from "drizzle-orm/mysql-core"
import { User } from "./NextAuth"
export const id = int("id").primaryKey().autoincrement()
export const name = varchar("name", { length: 191 }).notNull()
export const slug = varchar("slug", { length: 191 }).notNull()
export const Updated = {
updatedAt: datetime("updatedAt", { mode: "date", fsp: 3 })
.default(sql`CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`)
.notNull(),
updatedById: varchar("updatedById", { length: 191 }).references(
() => User.id,
{ onDelete: "set null", onUpdate: "cascade" }
)
}
// /__prefabs.ts
import { sql } from "drizzle-orm"
import { datetime, varchar, int } from "drizzle-orm/mysql-core"
import { User } from "./NextAuth"
export const id = int("id").primaryKey().autoincrement()
export const name = varchar("name", { length: 191 }).notNull()
export const slug = varchar("slug", { length: 191 }).notNull()
export const Updated = {
updatedAt: datetime("updatedAt", { mode: "date", fsp: 3 })
.default(sql`CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`)
.notNull(),
updatedById: varchar("updatedById", { length: 191 }).references(
() => User.id,
{ onDelete: "set null", onUpdate: "cascade" }
)
}