Bruno Charest 984d06a223
Some checks failed
Tests / Backend Tests (Python) (3.10) (push) Has been cancelled
Tests / Backend Tests (Python) (3.11) (push) Has been cancelled
Tests / Backend Tests (Python) (3.12) (push) Has been cancelled
Tests / Frontend Tests (JS) (push) Has been cancelled
Tests / Integration Tests (push) Has been cancelled
Tests / All Tests Passed (push) Has been cancelled
feat: Implement comprehensive database schema with new models, CRUD operations, and documentation for host metrics, Docker management, and terminal sessions, while removing old test files.
2026-03-05 10:16:13 -05:00

311 lines
9.6 KiB
Plaintext

erDiagram
alerts {
INTEGER id PK
INTEGER user_id FK "nullable"
VARCHAR category
VARCHAR level "nullable"
VARCHAR title "nullable"
TEXT message
VARCHAR source "nullable"
JSON details "nullable"
DATETIME read_at "nullable"
DATETIME created_at
}
app_settings {
VARCHAR key PK
TEXT value "nullable"
DATETIME created_at
DATETIME updated_at
}
bootstrap_status {
INTEGER id PK
VARCHAR host_id FK
VARCHAR status
VARCHAR automation_user "nullable"
DATETIME last_attempt "nullable"
TEXT error_message "nullable"
DATETIME created_at
}
container_customizations {
INTEGER id PK
INTEGER user_id FK "nullable"
VARCHAR host_id FK
VARCHAR container_id
VARCHAR icon_key "nullable"
VARCHAR icon_color "nullable"
VARCHAR bg_color "nullable"
DATETIME created_at
DATETIME updated_at
}
docker_alerts {
INTEGER id PK
VARCHAR host_id FK
VARCHAR container_name
VARCHAR severity
VARCHAR state
TEXT message "nullable"
DATETIME opened_at
DATETIME closed_at "nullable"
DATETIME acknowledged_at "nullable"
VARCHAR acknowledged_by "nullable"
DATETIME last_notified_at "nullable"
}
docker_containers {
INTEGER id PK
VARCHAR host_id FK
VARCHAR container_id
VARCHAR name
VARCHAR image "nullable"
VARCHAR state
VARCHAR status "nullable"
VARCHAR health "nullable"
DATETIME created_at "nullable"
JSON ports "nullable"
JSON labels "nullable"
VARCHAR compose_project "nullable"
DATETIME last_update_at
}
docker_images {
INTEGER id PK
VARCHAR host_id FK
VARCHAR image_id
JSON repo_tags "nullable"
BIGINT size "nullable"
DATETIME created "nullable"
DATETIME last_update_at
}
docker_volumes {
INTEGER id PK
VARCHAR host_id FK
VARCHAR name
VARCHAR driver "nullable"
TEXT mountpoint "nullable"
VARCHAR scope "nullable"
DATETIME last_update_at
}
favorite_containers {
INTEGER id PK
INTEGER user_id FK "nullable"
INTEGER docker_container_id FK
INTEGER group_id FK "nullable"
DATETIME created_at
}
favorite_groups {
INTEGER id PK
INTEGER user_id FK "nullable"
VARCHAR name
INTEGER sort_order
VARCHAR color "nullable"
VARCHAR icon_key "nullable"
DATETIME created_at
DATETIME updated_at
}
host_metrics {
INTEGER id PK
VARCHAR host_id FK
VARCHAR metric_type
INTEGER cpu_count "nullable"
VARCHAR cpu_model "nullable"
INTEGER cpu_cores "nullable"
INTEGER cpu_threads "nullable"
INTEGER cpu_threads_per_core "nullable"
INTEGER cpu_sockets "nullable"
FLOAT cpu_mhz "nullable"
FLOAT cpu_max_mhz "nullable"
FLOAT cpu_min_mhz "nullable"
FLOAT cpu_load_1m "nullable"
FLOAT cpu_load_5m "nullable"
FLOAT cpu_load_15m "nullable"
FLOAT cpu_usage_percent "nullable"
FLOAT cpu_temperature "nullable"
INTEGER memory_total_mb "nullable"
INTEGER memory_used_mb "nullable"
INTEGER memory_free_mb "nullable"
FLOAT memory_usage_percent "nullable"
INTEGER swap_total_mb "nullable"
INTEGER swap_used_mb "nullable"
FLOAT swap_usage_percent "nullable"
JSON disk_info "nullable"
JSON disk_devices
FLOAT disk_root_total_gb "nullable"
FLOAT disk_root_used_gb "nullable"
FLOAT disk_root_usage_percent "nullable"
JSON lvm_info "nullable"
JSON zfs_info "nullable"
JSON storage_details "nullable"
VARCHAR os_name "nullable"
VARCHAR os_version "nullable"
VARCHAR kernel_version "nullable"
VARCHAR hostname "nullable"
INTEGER uptime_seconds "nullable"
VARCHAR uptime_human "nullable"
JSON network_info "nullable"
JSON raw_data "nullable"
VARCHAR collection_source "nullable"
INTEGER collection_duration_ms "nullable"
TEXT error_message "nullable"
DATETIME collected_at
DATETIME created_at
}
hosts {
VARCHAR id PK
VARCHAR name
VARCHAR ip_address
VARCHAR status
VARCHAR ansible_group "nullable"
DATETIME last_seen "nullable"
BOOLEAN reachable
DATETIME created_at
DATETIME updated_at
DATETIME deleted_at "nullable"
BOOLEAN docker_enabled
VARCHAR docker_version "nullable"
VARCHAR docker_status "nullable"
DATETIME docker_last_collect_at "nullable"
}
logs {
INTEGER id PK
VARCHAR level
VARCHAR source "nullable"
TEXT message
JSON details "nullable"
VARCHAR host_id "nullable"
VARCHAR task_id "nullable"
VARCHAR schedule_id "nullable"
DATETIME created_at
}
playbook_lint_results {
INTEGER id PK
VARCHAR filename
INTEGER quality_score
INTEGER total_issues
INTEGER errors_count
INTEGER warnings_count
INTEGER execution_time_ms
TEXT issues_json "nullable"
TEXT raw_output "nullable"
DATETIME created_at
DATETIME updated_at
}
schedule_runs {
INTEGER id PK
VARCHAR schedule_id FK
VARCHAR task_id FK "nullable"
VARCHAR status
DATETIME started_at
DATETIME completed_at "nullable"
FLOAT duration "nullable"
INTEGER hosts_impacted "nullable"
TEXT error_message "nullable"
TEXT output "nullable"
DATETIME created_at
}
schedules {
VARCHAR id PK
VARCHAR name
TEXT description "nullable"
VARCHAR playbook
VARCHAR target_type "nullable"
VARCHAR target
JSON extra_vars "nullable"
VARCHAR schedule_type
DATETIME schedule_time "nullable"
VARCHAR recurrence_type "nullable"
VARCHAR recurrence_time "nullable"
TEXT recurrence_days "nullable"
VARCHAR cron_expression "nullable"
VARCHAR timezone "nullable"
DATETIME start_at "nullable"
DATETIME end_at "nullable"
BOOLEAN enabled
TEXT tags "nullable"
DATETIME next_run "nullable"
DATETIME last_run "nullable"
VARCHAR last_status "nullable"
INTEGER retry_on_failure "nullable"
INTEGER timeout "nullable"
VARCHAR notification_type "nullable"
INTEGER run_count "nullable"
INTEGER success_count "nullable"
INTEGER failure_count "nullable"
DATETIME created_at
DATETIME updated_at
DATETIME deleted_at "nullable"
}
tasks {
VARCHAR id PK
VARCHAR action
VARCHAR target
VARCHAR status
VARCHAR playbook "nullable"
DATETIME started_at "nullable"
DATETIME completed_at "nullable"
TEXT error_message "nullable"
JSON result_data "nullable"
DATETIME created_at
}
terminal_command_logs {
INTEGER id PK
DATETIME created_at
VARCHAR host_id FK
INTEGER user_id FK "nullable"
VARCHAR terminal_session_id "nullable"
TEXT command
VARCHAR command_hash
VARCHAR source
BOOLEAN is_pinned
BOOLEAN is_blocked
VARCHAR blocked_reason "nullable"
VARCHAR username "nullable"
VARCHAR host_name "nullable"
}
terminal_sessions {
VARCHAR id PK
VARCHAR host_id
VARCHAR host_name
VARCHAR host_ip
INTEGER user_id "nullable"
VARCHAR username "nullable"
VARCHAR token_hash
INTEGER ttyd_port
INTEGER ttyd_pid "nullable"
VARCHAR mode
VARCHAR status
VARCHAR reason_closed "nullable"
DATETIME created_at
DATETIME last_seen_at
DATETIME expires_at
DATETIME closed_at "nullable"
}
users {
INTEGER id PK
VARCHAR username
VARCHAR email "nullable"
VARCHAR hashed_password
VARCHAR role
BOOLEAN is_active
BOOLEAN is_superuser
VARCHAR display_name "nullable"
DATETIME created_at
DATETIME updated_at
DATETIME last_login "nullable"
DATETIME password_changed_at "nullable"
DATETIME deleted_at "nullable"
}
users ||--o{ alerts : "user_id"
hosts ||--o{ bootstrap_status : "host_id"
users ||--o{ container_customizations : "user_id"
hosts ||--o{ container_customizations : "host_id"
hosts ||--o{ docker_alerts : "host_id"
hosts ||--o{ docker_containers : "host_id"
hosts ||--o{ docker_images : "host_id"
hosts ||--o{ docker_volumes : "host_id"
users ||--o{ favorite_containers : "user_id"
docker_containers ||--o{ favorite_containers : "docker_container_id"
favorite_groups ||--o{ favorite_containers : "group_id"
users ||--o{ favorite_groups : "user_id"
hosts ||--o{ host_metrics : "host_id"
schedules ||--o{ schedule_runs : "schedule_id"
tasks ||--o{ schedule_runs : "task_id"
hosts ||--o{ terminal_command_logs : "host_id"
users ||--o{ terminal_command_logs : "user_id"