Files
query-orchestration/docs/database.md
T

97 lines
2.0 KiB
Markdown
Raw Normal View History

# Database schema
To view this diagrem live in vscode use the https://marketplace.visualstudio.com/items?itemName=bierner.markdown-mermaid extension.
You can also edit live with https://mermaid.live
This diagram should be updated manually when there are changes to the database schema.
```mermaid
erDiagram
clients ||--o{ jobs : has
jobs ||--o{ documents : has
jobs ||--|| collectors : has
documents ||--o{ results : has
queries ||--o{ results : has
queries ||--o{ requiredQueries : has
queries ||--o{ queryConfigs : has
collectors ||--o{ collectorQueries : has
collectors ||--o{ collectorCodeVersions : has
queries ||--o{ collectorQueries : references
clients {
uuid id PK
text name UK
boolean canSync
}
jobs {
uuid id PK
uuid clientId FK
boolean canSync
}
documents {
uuid id PK
uuid jobId FK
}
collectors {
uuid id PK
uuid jobId FK
int latestVersion
int activeVersion
}
collectorCodeVersions {
uuid id PK
uuid collectorId FK
int minCleanVersion
int minTextVersion
int addedVersion
int removedVersion
}
queries {
uuid id PK
int latestVersion
int activeVersion
queryType type
}
requiredQueries {
uuid id PK
uuid queryId FK
uuid requiredQueryId FK
int addedVersion
int removedVersion
}
queryConfigs {
uuid id PK
uuid queryId FK
jsonb config
int addedVersion
int removedVersion
}
collectorQueries {
uuid id PK
uuid collectorId FK
varchar name
uuid queryId FK
int addedVersion
int removedVersion
}
results {
uuid id PK
uuid queryId FK
uuid documentId FK
text value
int cleanVersion
int textVersion
int queryVersion
}
```