You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add School Roll Number field for Ireland schools Add optional s… (#632)
Add School Roll Number field for Ireland schools
Add optional school_roll_number field with alphanumeric validation,
following the same pattern as UK URN and US district fields. Includes
database migration, API endpoints, admin dashboard integration, and
comprehensive test coverage.
## Status
Closes:
https://github.com/orgs/RaspberryPiFoundation/projects/51/views/11?pane=issue&itemId=132315256&issue=RaspberryPiFoundation%7Cdigital-editor-issues%7C925
Related to:
https://github.com/RaspberryPiFoundation/editor-standalone/pull/686
## Points for consideration:
### Security
- Field has unique index to prevent duplicate entries
- Input validation enforces alphanumeric format (numbers followed by
letters)
- Case-insensitive uniqueness check prevents bypass attempts
### Performance
- Database index added on `school_roll_number` column for efficient
lookups
- Optional field (nullable) - no impact on existing schools
## What's changed?
**Database:**
- Added `school_roll_number` string column to `schools` table
- Added unique index on `school_roll_number`
**Model (School):**
- Added validation: uniqueness (case-insensitive), alphanumeric format
- Added normalisation callback to handle blank values
- Added I18n error message for validation
**API:**
- Added `school_roll_number` to permitted parameters in
SchoolsController
- Included `school_roll_number` in JSON API responses
**Admin Dashboard:**
- Added field to admin show page, form, and attributes list
- Admins can view School Roll Numbers
**Tests:**
- 8 comprehensive validation tests (optional, uniqueness, format
validation, normalisation)
- Updated factory to support the new field
**Locales:**
- Added validation message to `config/locales/en.yml`
0 commit comments