Introduced New DB
This commit is contained in:
44
db/schema/texttemplates.ts
Normal file
44
db/schema/texttemplates.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import {
|
||||
pgTable,
|
||||
bigint,
|
||||
text,
|
||||
timestamp,
|
||||
boolean,
|
||||
jsonb,
|
||||
uuid,
|
||||
} from "drizzle-orm/pg-core"
|
||||
|
||||
import { tenants } from "./tenants"
|
||||
import { authUsers } from "./auth_users"
|
||||
import { textTemplatePositionsEnum } from "./enums"
|
||||
|
||||
export const textTemplates = pgTable("texttemplates", {
|
||||
id: bigint("id", { mode: "number" })
|
||||
.primaryKey()
|
||||
.generatedByDefaultAsIdentity(),
|
||||
|
||||
createdAt: timestamp("created_at", { withTimezone: true })
|
||||
.notNull()
|
||||
.defaultNow(),
|
||||
|
||||
tenant: bigint("tenant", { mode: "number" })
|
||||
.notNull()
|
||||
.references(() => tenants.id),
|
||||
|
||||
name: text("name").notNull(),
|
||||
text: text("text").notNull(),
|
||||
|
||||
documentType: text("documentType").default(""),
|
||||
|
||||
default: boolean("default").notNull().default(false),
|
||||
|
||||
pos: textTemplatePositionsEnum("pos").notNull(),
|
||||
|
||||
archived: boolean("archived").notNull().default(false),
|
||||
|
||||
updatedAt: timestamp("updated_at", { withTimezone: true }),
|
||||
updatedBy: uuid("updated_by").references(() => authUsers.id),
|
||||
})
|
||||
|
||||
export type TextTemplate = typeof textTemplates.$inferSelect
|
||||
export type NewTextTemplate = typeof textTemplates.$inferInsert
|
||||
Reference in New Issue
Block a user