SELECT table_name FROM information_schema.tables
WHERE table_schema = DATABASE() AND table_name IN (
  'qipai_collection_accounts', 'qipai_profit_share_receivers',
  'qipai_profit_share_policies'
) ORDER BY table_name;

SELECT column_name FROM information_schema.columns
WHERE table_schema = DATABASE() AND table_name = 'qipai_profit_shares'
  AND column_name IN (
    'collection_account_id', 'receiver_id', 'client_request_id', 'batch_request_id',
    'percentage_bps', 'failure_code', 'raw_response'
  ) ORDER BY column_name;

SELECT table_name, index_name FROM information_schema.statistics
WHERE table_schema = DATABASE()
  AND ((table_name = 'qipai_collection_accounts'
        AND index_name = 'uq_qipai_collection_account_scope')
    OR (table_name = 'qipai_profit_share_receivers'
        AND index_name = 'uq_qipai_profit_receiver_hash')
    OR (table_name = 'qipai_profit_share_policies'
        AND index_name = 'uq_qipai_profit_policy_receiver')
    OR (table_name = 'qipai_profit_shares'
        AND index_name IN (
          'uq_qipai_profit_share_request',
          'uq_qipai_profit_share_payment_receiver'
        )))
GROUP BY table_name, index_name ORDER BY table_name, index_name;

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