Remove default value from organization_id column in authentication_events table
Summary
Remove the default value of 1 from the organization_id column in the authentication_events table. This is the final cleanup step after ensuring the application code properly populates the column.
Background
This is part of the effort to add organization_id as the sharding key for the authentication_events table (#561359 (closed)). After the application code has been updated and verified to correctly populate the organization_id column, the temporary default value can be safely removed.
Implementation Details
- Create a migration to remove the default value from the
organization_idcolumn - Verify that all recent records have proper organization_id values (not just the default)
- Ensure the column remains NOT NULL (if applicable)
Acceptance Criteria
-
Migration created to remove default value from organization_idcolumn -
Verified that application code is correctly populating organization_id -
Verified in production that new records have proper organization_id values -
Migration tested locally
Related Issues
- Parent: #561359 (closed)
- Investigation: #553447 (closed)
Dependencies
- Requires completion of application code updates to store current organization
- Should only be done after verifying the application code is working correctly in production
Verification
Before removing the default value, verify:
- Application code has been deployed and running in production
- New authentication_events records have correct organization_id values
- No records are being created with NULL organization_id