39 lines
1.0 KiB
TypeScript
39 lines
1.0 KiB
TypeScript
import {
|
|
index,
|
|
integer,
|
|
jsonb,
|
|
pgTable,
|
|
text,
|
|
timestamp,
|
|
uuid,
|
|
} from "drizzle-orm/pg-core";
|
|
import { createInsertSchema, createSelectSchema } from "drizzle-zod";
|
|
import type { z } from "zod";
|
|
|
|
export const opendockApt = pgTable(
|
|
"opendock_apt",
|
|
{
|
|
id: uuid("id").defaultRandom().primaryKey(),
|
|
release: integer("release").notNull().unique("opendock_apt_release_unique"),
|
|
openDockAptId: text("open_dock_apt_id").notNull(),
|
|
appointment: jsonb("appointment").notNull().default([]),
|
|
upd_date: timestamp("upd_date", { withTimezone: true })
|
|
.notNull()
|
|
.defaultNow(),
|
|
createdAt: timestamp("created_at", { withTimezone: true })
|
|
.notNull()
|
|
.defaultNow(),
|
|
},
|
|
(table) => ({
|
|
openDockAptIdIdx: index("opendock_apt_opendock_id_idx").on(
|
|
table.openDockAptId,
|
|
),
|
|
}),
|
|
);
|
|
|
|
export const opendockAptSchema = createSelectSchema(opendockApt);
|
|
export const newOpendockAptSchema = createInsertSchema(opendockApt);
|
|
|
|
export type OpendockApt = z.infer<typeof opendockAptSchema>;
|
|
export type NewOpendockApt = z.infer<typeof newOpendockAptSchema>;
|