-- =============================================================================
-- 14-post-schema-verify.sql
-- cPanel / phpMyAdmin safe — uses SHOW instead of information_schema.
-- Compare row counts to 00-preflight-checks.sql snapshot.
-- =============================================================================

SELECT COUNT(*) AS members_count FROM members;
SELECT COUNT(*) AS attendances_count FROM attendances;
SELECT COUNT(*) AS leaves_count FROM leaves;

SELECT id, timestamp, name FROM migrations ORDER BY timestamp;

SHOW COLUMNS FROM `working_schedule` LIKE 'timezone';
SHOW COLUMNS FROM `working_schedule` LIKE 'monthly_correction_limit';
SHOW TABLES LIKE '_noticemembers';
SHOW COLUMNS FROM `leaves` LIKE 'document';
SHOW COLUMNS FROM `leaves` LIKE 'leave_type';
SHOW COLUMNS FROM `attendances` LIKE 'checkout_note';
SHOW TABLES LIKE 'attendance_requests';

SELECT COUNT(*) AS attendance_request_permissions_count
FROM role_permissions
WHERE permission_key IN (
  'attendance.request.create',
  'attendance.request.view',
  'attendance.request.approve'
);

SELECT name FROM migrations
WHERE name IN (
  'WorkScheduleTimezone1780950000000',
  'NoticeMembers1780960000000',
  'NoticeMembersForeignKeys1780970000000',
  'LeaveDocument1780980000000',
  'AttendanceCheckoutNote1780990000000',
  'AttendanceRequests1781000000000',
  'AttendanceRequestsForeignKeys1781010000000',
  'AttendanceRequestPermissions1781020000000',
  'WorkScheduleCorrectionLimit1781030000000',
  'LeaveTypeDayOff1781040000000'
)
ORDER BY name;
