feat: UI alignment - Agent Console, Citizens, MicroDAO Dashboard (TASK 2)
This commit is contained in:
40
scripts/cleanup/delete_mock_citizens.sql
Normal file
40
scripts/cleanup/delete_mock_citizens.sql
Normal file
@@ -0,0 +1,40 @@
|
||||
-- Delete Mock Citizens Script
|
||||
-- This script marks mock/test citizens (agents) as deleted
|
||||
-- Run with caution in production!
|
||||
|
||||
-- Preview: Show agents that would be affected
|
||||
-- (agents without node_id or without primary_microdao_id, and not already marked as test)
|
||||
SELECT id, display_name, kind, node_id, primary_microdao_id, is_public
|
||||
FROM agents
|
||||
WHERE (
|
||||
node_id IS NULL
|
||||
OR primary_microdao_id IS NULL
|
||||
)
|
||||
AND COALESCE(is_test, false) = false
|
||||
AND COALESCE(is_archived, false) = false
|
||||
AND deleted_at IS NULL;
|
||||
|
||||
-- Uncomment to execute soft delete:
|
||||
-- UPDATE agents
|
||||
-- SET
|
||||
-- is_test = true,
|
||||
-- deleted_at = NOW()
|
||||
-- WHERE (
|
||||
-- node_id IS NULL
|
||||
-- OR primary_microdao_id IS NULL
|
||||
-- )
|
||||
-- AND COALESCE(is_test, false) = false
|
||||
-- AND COALESCE(is_archived, false) = false
|
||||
-- AND deleted_at IS NULL;
|
||||
|
||||
-- Verify: Count remaining active agents
|
||||
SELECT
|
||||
COUNT(*) as total_active_agents,
|
||||
COUNT(*) FILTER (WHERE is_public = true) as public_citizens,
|
||||
COUNT(*) FILTER (WHERE node_id IS NOT NULL) as agents_with_node,
|
||||
COUNT(*) FILTER (WHERE primary_microdao_id IS NOT NULL) as agents_with_microdao
|
||||
FROM agents
|
||||
WHERE COALESCE(is_test, false) = false
|
||||
AND COALESCE(is_archived, false) = false
|
||||
AND deleted_at IS NULL;
|
||||
|
||||
47
scripts/cleanup/delete_mock_microdao.sql
Normal file
47
scripts/cleanup/delete_mock_microdao.sql
Normal file
@@ -0,0 +1,47 @@
|
||||
-- Delete Mock MicroDAO Script
|
||||
-- This script marks mock/test microDAOs as deleted
|
||||
-- Run with caution in production!
|
||||
|
||||
-- Preview: Show microDAOs that would be affected
|
||||
-- (microDAOs with 0 agents or without orchestrator)
|
||||
SELECT
|
||||
m.id,
|
||||
m.slug,
|
||||
m.name,
|
||||
m.orchestrator_agent_id,
|
||||
COUNT(ma.agent_id) as agent_count
|
||||
FROM microdaos m
|
||||
LEFT JOIN microdao_agents ma ON ma.microdao_id = m.id
|
||||
WHERE COALESCE(m.is_test, false) = false
|
||||
AND COALESCE(m.is_archived, false) = false
|
||||
AND m.deleted_at IS NULL
|
||||
GROUP BY m.id
|
||||
HAVING COUNT(ma.agent_id) = 0 OR m.orchestrator_agent_id IS NULL;
|
||||
|
||||
-- Uncomment to execute soft delete:
|
||||
-- UPDATE microdaos
|
||||
-- SET
|
||||
-- is_test = true,
|
||||
-- deleted_at = NOW()
|
||||
-- WHERE id IN (
|
||||
-- SELECT m.id
|
||||
-- FROM microdaos m
|
||||
-- LEFT JOIN microdao_agents ma ON ma.microdao_id = m.id
|
||||
-- WHERE COALESCE(m.is_test, false) = false
|
||||
-- AND COALESCE(m.is_archived, false) = false
|
||||
-- AND m.deleted_at IS NULL
|
||||
-- GROUP BY m.id
|
||||
-- HAVING COUNT(ma.agent_id) = 0 OR m.orchestrator_agent_id IS NULL
|
||||
-- );
|
||||
|
||||
-- Verify: Count remaining active microDAOs
|
||||
SELECT
|
||||
COUNT(*) as total_active_microdaos,
|
||||
COUNT(*) FILTER (WHERE is_public = true) as public_microdaos,
|
||||
COUNT(*) FILTER (WHERE is_platform = true) as platforms,
|
||||
COUNT(*) FILTER (WHERE orchestrator_agent_id IS NOT NULL) as with_orchestrator
|
||||
FROM microdaos
|
||||
WHERE COALESCE(is_test, false) = false
|
||||
AND COALESCE(is_archived, false) = false
|
||||
AND deleted_at IS NULL;
|
||||
|
||||
Reference in New Issue
Block a user