sojorn/migrations/tests/check_email_summary.sql
Patrick Britton 0bb1dd4055 feat: organize SQL scripts into structured migration folders
- Create organized migration folder structure:
  - database/ - Core schema changes and migrations
  - tests/ - Test scripts and verification queries
  - directus/ - Directus CMS configuration scripts
  - fixes/ - Database fixes and patches
  - archive/ - Historical and deprecated scripts

- Move 60+ SQL files from root to appropriate folders
- Add comprehensive README with usage guidelines
- Consolidate old migrations_archive into new archive folder
- Maintain clear separation of concerns for different script types

Benefits:
- Cleaner project root directory
- Easier to find specific types of SQL scripts
- Better organization for maintenance and development
- Clear documentation for migration procedures
- Proper separation of production vs development scripts
2026-02-05 09:13:47 -06:00

13 lines
339 B
SQL

SELECT
COUNT(*) as total_users,
COUNT(CASE WHEN status = 'active' THEN 1 END) as active_users,
COUNT(CASE WHEN status = 'pending' THEN 1 END) as pending_users,
MIN(created_at) as oldest_user,
MAX(created_at) as newest_user
FROM users;
SELECT email, status, created_at
FROM users
ORDER BY created_at DESC
LIMIT 10;