Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,45 @@
|
||||
// P4 EntityLink (AK-P4b) — Gate W1 deliverable.
|
||||
//
|
||||
// AD-21: one self-contained schema file per module. `tenantId` /
|
||||
// `createdByUserId` are intentionally BARE String scalars (no `@relation`).
|
||||
//
|
||||
// Generic, fully polymorphic link between any two entities. Both sides
|
||||
// (source + target) are polymorphic so every later module docks onto this one
|
||||
// table instead of building its own link table. Reusable cross-cutting
|
||||
// primitive: R-P6 ff. attach Task<->CRM, File<->CRM (beyond FileEntityLink),
|
||||
// and any future relation here.
|
||||
//
|
||||
// Note: `FileEntityLink` (files.prisma) predates this table and stays as-is for
|
||||
// the file-specific upload flow; new generic links use `EntityLink`.
|
||||
|
||||
enum LinkableEntityType {
|
||||
contact
|
||||
company
|
||||
lead
|
||||
deal
|
||||
project
|
||||
task
|
||||
file
|
||||
user
|
||||
order
|
||||
appointment
|
||||
form_submission
|
||||
}
|
||||
|
||||
/// A directed, role-labelled link from one entity to another, scoped per tenant.
|
||||
/// Idempotent on the unique tuple (upsert in entityLinkService).
|
||||
model EntityLink {
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
tenantId String
|
||||
createdByUserId String
|
||||
sourceType LinkableEntityType
|
||||
sourceId String
|
||||
targetType LinkableEntityType
|
||||
targetId String
|
||||
linkRole String? // optional role label (e.g. "depends-on", "reference")
|
||||
|
||||
@@unique([tenantId, sourceType, sourceId, targetType, targetId])
|
||||
@@index([tenantId, targetType, targetId])
|
||||
@@index([tenantId, sourceType, sourceId])
|
||||
}
|
||||
Reference in new issue
Block a user