Make default-bearing enum/counter/JSON columns NOT NULL
- Dominant language
- Python
- Stars
- 670
- Forks
- 183
- Avg merge
- 15h 13m
- Merged PRs (30d)
- 368
Description
These columns always receive a value from their default on insert; a NULL only means 'row predates the column'. Convert to NOT NULL after backfilling with the default value.
Target columns:
- users.role (default 'user')
- vfolders.permission ('rw'), vfolders.max_files (1000), vfolders.num_files (0), vfolders.cur_size (0)
- vfolder_permissions.permission ('rw')
- vfolder_invitations.permission ('rw'), vfolder_invitations.state ('pending')
- kernels.architecture ('x86_64'), kernels.mount_map ({}), kernels.attached_devices ({}), kernels.resource_opts ({}), kernels.num_queries (0)
- sessions.environ ({}), sessions.num_queries (0)
- keypairs.num_queries (0)
- routings.sub_status (server_default 'pending')
- service_catalog_endpoint.metadata (server_default '{}')
For each column: backfill existing NULL rows, ensure an appropriate default/server default, add an Alembic migration setting NOT NULL, and update the ORM model type annotations.
JIRA Issue: BA-7218
Contributor guide
Research direction
Locate the ORM models for users, vfolders, vfolder_permissions, vfolder_invitations, kernels, sessions, keypairs, routings, and service_catalog_endpoint, then find the project's Alembic migration entry points. Review how existing migrations backfill NULL values and define defaults before covering each listed column. Done means existing NULLs are backfilled, defaults are preserved, NOT NULL constraints are migrated, and model type annotations match.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, databases
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100