# KGEntity

**Kind:** Database Model

**Source:** [`atloria-monorepo/libs/database/prisma/schema.prisma`](https://github.com/sherkety/atloria/blob/main/atloria-monorepo/libs/database/prisma/schema.prisma#L730)

## Fields

| Field | Type | Required | Key |
|---|---|---|---|
| `id` | `String` | ✓ | PK |
| `projectId` | `String` | ✓ |  |
| `type` | `EntityType` | ✓ |  |
| `name` | `String` | ✓ |  |
| `metadata` | `Json` | ✓ |  |
| `contentHash` | `String` | - |  |
| `lastScannedAt` | `DateTime` | - |  |
| `createdAt` | `DateTime` | ✓ |  |
| `updatedAt` | `DateTime` | ✓ |  |

## Diagram

```mermaid
erDiagram
    KGEntity {
        id String [PK]
        projectId String
        type EntityType
        name String
        metadata Json
        contentHash String?
        lastScannedAt DateTime?
        createdAt DateTime
        updatedAt DateTime
    }
    KGEntity ||--|| Project : ""
    KGEntity ||--}o KGRelationship : ""
    KGEntity ||--}o KGRelationship : ""
```

## Relationships

- HAS_ONE → `Project`
- HAS_ONE → `KGRelationship`
- HAS_ONE → `KGRelationship`
