SELECT table_name
FROM information_schema.tables
WHERE table_schema = DATABASE()
  AND table_name IN (
    'qipai_coupon_templates', 'qipai_coupon_grants',
    'qipai_package_plans', 'qipai_package_holdings',
    'qipai_benefit_usages'
  );

SELECT column_name
FROM information_schema.columns
WHERE table_schema = DATABASE()
  AND table_name = 'qipai_coupon_templates'
  AND column_name IN (
    'coupon_type', 'discount_amount_cents', 'time_minutes',
    'min_order_amount_cents', 'room_category_id', 'room_id',
    'weekdays_json', 'holiday_only', 'valid_days', 'usage_limit_per_user'
  );

SELECT column_name
FROM information_schema.columns
WHERE table_schema = DATABASE()
  AND table_name = 'qipai_package_holdings'
  AND column_name IN (
    'purchase_order_id', 'remaining_minutes', 'remaining_amount_cents',
    'frozen_order_id', 'valid_from', 'valid_to', 'status'
  );

SELECT index_name
FROM information_schema.statistics
WHERE table_schema = DATABASE()
  AND table_name = 'qipai_benefit_usages'
  AND index_name IN (
    'uq_qipai_benefit_usage_request',
    'uq_qipai_benefit_usage_order_benefit',
    'idx_qipai_benefit_usage_order'
  );

SELECT '2026062423' AS version
FROM qipai_schema_migrations
WHERE version = '2026062423';
