forked from mtusi2026/mtusi2026lab7
8 lines
546 B
SQL
8 lines
546 B
SQL
SELECT json_build_object(
|
|
'schema_version',(SELECT max(version_id) FROM goose_db_version WHERE is_applied),
|
|
'ready_with_current_facts',count(*) FILTER (WHERE status='ready' AND accepted_at IS NOT NULL AND first_ready_at IS NOT NULL),
|
|
'ready_missing_first_fact',count(*) FILTER (WHERE status='ready' AND accepted_at IS NOT NULL AND first_ready_at IS NULL),
|
|
'negative_durations',count(*) FILTER (WHERE first_ready_at<accepted_at),
|
|
'legacy_ready_unknown',count(*) FILTER (WHERE status='ready' AND accepted_at IS NULL)
|
|
)::text FROM attachments;
|