Skip to content

Commit

Permalink
feat: add manager_permissions and manager_user_permissions tables (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
zzdhybthu authored Nov 17, 2024
1 parent c3124c3 commit 9b3f267
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 0 deletions.
13 changes: 13 additions & 0 deletions metadata/tables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3089,6 +3089,19 @@
permission:
backend_only: false
filter: {}
- table:
name: manager_permissions
schema: public
- table:
name: manager_user_permissions
schema: public
object_relationships:
- name: manager_permission
using:
foreign_key_constraint_on: permission_id
- name: user
using:
foreign_key_constraint_on: uuid
- table:
name: mentor_application
schema: public
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DROP TABLE "public"."manager_permissions";
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CREATE TABLE "public"."manager_permissions" ("permission_id" uuid NOT NULL DEFAULT gen_random_uuid(), "name" text NOT NULL, "description" text, "created_at" timestamptz NOT NULL DEFAULT now(), PRIMARY KEY ("permission_id") , UNIQUE ("permission_id"), UNIQUE ("name"), UNIQUE ("description"));COMMENT ON TABLE "public"."manager_permissions" IS E'管理员权限列表';
CREATE EXTENSION IF NOT EXISTS pgcrypto;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DROP TABLE "public"."manager_user_permissions";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE TABLE "public"."manager_user_permissions" ("uuid" uuid NOT NULL, "permission_id" uuid NOT NULL, "granted_at" timestamptz NOT NULL DEFAULT now(), PRIMARY KEY ("uuid","permission_id") , FOREIGN KEY ("uuid") REFERENCES "public"."users"("uuid") ON UPDATE restrict ON DELETE restrict, FOREIGN KEY ("permission_id") REFERENCES "public"."manager_permissions"("permission_id") ON UPDATE restrict ON DELETE restrict);COMMENT ON TABLE "public"."manager_user_permissions" IS E'每个管理员账户的权限';

0 comments on commit 9b3f267

Please sign in to comment.