|
|
- # Generated by Django 2.1.5 on 2019-01-11 14:49
-
- from django.db import migrations
-
-
- def create_projects(apps, schema_editor):
- Profile = apps.get_model("accounts", "Profile")
- Project = apps.get_model("accounts", "Project")
- Member = apps.get_model("accounts", "Member")
- for profile in Profile.objects.all():
- project = Project()
- project.name = profile.team_name
- project.owner_id = profile.user_id
- project.api_key = profile.api_key
- project.api_key_readonly = profile.api_key_readonly
- project.save()
-
- profile.current_project = project
- profile.save()
-
- Member.objects.filter(team=profile).update(project=project)
-
- for profile in Profile.objects.all():
- if profile.current_team_id:
- profile.current_project = profile.current_team.current_project
- profile.save()
-
-
- class Migration(migrations.Migration):
-
- dependencies = [
- ('accounts', '0017_auto_20190112_1426'),
- ]
-
- operations = [
- migrations.RunPython(create_projects, migrations.RunPython.noop),
- ]
|