SELECT table_name
FROM information_schema.tables
WHERE table_schema = DATABASE()
  AND table_name IN ('qipai_users', 'qipai_user_identities', 'qipai_auth_sessions')
ORDER BY table_name;

SELECT table_name, index_name
FROM information_schema.statistics
WHERE table_schema = DATABASE()
  AND (
    (table_name = 'qipai_users' AND index_name IN (
      'idx_qipai_users_tenant_status',
      'idx_qipai_users_tenant_type'
    ))
    OR
    (table_name = 'qipai_user_identities' AND index_name IN (
      'uq_qipai_user_identities_tenant_app_openid',
      'uq_qipai_user_identities_tenant_app_user',
      'idx_qipai_user_identities_tenant_unionid'
    ))
    OR
    (table_name = 'qipai_auth_sessions' AND index_name IN (
      'idx_qipai_auth_sessions_user_active',
      'idx_qipai_auth_sessions_expiry'
    ))
  )
GROUP BY table_name, index_name
ORDER BY table_name, index_name;

SELECT version, name
FROM qipai_schema_migrations
WHERE version = '2026061804';
