# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-09-20 16:54
from __future__ import unicode_literals

from django.db import migrations


def set_primary_auth0_user_id(apps, schema_editor):
    IdpProfile = apps.get_model('users', 'IdpProfile')

    for idp in IdpProfile.objects.all():
        if idp.primary:
            idp.profile.auth0_user_id = idp.auth0_user_id
            idp.profile.save()


def backwards(apps, schema_editor):
    pass


class Migration(migrations.Migration):

    dependencies = [
        ('users', '0039_userprofile_auth0_user_id'),
    ]

    operations = [
        migrations.RunPython(set_primary_auth0_user_id, backwards),
    ]

Migrate Auth0 data from Idp to UserProfiles.
Migrate Auth0 data from Idp to UserProfiles.
