-- ================================================
-- 养老管理系统模拟数据验证脚本
-- 用于验证表结构是否正确
-- ================================================

-- 检查关键表是否存在
SELECT 
    table_name,
    CASE 
        WHEN table_name IS NOT NULL THEN '✓ 存在'
        ELSE '✗ 缺失'
    END as status
FROM information_schema.tables 
WHERE table_schema = 'public' 
AND table_name IN (
    'ak_regions',
    'ak_users', 
    'ak_roles',
    'ak_user_roles',
    'ec_facilities',
    'ec_care_units',
    'ec_elders',
    'ec_family_contacts',
    'ec_care_plans',
    'ec_care_tasks',
    'ec_care_records',
    'ec_health_records',
    'ec_vital_signs',
    'ec_medical_records',
    'ec_medications',
    'ec_medication_logs',
    'ec_health_alerts',
    'ec_activities',
    'ec_activity_participations',
    'ec_visits',
    'ec_meal_services',
    'ec_meal_records',
    'ec_notification_templates',
    'ec_notification_logs'
)
ORDER BY table_name;

-- 检查 ak_regions 表的列结构
SELECT 
    column_name,
    data_type,
    is_nullable
FROM information_schema.columns 
WHERE table_schema = 'public' 
AND table_name = 'ak_regions'
ORDER BY ordinal_position;
