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