Repository navigation
fix(problem-statement): admin-created statements attributed to muLearn, not a company - #3263
Conversation
…reated statements shown as muLearn
|
| skills = models.JSONField(default=list) | ||
| deadline = models.DateTimeField(null=True, blank=True) | ||
| status = models.CharField(max_length=20, choices=Status.choices, default=Status.DRAFT) | ||
| source = models.CharField(max_length=20, choices=Source.choices, default=Source.COMPANY) |
There was a problem hiding this comment.
ProblemStatement now requires source and allows a null company, but schema.sql has no source column and still requires company_id. With managed = False, Django will not change this table. If the database matches the checked-in schema, statement reads and writes fail with an unknown-column error. Admin creation also needs nullable company_id.
The repository rules require matching schema artifacts. Update schema.sql and add an upgrade script that supplies a default or backfill for existing rows.
Admin could previously create a problem statement attributed to any company via company_id. Admin-created statements are now unattached to any company (company nullable, new source field) and are displayed as muLearn everywhere the statement is serialized (admin list, learner feed). Company-created statements are unaffected.