Update application code to store current organization in authentication_events
Summary
Update the application code to store the current organization from the request context into the authentication_events table. This is the second step in adding organization_id as a sharding key.
Background
This is part of the effort to add organization_id as the sharding key for the authentication_events table (#561359 (closed)). After adding the column with a default value, we need to update the application code to properly populate it with the actual organization from the request context.
Implementation Details
- Identify all places where
authentication_eventsrecords are created - Update the code to extract and store the current organization from the request context
- Ensure proper handling when organization context is not available (fallback to default organization)
- Add/update tests to verify organization_id is correctly stored
Acceptance Criteria
-
Application code updated to store current organization in authentication_events -
Request context properly extracts organization information -
Tests added/updated to verify correct behavior -
Verified that new records contain the correct organization_id
Related Issues
- Parent: #561359 (closed)
- Investigation: #553447 (closed)
Dependencies
- Requires completion of adding
organization_idcolumn with default value
Next Steps
After this is complete and verified in production, the default value can be removed (#561359 (closed)).