Introduced New DB

This commit is contained in:
2025-12-06 10:34:58 +01:00
parent 407592680a
commit 63af22b671
80 changed files with 4509 additions and 154 deletions

View File

@@ -0,0 +1,30 @@
import { pgTable, uuid, bigint, timestamp } from "drizzle-orm/pg-core"
import { authUsers } from "./auth_users"
import { authRoles } from "./auth_roles"
export const authUserRoles = pgTable(
"auth_user_roles",
{
createdAt: timestamp("created_at", { withTimezone: true })
.notNull()
.defaultNow(),
userId: uuid("user_id")
.notNull()
.references(() => authUsers.id),
roleId: uuid("role_id")
.notNull()
.references(() => authRoles.id),
tenantId: bigint("tenant_id", { mode: "number" }).notNull(),
createdBy: uuid("created_by").references(() => authUsers.id),
},
(table) => ({
primaryKey: [table.userId, table.roleId, table.tenantId],
})
)
export type AuthUserRole = typeof authUserRoles.$inferSelect
export type NewAuthUserRole = typeof authUserRoles.$inferInsert