Files
query-orchestration/docs/database.md
T
Jay Brown 15adaebfcd Merged in feature/serviceconfig-integration (pull request #38)
DRAFT PR : WIP working through ideas for integration

* movearound

* attempttwo

* openapi

* further sanding

* fix

* start on tests

* runthroughsingleconfig

* somechanges

* reflectissue

* removeerrs

* mostlyremovepanic

* removeenv

* noncfgtests

* go

* repo

* fix service config test

* add PWD to all

* test fix

* fix lint

* todo for later

* passingunittests

* alltests

* testlogger

* testloggername

* clean
2025-01-31 13:43:55 +00:00

2.1 KiB

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.

To generate the diagram directly use the following command:

docker run --rm -v $(pwd):/data minlag/mermaid-cli -i /data/diagram.mmd -o /data/output.png -w 1024 -H 768
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
    }