# Generated by Django 3.2.13 on 2023-07-31 10:14

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    dependencies = [
        ('rooms', '0001_initial'),
        ('posts', '0026_auto_20220615_1047'),
    ]

    operations = [
        migrations.AddField(
            model_name='post',
            name='room',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='posts', to='rooms.room'),
        ),
        migrations.RunSQL(
            sql="update posts set room_id = topic_id where topic_id is not null",
            reverse_sql="update posts set topic_id = room_id where room_id is not null"
        ),
        migrations.RemoveField(
            model_name='post',
            name='topic',
        ),
        migrations.DeleteModel(
            name='Topic',
        ),
    ]
