24 lines
697 B
TypeScript
24 lines
697 B
TypeScript
import { pgTable, uuid, text, timestamp } from "drizzle-orm/pg-core"
|
|
import { authRoles } from "./auth_roles"
|
|
|
|
export const authRolePermissions = pgTable(
|
|
"auth_role_permissions",
|
|
{
|
|
createdAt: timestamp("created_at", { withTimezone: true })
|
|
.notNull()
|
|
.defaultNow(),
|
|
|
|
roleId: uuid("role_id")
|
|
.notNull()
|
|
.references(() => authRoles.id),
|
|
|
|
permission: text("permission").notNull(),
|
|
},
|
|
(table) => ({
|
|
primaryKey: [table.roleId, table.permission],
|
|
})
|
|
)
|
|
|
|
export type AuthRolePermission = typeof authRolePermissions.$inferSelect
|
|
export type NewAuthRolePermission = typeof authRolePermissions.$inferInsert
|