File tree Expand file tree Collapse file tree
server/reportmanager/migrations Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# Generated by Django 6.0.4 on 2026-04-24 17:02
22
3+ from datetime import timedelta
4+
35from django .db import migrations
4- from django .utils import timezone
6+ from django .db .models import ExpressionWrapper , F
7+ from django .db .models .fields import DateTimeField
58
69
710def migrate_triage_data (apps , schema_editor ):
811 """Migrate hide_until data to triage_status field."""
912 Bucket = apps .get_model ('reportmanager' , 'Bucket' )
10- now = timezone .now ()
1113
1214 # All currently triaged buckets (hide_until is not NULL) → 'worksforme'
15+ # triaged_at is set to hide_until - 4 weeks to approximate when triage happened
1316 triaged_count = Bucket .objects .filter (hide_until__isnull = False ).update (
1417 triage_status = 'worksforme' ,
15- triaged_at = now
18+ triaged_at = ExpressionWrapper (
19+ F ('hide_until' ) - timedelta (weeks = 4 ),
20+ output_field = DateTimeField (),
21+ ),
1622 )
1723
1824 print (f"Migrated { triaged_count } triaged buckets to 'worksforme' status" )
You can’t perform that action at this time.
0 commit comments