text: # Generated by Django 2.1.2 on 2018-10-20 11:01
  
  from django.db import migrations
  
  def set_room_position_value(apps, schema_editor):
      Topic = apps.get_model('mainapp', 'Topic')
      Room = apps.get_model('mainapp', 'Room')
  
      for topic in Topic.objects.all():
          if Room.objects.filter(name="off-topic", topic=topic).exists():
              room_offtopic = Room.objects.get(name="off-topic", topic=topic)
              room_offtopic.position = 2
              room_offtopic.save()
  
  class Migration(migrations.Migration):
  
      dependencies = [
          ('mainapp', '0013_auto_20181020_1053'),
      ]
  
      operations = [
          migrations.RunPython(set_room_position_value),
      ]
  