30 lines
659 B
TypeScript
30 lines
659 B
TypeScript
import {
|
|
pgTable,
|
|
uuid,
|
|
timestamp,
|
|
text,
|
|
bigint,
|
|
} from "drizzle-orm/pg-core"
|
|
|
|
import { tenants } from "./tenants"
|
|
|
|
export const devices = pgTable("devices", {
|
|
id: uuid("id").primaryKey().defaultRandom(),
|
|
|
|
createdAt: timestamp("created_at", { withTimezone: true })
|
|
.notNull()
|
|
.defaultNow(),
|
|
|
|
name: text("name").notNull(),
|
|
type: text("type").notNull(),
|
|
|
|
tenant: bigint("tenant", { mode: "number" }).references(() => tenants.id),
|
|
|
|
password: text("password"),
|
|
|
|
externalId: text("externalId"),
|
|
})
|
|
|
|
export type Device = typeof devices.$inferSelect
|
|
export type NewDevice = typeof devices.$inferInsert
|