Skip to content

Remove creator_id - #1048

Open
cocomarine wants to merge 15 commits into
mainfrom
1841-remove-creator-id
Open

cocomarine wants to merge 15 commits into
mainfrom
1841-remove-creator-id

Conversation

@cocomarine

@cocomarine cocomarine commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Status

What's changed?

  • Removed the creator_id column from the School model
  • School creation no longer takes a creator. The controller passes current_user.id as owner_id to School::Create, which passes it to SchoolOnboardingService#onboard to create the owner and teacher roles
  • School::Create takes a Postgres advisory transaction lock keyed on owner_id before saving the school
    • This serialises concurrent creations by the same owner.
    • Previously the creator_id uniqueness constraint prevented duplicates.
  • School::Create runs in a savepoint (requires_new: true), so a failure rolls back the school even when called inside an outer transaction (e.g. SchoolImportJob)
  • Role validation failures during onboarding, for example when the user already has a role in a different school, are merged into the school's errors and returned as a failed response. They are not sent to Sentry. Other RecordInvalid errors are sent to Sentry
  • Removed creator_id from the admin dashboard
  • Updated the seeding rake tasks
  • Moved the UX contact consent sync from ContactSyncJob to RoleSyncJob for the owner role

@cla-bot cla-bot Bot added the cla-signed label Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Test coverage

93.84% line coverage reported by SimpleCov.
Run: https://github.com/RaspberryPiFoundation/editor-api/actions/runs/37485866504

@raspberrypiherokubot
raspberrypiherokubot temporarily deployed to editor-api-p-1841-remov-w6vg1r October 6, 2026 12:11 Inactive
@cocomarine
cocomarine temporarily deployed to editor-api-p-1841-remov-w6vg1r October 6, 2026 13:20 Inactive
@cocomarine cocomarine changed the title 1841 remove creator Remove creator_id Oct 6, 2026
@cocomarine
cocomarine marked this pull request as ready for review October 6, 2026 13:37
Comment thread lib/concepts/school/operations/create.rb Outdated
Comment thread lib/tasks/school_management.rake
@cocomarine
cocomarine temporarily deployed to editor-api-p-1841-remov-w6vg1r October 6, 2026 13:58 Inactive
@cocomarine
cocomarine temporarily deployed to editor-api-p-1841-remov-w6vg1r October 6, 2026 14:46 Inactive
Comment thread lib/concepts/school/operations/create.rb Fixed
@cocomarine
cocomarine temporarily deployed to editor-api-p-1841-remov-w6vg1r October 6, 2026 14:55 Inactive
@cocomarine
cocomarine temporarily deployed to editor-api-p-1841-remov-w6vg1r October 6, 2026 14:59 Inactive
Comment thread lib/concepts/school/operations/create.rb Fixed
…al variable'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
@cocomarine
cocomarine temporarily deployed to editor-api-p-1841-remov-w6vg1r October 6, 2026 15:01 Inactive
…al variable'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
@cocomarine
cocomarine temporarily deployed to editor-api-p-1841-remov-w6vg1r October 6, 2026 15:03 Inactive
@cocomarine
cocomarine temporarily deployed to editor-api-p-1841-remov-w6vg1r October 6, 2026 15:04 Inactive
Comment thread lib/concepts/school/operations/create.rb Outdated

This branch was successfully deployed

1 active deployment
editor-api-p-1841-remov-w6vg1r — f24e1a11 Deployed Oct 6, 2026 by cocomarine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants