import {
    pgTable,
    bigint,
    timestamp,
    text,
} from "drizzle-orm/pg-core"

export const units = pgTable("units", {
    id: bigint("id", { mode: "number" })
        .primaryKey()
        .generatedByDefaultAsIdentity(),

    createdAt: timestamp("created_at", { withTimezone: true })
        .notNull()
        .defaultNow(),

    name: text("name").notNull(),
    single: text("single").notNull(),

    multiple: text("multiple"),
    short: text("short"),

    step: text("step").notNull().default("1"),
})

export type Unit = typeof units.$inferSelect
export type NewUnit = typeof units.$inferInsert
