text: # -*- coding: utf-8 -*-
  # Generated by Django 1.11.13 on 2018-06-27 09:33
  from __future__ import unicode_literals
  
  from django.db import migrations
  
  
  def set_null_program_fk_to_default(apps, schema_editor):
      Program = apps.get_model('main', 'Program')
      Project = apps.get_model('main', 'Project')
      program = Program.objects.first()
      if program is None:
          program = Program.objects.create(name="The Program", description="Auto-generated program")
      for project in Project.objects.filter(program__isnull=True):
          project.program = program
          project.save(update_fields=['program'])
  
  
  class Migration(migrations.Migration):
      dependencies = [
          ('main', '0013_auto_20180627_1730'),
      ]
  
      operations = [
          migrations.RunPython(set_null_program_fk_to_default, reverse_code=migrations.RunPython.noop),
      ]
  