/* Read-only validation after 001_nexora_platform.sql */
SELECT DB_NAME() AS current_database;
SELECT 'WEBENGINE_NEWS' AS table_name, COUNT(*) AS rows_count FROM nexora_platform.dbo.WEBENGINE_NEWS
UNION ALL SELECT 'WEBENGINE_CREDITS_CONFIG', COUNT(*) FROM nexora_platform.dbo.WEBENGINE_CREDITS_CONFIG
UNION ALL SELECT 'WEBENGINE_PAYPAL_TRANSACTIONS', COUNT(*) FROM nexora_platform.dbo.WEBENGINE_PAYPAL_TRANSACTIONS
UNION ALL SELECT 'WEBENGINE_PLUGINS', COUNT(*) FROM nexora_platform.dbo.WEBENGINE_PLUGINS;

SELECT name, is_disabled
FROM muonline.sys.triggers
WHERE name = 'TR_Copy_WebAccount_To_muonlinetemp';

SELECT 'NEXORA_PASSWORD_RESETS' AS table_name, COUNT(*) AS rows_count FROM nexora_platform.dbo.NEXORA_PASSWORD_RESETS
UNION ALL SELECT 'NEXORA_EMAIL_CHANGE_REQUESTS', COUNT(*) FROM nexora_platform.dbo.NEXORA_EMAIL_CHANGE_REQUESTS
UNION ALL SELECT 'NEXORA_PAYMENT_EVENTS', COUNT(*) FROM nexora_platform.dbo.NEXORA_PAYMENT_EVENTS
UNION ALL SELECT 'NEXORA_WALLET_LEDGER', COUNT(*) FROM nexora_platform.dbo.NEXORA_WALLET_LEDGER
UNION ALL SELECT 'NEXORA_AUDIT_LOG', COUNT(*) FROM nexora_platform.dbo.NEXORA_AUDIT_LOG
UNION ALL SELECT 'NEXORA_USER_ROLES', COUNT(*) FROM nexora_platform.dbo.NEXORA_USER_ROLES;

/* Legacy pending flows may contain plaintext pending passwords. Review before any cleanup. */
IF OBJECT_ID(N'muonline.dbo.WEBENGINE_PASSCHANGE_REQUEST', N'U') IS NOT NULL
    SELECT 'legacy_pending_password_changes' AS check_name, COUNT(*) AS rows_count FROM muonline.dbo.WEBENGINE_PASSCHANGE_REQUEST;
IF OBJECT_ID(N'muonline.dbo.WEBENGINE_REGISTER_ACCOUNT', N'U') IS NOT NULL
    SELECT 'legacy_pending_registrations' AS check_name, COUNT(*) AS rows_count FROM muonline.dbo.WEBENGINE_REGISTER_ACCOUNT;
