SELECT table_name
FROM information_schema.tables
WHERE table_schema = DATABASE()
  AND table_name IN (
    'qipai_cleaning_templates',
    'qipai_cleaning_task_photos',
    'qipai_cleaning_task_submissions'
  )
ORDER BY table_name;

SELECT table_name, column_name
FROM information_schema.columns
WHERE table_schema = DATABASE()
  AND table_name = 'qipai_cleaning_tasks'
  AND column_name IN (
    'cleaning_template_id', 'cleaning_template_version', 'photo_required',
    'min_photo_count', 'max_photo_count', 'exempt_policy', 'rework_count'
  )
ORDER BY column_name;

SELECT table_name, index_name
FROM information_schema.statistics
WHERE table_schema = DATABASE()
  AND ((table_name = 'qipai_cleaning_templates' AND index_name = 'uq_qipai_cleaning_template_scope')
    OR (table_name = 'qipai_cleaning_task_photos' AND index_name = 'uq_qipai_cleaning_photo_url')
    OR (table_name = 'qipai_cleaning_task_submissions' AND index_name = 'uq_qipai_cleaning_submission_revision'))
GROUP BY table_name, index_name
ORDER BY table_name, index_name;

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