# Generated by Django 3.1.13 on 2021-10-01 05:54

from django.db import migrations


class Migration(migrations.Migration):

    dependencies = [
        ('aims', '0094_log_foreign_keys'),
    ]

    operations = [
        migrations.RunSQL(
            """
            update aims_activitylogmessage
            set user_id = (select id from auth_user where auth_user.id = (aims_activitylogmessage.body ->> 'uid')::int);
            update aims_activitylogmessage
            set organisation_id = (select id from aims_organisation where aims_organisation.code = (aims_activitylogmessage.body ->> 'org_id'));
            """,
            reverse_sql="SELECT;"
        )
    ]
