old_contents: # Generated by Django 2.2.16 on 2020-10-21 13:46
  
  from django.db import migrations
  
  from adhocracy4.projects.enums import Access
  
  
  def initialize_access(apps, schema_editor):
      # We can't import the Person model directly as it may be a newer
      # version than this migration expects. We use the historical version.
      Project = apps.get_model('a4projects', 'Project')
      for project in Project.objects.all():
          if project.is_public:
              project.access = Access.PUBLIC
          else:
              project.access = Access.PRIVATE
          project.save()
  
  
  class Migration(migrations.Migration):
  
      dependencies = [
          ('a4projects', '0028_project_access'),
      ]
  
      operations = [
          migrations.RunPython(initialize_access),
      ]
  
new_contents: # Generated by Django 2.2.16 on 2020-10-21 13:46
  
  from django.db import migrations
  
  from adhocracy4.projects.enums import Access
  
  
  def initialize_access(apps, schema_editor):
      Project = apps.get_model('a4projects', 'Project')
      for project in Project.objects.all():
          if project.is_public:
              project.access = Access.PUBLIC
          else:
              project.access = Access.PRIVATE
          project.save()
  
  
  def backward_function(apps, schema_editor):
      Project = apps.get_model('a4projects', 'Project')
      for project in Project.objects.all():
          if project.access == Access.PUBLIC:
              project.is_public = True
          else:
              project.is_public = False
          project.save()
  
  
  class Migration(migrations.Migration):
  
      dependencies = [
          ('a4projects', '0028_project_access'),
      ]
  
      operations = [
          migrations.RunPython(initialize_access, backward_function),
      ]
  
subject: add backward function to 0029_is_public_to_access