DataTalksClub / DataTalksClub/website
D3.1 phase 1: Additive extension schema (courses.LearnerProfile + accounts_ext)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Part of the D3.1 umbrella (#334): phase 1 of 6. Implements playbook P7 DTC steps 1-2 (expand only) and step 3's schema, against current main, refreshed from #334's original 2026-09-08 grooming.
Normative sources
| Source | What it governs |
|---|---|
community-base repo: docs/plan/phase-3.md, C3.1a/D3.1; docs/03-playbooks.md P7 DTC steps 1-3 |
Field table and migration procedure (unchanged from #334; not relitigated here) |
accounts/models.py (current main) |
Source definitions this phase mirrors verbatim |
_docs/specs/09-migration-rollout-roadmap.md |
Expand-and-contract rollout policy |
Goal
Land the target extension schema as pure additions: no CustomUser field is read, written, or removed by this issue. manage.py check and the full suite pass before and after with zero behavior change. This is the "safe to merge and forget" foundation phase: later phases build on it without redoing it, even if they take a while against a fast-moving main.
Scope
courses.LearnerProfile: new model,userOneToOneField(related_name="learner_profile"), mirroring today'sCustomUserdefinitions verbatim (same max lengths, null/blank, choices, help text) for:role(CharField(10), choicesstudent/instructor, defaultstudent),certificate_name,country,region,registration_role,github_url,linkedin_url,personal_website_url,about_me,dark_mode.accounts_extapp: new Django app, added toINSTALLED_APPS.accounts_ext.IdentityState(userOneToOneField):normalized_email,identity_state, plus the conditional unique constraintaccounts_active_normalized_email_unique, mirrored verbatim fromaccounts.models.CustomUser. Importaccounts/identity_values.normalize_account_emailrather than copying it.- Move six models from
accountstoaccounts_extviaSeparateDatabaseAndStatewithdb_tablepinned to their existing table names, so no table is renamed, rebuilt, or has rows touched:AccountIdentityAlias,AccountIdentityQuarantine,AccountReconciliationRun,CmpLearnerImportProgress, plus two models added toaccounts/models.pyafter #334 was originally groomed —CmpLearnerImportBindingandCmpLearnerClaim(same script-owned import-provenance family asCmpLearnerImportProgress; verify currentaccounts/models.pyfor their exact current shape before writing the migration).MailchimpSubscriptionImportRun(also added since original grooming) stays inaccounts— it is generic import provenance, not identity state; its disposition is an explicit non-goal here, not a silent decision. - Repoint
AccountIdentityAlias.survivor's FK (and any other identity-model FK) at the auth-model setting, not a hardcodedaccounts.CustomUserlabel.
- Data migrations: one
LearnerProfilerow and oneIdentityStaterow per existing user, values copied verbatim (nulls stay null). Idempotent on re-run.
Non-goals
- No reader is switched to the new models (phases 2-3).
CustomUserkeeps every field unchanged. - No removal of any
CustomUserfield or constraint (phase 4). - No
RenameModel/AUTH_USER_MODELchange (phase 5). - No AISL-origin field additions (phase 6).
- No decision on
MailchimpSubscriptionImportRun's eventual home.
Dependencies
- Depends on: none (first phase).
- Blocks: #391, #392 (both need
LearnerProfile/IdentityStateto exist before any reader can be switched).
Acceptance criteria
Django and integration
-
make django-checkpasses. -
make migrations-checkpasses. -
make test(full suite) passes with zero behavior change (no test asserts against the new models beyond this issue's own). -
courses.LearnerProfileexists with the ten fields listed above,userOneToOne, mirroringCustomUser's current definitions field-for-field. -
accounts_extapp exists, is installed, and declaresIdentityStateplus the six moved models with their original table names (\d accounts_accountidentityaliasetc. via a migration-state assertion, not a live table rename). - A migration test seeds users with varied values (null
certificate_name/URLs, both roles, everyIdentityState.choicesmember) and asserts exactly oneLearnerProfilerow and oneIdentityStaterow per user afterward, with identical field values. -
CustomUserstill declares all twelve fields untouched; nothing reads or writes the new models outside this issue's own migration and tests. -
manage.py migrateapplies cleanly end to end on a fresh database; each new migration reverses, or documents why not.
Repository and operations
- The versioned verification plan per
_docs/ci/change-selective-ci.mdis recorded in the engineer handoff.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading accounts/models.py and _docs/specs/09-migration-rollout-roadmap.md, then inspect the existing migration state and current CustomUser definitions. Implement the additive models, accounts_ext app, SeparateDatabaseAndState moves, and idempotent data migrations described in the issue. Done means make django-check, make migrations-check, and make test pass, with migration tests confirming copied values and preserved tables.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- django, python
- Domain
- backend, databases, testing-qa
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100