prisma-schema-conventions
仓库创建 2026年7月6日最近提交 20 天前SkillHot 收录 20 天前
▸ 精选理由
总结了生产经验的建模规则,利于长期数据一致性与隔离设计。
这个 Skill 做什么
针对 Prisma+Postgres 的多租户与版本化建模约定与实践指南。
为 Prisma + PostgreSQL 的多租户系统定了一套数据建模约定:每行带 workspaceId 做行级隔离,按重要性设计数值字段,用 lineage 做文档版本化,并通过 Postgres 内部队列把审计解耦。在创建或修改 schema.prisma、规划迁移或讨论模型时用。特点是基于生产经验的默认实践,减少日后争议和迁移成本。
▸ 展开 SKILL.md 英文原文
Data modeling conventions for Prisma + PostgreSQL in multi-tenant systems — workspace isolation, numeric criticality, idempotent recurrence, document versioning by lineage and decoupled audit via a queue in Postgres itself. Use whenever creating or changing schema.prisma, designing new entities, planning migrations or discussing data modeling in any project on this stack.
2
Stars
0
Forks
6
仓库内 Skill
+0
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/JoaoEquer/Oficina/main/skills/prisma-schema-conventions/SKILL.md或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/JoaoEquer/Oficina/main/skills/prisma-schema-conventions/SKILL.md"SKILL.MD 节选查看完整文件 ↗
# Prisma schema conventions
Modeling decisions locked in by production experience. They apply to every new entity unless an explicit, recorded decision says otherwise.
## 1. Multi-tenancy: `workspaceId` on every entity
Every business entity carries a `workspaceId` (row-level isolation, single database). Isolation is enforced at the data layer — every query filters by workspace — and the id always comes from the authenticated context, never from client input.
```prisma
model Task {
id String @id @default(uuid())
workspaceId String
workspace Workspace @relation(fields: [workspaceId], references: [id])
// ...
@@index([workspaceId])
}
```
**Watch out**: confirm early via SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有