backfill super-schizo + super-nomad Notes to existing superusers

Migration 0003: grants both Notes to all existing is_superuser=True users.
Covers accounts created before the post_save signal was wired.

Code architected by Disco DeDisco <discodedisco@outlook.com>
Git commit message Co-Authored-By:
Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Disco DeDisco
2026-04-28 01:31:36 -04:00
parent 6ad736413b
commit 763d555f0c

View File

@@ -0,0 +1,27 @@
"""Backfill super-schizo and super-nomad Notes for all existing superusers."""
from django.db import migrations
from django.utils import timezone
def grant_super_notes(apps, schema_editor):
User = apps.get_model("lyric", "User")
Note = apps.get_model("drama", "Note")
now = timezone.now()
for user in User.objects.filter(is_superuser=True):
for slug in ("super-schizo", "super-nomad"):
Note.objects.get_or_create(
user=user, slug=slug,
defaults={"earned_at": now},
)
class Migration(migrations.Migration):
dependencies = [
("drama", "0002_initial"),
("lyric", "0001_initial"),
]
operations = [
migrations.RunPython(grant_super_notes, migrations.RunPython.noop),
]