feat: 系统资源表
This commit is contained in:
14
server/prisma/migrations/20250311054029_/migration.sql
Normal file
14
server/prisma/migrations/20250311054029_/migration.sql
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- A unique constraint covering the columns `[permission]` on the table `sys_resource` will be added. If there are existing duplicate values, this will fail.
|
||||
|
||||
*/
|
||||
-- DropIndex
|
||||
DROP INDEX "sys_resource_name_type_key";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "sys_resource" ADD COLUMN "permission" TEXT;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "sys_resource_permission_key" ON "sys_resource"("permission");
|
||||
@@ -107,15 +107,14 @@ model SysResource {
|
||||
id String @id @default(cuid()) /// 主键id
|
||||
createdAt DateTime @default(now()) @map("created_at") /// 创建时间
|
||||
updatedAt DateTime @updatedAt @map("updated_at") /// 修改时间
|
||||
name String
|
||||
path String? /// 菜单或api路径
|
||||
name String /// 菜单名称或者接口名称
|
||||
path String? @unique() /// 菜单或api路径
|
||||
permission String? @unique() /// 权限字符
|
||||
parentId String? @map("parent_id")
|
||||
sort Int @default(0)
|
||||
type Int /// 资源类型 0:菜单 1:api
|
||||
sysResourcePermission SysResourcePermission[]
|
||||
|
||||
@@unique([name, type])
|
||||
@@unique([path])
|
||||
@@map("sys_resource")
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ const prisma = new PrismaClient();
|
||||
|
||||
enum PermissionType {
|
||||
Menu,
|
||||
API,
|
||||
Api,
|
||||
}
|
||||
|
||||
async function main() {
|
||||
|
||||
Reference in New Issue
Block a user