|
|
@ -0,0 +1,24 @@ |
|
|
|
# Generated by Django 3.2.8 on 2021-10-21 09:30 |
|
|
|
|
|
|
|
from django.db import migrations |
|
|
|
|
|
|
|
|
|
|
|
def fill_last_notify(apps, schema_editor): |
|
|
|
Channel = apps.get_model("api", "Channel") |
|
|
|
Notification = apps.get_model("api", "Notification") |
|
|
|
for channel in Channel.objects.filter(last_notify=None): |
|
|
|
try: |
|
|
|
n = Notification.objects.filter(channel=channel).latest() |
|
|
|
channel.last_notify = n.created |
|
|
|
channel.save() |
|
|
|
except Notification.DoesNotExist: |
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
class Migration(migrations.Migration): |
|
|
|
|
|
|
|
dependencies = [ |
|
|
|
("api", "0081_channel_last_notify"), |
|
|
|
] |
|
|
|
|
|
|
|
operations = [migrations.RunPython(fill_last_notify, migrations.RunPython.noop)] |