Files
ThothII/docs/architecture/thothii-metadata-catalog.erd.json
CodexandClaude Opus 5.5 0adda6e8af docs: add complete Archify architecture diagram set
Thirteen source-backed interactive diagrams in docs/architecture with an
index page (thothii-diagrams.html): runtime and deployment architecture,
module tree, F1-F8 workflow, session and catalog-sync lifecycles,
new-question, gate round-trip, resume and OIDC sequences, session runtime
classes, metadata dataflow and Metadata Catalog ERD. Replaces the old
thothii-core sequence diagram.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 12:24:07 +02:00

1183 lines
26 KiB
JSON

{
"schema_version": 1,
"diagram_type": "erd",
"meta": {
"title": "ThothII — Metadata Catalog (PostgreSQL)",
"locale": "it",
"output": "docs/architecture/thothii-metadata-catalog.html",
"quality_profile": "standard",
"repository": {
"url": "https://git.tylconsulting.it/mptyl/ThothII.git",
"link_mode": "local-only",
"revision": "31e6d3a162e9e5ac71fc2d8da4fe44b16c06aae3"
}
},
"layout": {
"mode": "grid"
},
"entities": [
{
"id": "workspace_databases",
"label": "workspace_databases",
"tag": "database",
"row": 0,
"col": 0,
"attributes": [
{
"name": "id",
"type": "uuid",
"key": "pk"
},
{
"name": "workspace_id",
"type": "text",
"key": "uk"
},
{
"name": "engine",
"type": "text"
},
{
"name": "database_name",
"type": "text"
},
{
"name": "schema_name",
"type": "text"
},
{
"name": "version",
"type": "integer"
},
{
"name": "created_at",
"type": "timestamptz"
},
{
"name": "updated_at",
"type": "timestamptz"
},
{
"name": "schema_synced_version",
"type": "integer"
},
{
"name": "schema_synced_at",
"type": "timestamptz"
},
{
"name": "metadata_content_revision",
"type": "bigint"
},
{
"name": "preprocessing_status",
"type": "text"
},
{
"name": "preprocessing_input_fingerprint",
"type": "text"
},
{
"name": "preprocessed_metadata_revision",
"type": "bigint"
},
{
"name": "preprocessing_started_at",
"type": "timestamptz"
},
{
"name": "preprocessing_finished_at",
"type": "timestamptz"
},
{
"name": "preprocessing_error_code",
"type": "text"
},
{
"name": "preprocessing_run_id",
"type": "text"
}
],
"sources": [
{
"path": "backend/src/catalog/migrations/001_workspace_databases.ts",
"line": 5,
"end_line": 16
},
{
"path": "backend/src/catalog/migrations/013_catalog_preprocessing_state.ts",
"line": 5,
"end_line": 13
},
{
"path": "backend/src/catalog/migrations/015_preprocessing_run_identity.ts",
"line": 6,
"end_line": 7
}
],
"width": 298
},
{
"id": "database_bindings",
"label": "database_bindings",
"tag": "database",
"row": 1,
"col": 0,
"attributes": [
{
"name": "database_id",
"type": "uuid",
"references": "workspace_databases.id",
"key": [
"pk",
"fk"
]
},
{
"name": "transport",
"type": "text"
},
{
"name": "host",
"type": "text"
},
{
"name": "port",
"type": "integer"
},
{
"name": "username",
"type": "text"
},
{
"name": "base_url",
"type": "text"
},
{
"name": "rest_path",
"type": "text"
},
{
"name": "rest_auth",
"type": "text"
},
{
"name": "tls_servername",
"type": "text"
},
{
"name": "ssh_host",
"type": "text"
},
{
"name": "ssh_port",
"type": "integer"
},
{
"name": "ssh_username",
"type": "text"
},
{
"name": "ssh_target_host",
"type": "text"
},
{
"name": "ssh_target_port",
"type": "integer"
},
{
"name": "connection_status",
"type": "text"
},
{
"name": "tested_version",
"type": "integer"
},
{
"name": "last_tested_at",
"type": "timestamptz"
},
{
"name": "last_error_code",
"type": "text"
},
{
"name": "last_error_message",
"type": "text"
},
{
"name": "updated_at",
"type": "timestamptz"
}
],
"sources": [
{
"path": "backend/src/catalog/migrations/001_workspace_databases.ts",
"line": 18,
"end_line": 52
}
],
"width": 244
},
{
"id": "installation_binding_imports",
"label": "installation_binding_imports",
"tag": "database",
"row": 2,
"col": 0,
"attributes": [
{
"name": "workspace_id",
"type": "text",
"key": "pk"
},
{
"name": "database_id",
"type": "uuid",
"key": "uk"
},
{
"name": "created_at",
"type": "timestamptz"
}
],
"sources": [
{
"path": "backend/src/catalog/migrations/014_installation_binding_imports.ts",
"line": 6,
"end_line": 11
}
]
},
{
"id": "catalog_tables",
"label": "catalog_tables",
"tag": "schema",
"row": 0,
"col": 1,
"attributes": [
{
"name": "id",
"type": "uuid",
"key": "pk"
},
{
"name": "database_id",
"type": "uuid",
"references": "workspace_databases.id",
"key": "fk"
},
{
"name": "name",
"type": "text"
},
{
"name": "source_comment",
"type": "text"
},
{
"name": "description",
"type": "text"
},
{
"name": "generated_description",
"type": "text"
},
{
"name": "version",
"type": "integer"
},
{
"name": "created_at",
"type": "timestamptz"
},
{
"name": "updated_at",
"type": "timestamptz"
},
{
"name": "last_synced_database_version",
"type": "integer"
},
{
"name": "last_synced_at",
"type": "timestamptz"
}
],
"sources": [
{
"path": "backend/src/catalog/migrations/002_catalog_tables.ts",
"line": 5,
"end_line": 19
},
{
"path": "backend/src/catalog/migrations/003_catalog_schema_sync.ts",
"line": 10,
"end_line": 13
}
],
"width": 291
},
{
"id": "catalog_columns",
"label": "catalog_columns",
"tag": "schema",
"row": 1,
"col": 1,
"attributes": [
{
"name": "id",
"type": "uuid",
"key": "pk"
},
{
"name": "table_id",
"type": "uuid",
"references": "catalog_tables.id",
"key": "fk"
},
{
"name": "name",
"type": "text"
},
{
"name": "ordinal_position",
"type": "integer"
},
{
"name": "data_type",
"type": "text"
},
{
"name": "is_nullable",
"type": "boolean"
},
{
"name": "default_expression",
"type": "text"
},
{
"name": "primary_key_position",
"type": "integer"
},
{
"name": "source_comment",
"type": "text"
},
{
"name": "description",
"type": "text"
},
{
"name": "generated_description",
"type": "text"
},
{
"name": "last_synced_database_version",
"type": "integer"
},
{
"name": "last_synced_at",
"type": "timestamptz"
},
{
"name": "version",
"type": "integer"
},
{
"name": "created_at",
"type": "timestamptz"
},
{
"name": "updated_at",
"type": "timestamptz"
},
{
"name": "sensitive",
"type": "boolean"
},
{
"name": "sensitivity_reason",
"type": "text"
}
],
"sources": [
{
"path": "backend/src/catalog/migrations/003_catalog_schema_sync.ts",
"line": 15,
"end_line": 38
},
{
"path": "backend/src/catalog/migrations/006_sensitive_data_flag.ts",
"line": 5,
"end_line": 7
},
{
"path": "backend/src/catalog/migrations/012_sensitivity_reason.ts",
"line": 5,
"end_line": 7
}
],
"width": 291
},
{
"id": "catalog_relationships",
"label": "catalog_relationships",
"tag": "schema",
"row": 2,
"col": 1,
"attributes": [
{
"name": "id",
"type": "uuid",
"key": "pk"
},
{
"name": "database_id",
"type": "uuid",
"references": "workspace_databases.id",
"key": "fk"
},
{
"name": "constraint_name",
"type": "text"
},
{
"name": "source_table_id",
"type": "uuid",
"references": "catalog_tables.id",
"key": "fk"
},
{
"name": "target_table_id",
"type": "uuid",
"references": "catalog_tables.id",
"key": "fk"
},
{
"name": "update_rule",
"type": "text"
},
{
"name": "delete_rule",
"type": "text"
},
{
"name": "deferrable",
"type": "boolean"
},
{
"name": "initially_deferred",
"type": "boolean"
},
{
"name": "last_synced_database_version",
"type": "integer"
},
{
"name": "last_synced_at",
"type": "timestamptz"
},
{
"name": "created_at",
"type": "timestamptz"
},
{
"name": "updated_at",
"type": "timestamptz"
}
],
"sources": [
{
"path": "backend/src/catalog/migrations/003_catalog_schema_sync.ts",
"line": 42,
"end_line": 60
}
],
"width": 291
},
{
"id": "catalog_relationship_columns",
"label": "catalog_relationship_columns",
"tag": "schema",
"row": 3,
"col": 1,
"attributes": [
{
"name": "relationship_id",
"type": "uuid",
"references": "catalog_relationships.id",
"key": [
"pk",
"fk"
]
},
{
"name": "position",
"type": "integer",
"key": "pk"
},
{
"name": "source_column_id",
"type": "uuid",
"references": "catalog_columns.id",
"key": "fk"
},
{
"name": "target_column_id",
"type": "uuid",
"references": "catalog_columns.id",
"key": "fk"
}
],
"sources": [
{
"path": "backend/src/catalog/migrations/003_catalog_schema_sync.ts",
"line": 64,
"end_line": 74
}
]
},
{
"id": "catalog_logical_relationships",
"label": "catalog_logical_relationships",
"tag": "schema",
"row": 4,
"col": 1,
"attributes": [
{
"name": "id",
"type": "uuid",
"key": "pk"
},
{
"name": "database_id",
"type": "uuid",
"references": "workspace_databases.id",
"key": "fk"
},
{
"name": "source_column_id",
"type": "uuid",
"references": "catalog_columns.id",
"key": "fk"
},
{
"name": "target_column_id",
"type": "uuid",
"references": "catalog_columns.id",
"key": "fk"
},
{
"name": "generated",
"type": "boolean"
},
{
"name": "deleted_at",
"type": "timestamptz"
},
{
"name": "created_at",
"type": "timestamptz"
},
{
"name": "updated_at",
"type": "timestamptz"
}
],
"sources": [
{
"path": "backend/src/catalog/migrations/008_catalog_logical_relationships.ts",
"line": 5,
"end_line": 25
}
]
},
{
"id": "catalog_sync_runs",
"label": "catalog_sync_runs",
"tag": "sync",
"row": 0,
"col": 2,
"attributes": [
{
"name": "id",
"type": "uuid",
"key": "pk"
},
{
"name": "database_id",
"type": "uuid",
"references": "workspace_databases.id",
"key": "fk"
},
{
"name": "scope",
"type": "text"
},
{
"name": "table_ids",
"type": "jsonb"
},
{
"name": "state",
"type": "text"
},
{
"name": "phase",
"type": "text"
},
{
"name": "requested_database_version",
"type": "integer"
},
{
"name": "observed_snapshot",
"type": "jsonb"
},
{
"name": "planned_diff",
"type": "jsonb"
},
{
"name": "confirmation_token",
"type": "text"
},
{
"name": "counts",
"type": "jsonb"
},
{
"name": "error_code",
"type": "text"
},
{
"name": "error_message",
"type": "text"
},
{
"name": "cancel_requested",
"type": "boolean"
},
{
"name": "created_at",
"type": "timestamptz"
},
{
"name": "started_at",
"type": "timestamptz"
},
{
"name": "updated_at",
"type": "timestamptz"
},
{
"name": "finished_at",
"type": "timestamptz"
},
{
"name": "heartbeat_at",
"type": "timestamptz"
},
{
"name": "lease_owner",
"type": "text"
},
{
"name": "lease_expires_at",
"type": "timestamptz"
}
],
"sources": [
{
"path": "backend/src/catalog/migrations/003_catalog_schema_sync.ts",
"line": 76,
"end_line": 99
}
],
"width": 278
},
{
"id": "catalog_sync_events",
"label": "catalog_sync_events",
"tag": "sync",
"row": 1,
"col": 2,
"attributes": [
{
"name": "id",
"type": "bigint",
"key": "pk"
},
{
"name": "run_id",
"type": "uuid",
"references": "catalog_sync_runs.id",
"key": "fk"
},
{
"name": "sequence",
"type": "integer"
},
{
"name": "level",
"type": "text"
},
{
"name": "event_type",
"type": "text"
},
{
"name": "message",
"type": "text"
},
{
"name": "data",
"type": "jsonb"
},
{
"name": "created_at",
"type": "timestamptz"
}
],
"sources": [
{
"path": "backend/src/catalog/migrations/003_catalog_schema_sync.ts",
"line": 106,
"end_line": 117
}
]
},
{
"id": "description_generation_runs",
"label": "description_generation_runs",
"tag": "run AI",
"row": 0,
"col": 3,
"attributes": [
{
"name": "id",
"type": "uuid",
"key": "pk"
},
{
"name": "database_id",
"type": "uuid",
"references": "workspace_databases.id",
"key": "fk"
},
{
"name": "scope",
"type": "text"
},
{
"name": "model_id",
"type": "text"
},
{
"name": "language",
"type": "text"
},
{
"name": "status",
"type": "text"
},
{
"name": "total",
"type": "integer"
},
{
"name": "processed",
"type": "integer"
},
{
"name": "generated",
"type": "integer"
},
{
"name": "non_generatable",
"type": "integer"
},
{
"name": "failed",
"type": "integer"
},
{
"name": "created_at",
"type": "timestamptz"
},
{
"name": "started_at",
"type": "timestamptz"
},
{
"name": "updated_at",
"type": "timestamptz"
},
{
"name": "finished_at",
"type": "timestamptz"
},
{
"name": "error_summary",
"type": "text"
},
{
"name": "input_tokens",
"type": "integer"
},
{
"name": "cache_read_tokens",
"type": "integer"
},
{
"name": "output_tokens",
"type": "integer"
}
],
"sources": [
{
"path": "backend/src/catalog/migrations/005_description_generation_runs.ts",
"line": 5,
"end_line": 55
}
]
},
{
"id": "description_generation_events",
"label": "description_generation_events",
"tag": "run AI",
"row": 1,
"col": 3,
"attributes": [
{
"name": "run_id",
"type": "uuid",
"references": "description_generation_runs.id",
"key": [
"pk",
"fk"
]
},
{
"name": "sequence",
"type": "integer",
"key": "pk"
},
{
"name": "level",
"type": "text"
},
{
"name": "message",
"type": "text"
},
{
"name": "created_at",
"type": "timestamptz"
}
],
"sources": [
{
"path": "backend/src/catalog/migrations/005_description_generation_runs.ts",
"line": 64,
"end_line": 81
}
]
},
{
"id": "sensitive_data_suggestion_runs",
"label": "sensitive_data_suggestion_runs",
"tag": "run AI",
"row": 2,
"col": 3,
"attributes": [
{
"name": "id",
"type": "uuid",
"key": "pk"
},
{
"name": "database_id",
"type": "uuid",
"references": "workspace_databases.id",
"key": "fk"
},
{
"name": "scope",
"type": "text"
},
{
"name": "model_id",
"type": "text"
},
{
"name": "status",
"type": "text"
},
{
"name": "total",
"type": "integer"
},
{
"name": "suggested_sensitive",
"type": "integer"
},
{
"name": "suggested_non_sensitive",
"type": "integer"
},
{
"name": "created_at",
"type": "timestamptz"
},
{
"name": "started_at",
"type": "timestamptz"
},
{
"name": "updated_at",
"type": "timestamptz"
},
{
"name": "finished_at",
"type": "timestamptz"
},
{
"name": "error_summary",
"type": "text"
},
{
"name": "input_tokens",
"type": "integer"
},
{
"name": "cache_read_tokens",
"type": "integer"
},
{
"name": "output_tokens",
"type": "integer"
},
{
"name": "engine",
"type": "text"
},
{
"name": "policy_version",
"type": "text"
},
{
"name": "unknown",
"type": "integer"
}
],
"sources": [
{
"path": "backend/src/catalog/migrations/007_sensitive_data_suggestion_runs.ts",
"line": 5,
"end_line": 43
}
],
"width": 258
},
{
"id": "sensitive_data_suggestion_events",
"label": "sensitive_data_suggestion_events",
"tag": "run AI",
"row": 3,
"col": 3,
"attributes": [
{
"name": "run_id",
"type": "uuid",
"references": "sensitive_data_suggestion_runs.id",
"key": [
"pk",
"fk"
]
},
{
"name": "sequence",
"type": "integer",
"key": "pk"
},
{
"name": "level",
"type": "text"
},
{
"name": "message",
"type": "text"
},
{
"name": "created_at",
"type": "timestamptz"
}
],
"sources": [
{
"path": "backend/src/catalog/migrations/007_sensitive_data_suggestion_runs.ts",
"line": 50,
"end_line": 67
}
]
}
],
"relationships": [
{
"id": "catalog-columns-table-id",
"from": "catalog_tables",
"to": "catalog_columns",
"fromCardinality": "one",
"toCardinality": "many"
},
{
"id": "catalog-logical-relationships-database-id",
"from": "workspace_databases",
"to": "catalog_logical_relationships",
"fromCardinality": "one",
"toCardinality": "many"
},
{
"id": "catalog-logical-relationships-source-column-id",
"from": "catalog_columns",
"to": "catalog_logical_relationships",
"fromCardinality": "one",
"toCardinality": "many"
},
{
"id": "catalog-logical-relationships-target-column-id",
"from": "catalog_columns",
"to": "catalog_logical_relationships",
"fromCardinality": "one",
"toCardinality": "many"
},
{
"id": "catalog-relationship-columns-relationship-id",
"from": "catalog_relationships",
"to": "catalog_relationship_columns",
"fromCardinality": "one",
"toCardinality": "many"
},
{
"id": "catalog-relationship-columns-source-column-id",
"from": "catalog_columns",
"to": "catalog_relationship_columns",
"fromCardinality": "one",
"toCardinality": "many"
},
{
"id": "catalog-relationship-columns-target-column-id",
"from": "catalog_columns",
"to": "catalog_relationship_columns",
"fromCardinality": "one",
"toCardinality": "many"
},
{
"id": "catalog-relationships-database-id",
"from": "workspace_databases",
"to": "catalog_relationships",
"fromCardinality": "one",
"toCardinality": "many"
},
{
"id": "catalog-relationships-source-table-id",
"from": "catalog_tables",
"to": "catalog_relationships",
"fromCardinality": "one",
"toCardinality": "many"
},
{
"id": "catalog-relationships-target-table-id",
"from": "catalog_tables",
"to": "catalog_relationships",
"fromCardinality": "one",
"toCardinality": "many"
},
{
"id": "catalog-sync-events-run-id",
"from": "catalog_sync_runs",
"to": "catalog_sync_events",
"fromCardinality": "one",
"toCardinality": "many"
},
{
"id": "catalog-sync-runs-database-id",
"from": "workspace_databases",
"to": "catalog_sync_runs",
"fromCardinality": "one",
"toCardinality": "many"
},
{
"id": "catalog-tables-database-id",
"from": "workspace_databases",
"to": "catalog_tables",
"fromCardinality": "one",
"toCardinality": "many"
},
{
"id": "database-bindings-database-id",
"from": "workspace_databases",
"to": "database_bindings",
"fromCardinality": "one",
"toCardinality": "one"
},
{
"id": "description-generation-events-run-id",
"from": "description_generation_runs",
"to": "description_generation_events",
"fromCardinality": "one",
"toCardinality": "many"
},
{
"id": "description-generation-runs-database-id",
"from": "workspace_databases",
"to": "description_generation_runs",
"fromCardinality": "one",
"toCardinality": "many"
},
{
"id": "sensitive-data-suggestion-events-run-id",
"from": "sensitive_data_suggestion_runs",
"to": "sensitive_data_suggestion_events",
"fromCardinality": "one",
"toCardinality": "many"
},
{
"id": "sensitive-data-suggestion-runs-database-id",
"from": "workspace_databases",
"to": "sensitive_data_suggestion_runs",
"fromCardinality": "one",
"toCardinality": "many"
}
],
"cards": [
{
"dot": "cyan",
"title": "Domini",
"items": [
"database: identità e binding di ogni database di workspace",
"schema: tabelle, colonne e relazioni sincronizzate dal DWH, con descrizioni e sensibilità",
"sync e run AI: esecuzioni con eventi ordinati per sequence"
]
},
{
"dot": "amber",
"title": "Vincoli non disegnati",
"items": [
"Unicità composte: (database_id, name) su catalog_tables, (table_id, name) su catalog_columns, (run_id, sequence) sugli eventi",
"Al massimo un run di sync attivo per database e un solo run di descrizioni attivo",
"installation_binding_imports.database_id non ha FK: un database importato e poi cancellato va riconciliato"
]
},
{
"dot": "emerald",
"title": "Origine",
"items": [
"Schema ricostruito dalle 15 migrazioni in backend/src/catalog/migrations",
"Tutte le FK hanno ON DELETE CASCADE"
]
}
]
}