32 lines
1009 B
TypeScript
32 lines
1009 B
TypeScript
import {
|
|
boolean,
|
|
integer,
|
|
pgTable,
|
|
text,
|
|
timestamp,
|
|
uuid,
|
|
} from "drizzle-orm/pg-core";
|
|
import { createInsertSchema, createSelectSchema } from "drizzle-zod";
|
|
import type { z } from "zod";
|
|
|
|
export const datamart = pgTable("datamart", {
|
|
id: uuid("id").defaultRandom().primaryKey(),
|
|
name: text("name").unique(),
|
|
description: text("description").notNull(),
|
|
query: text("query"),
|
|
version: integer("version").default(1).notNull(),
|
|
active: boolean("active").default(true),
|
|
options: text("options").default(""),
|
|
public: boolean("public_access").default(false),
|
|
add_date: timestamp("add_date").defaultNow(),
|
|
add_user: text("add_user").default("lst-system"),
|
|
upd_date: timestamp("upd_date").defaultNow(),
|
|
upd_user: text("upd_user").default("lst-system"),
|
|
});
|
|
|
|
export const datamartSchema = createSelectSchema(datamart);
|
|
export const newDataMartSchema = createInsertSchema(datamart);
|
|
|
|
export type Datamart = z.infer<typeof datamartSchema>;
|
|
export type NewDatamart = z.infer<typeof newDataMartSchema>;
|