Raw
1 import { model } from "@medusajs/framework/utils"
2
3 const RbacPolicy = model
4 .define("rbac_policy", {
5 id: model.id({ prefix: "rpol" }).primaryKey(),
6 key: model.text().searchable(),
7 resource: model.text().searchable(),
8 operation: model.text().searchable(),
9 name: model.text().searchable().nullable(),
10 description: model.text().nullable(),
11 metadata: model.json().nullable(),
12 })
13 .indexes([
14 {
15 on: ["key"],
16 unique: true,
17 where: "deleted_at IS NULL",
18 },
19 {
20 on: ["resource"],
21 where: "deleted_at IS NULL",
22 },
23 {
24 on: ["operation"],
25 where: "deleted_at IS NULL",
26 },
27 ])
28
29 export default RbacPolicy