SELECT 'qipai_wallet_scope_policies' AS table_name
FROM information_schema.tables
WHERE table_schema = DATABASE() AND table_name = 'qipai_wallet_scope_policies';

SELECT 'qipai_wallet_accounts' AS table_name
FROM information_schema.tables
WHERE table_schema = DATABASE() AND table_name = 'qipai_wallet_accounts';

SELECT 'qipai_wallet_ledger_entries' AS table_name
FROM information_schema.tables
WHERE table_schema = DATABASE() AND table_name = 'qipai_wallet_ledger_entries';

SELECT column_name
FROM information_schema.columns
WHERE table_schema = DATABASE()
  AND table_name = 'qipai_wallet_accounts'
  AND column_name IN ('cash_balance_cents', 'gift_balance_cents', 'scope_type', 'store_id');

SELECT column_name
FROM information_schema.columns
WHERE table_schema = DATABASE()
  AND table_name = 'qipai_wallet_ledger_entries'
  AND column_name IN (
    'business_type', 'business_id', 'cash_delta_cents', 'gift_delta_cents',
    'cash_balance_after_cents', 'gift_balance_after_cents', 'trace_id'
  );

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