# Generated by Django 2.2.7 on 2019-12-02 02:29

from django.db import migrations, transaction

SOCIAL_TYPES = [
    {
        'name': 'instagram',
        'icon': 'fab fa-instagram'
    },
    {
        'name': 'linkedin',
        'icon': 'fab fa-linkedin'
    },
    {
        'name': 'facebook',
        'icon': 'fab fa-facebook-square'
    }
]


def add_social_types(apps, schema_editor):
    SocialType = apps.get_model('social', 'SocialType')

    social_types = []

    for item in SOCIAL_TYPES:
        social_type = SocialType(**item)
        social_types.append(social_type)

    with transaction.atomic():
        SocialType.objects.bulk_create(social_types)


def delete_social_types(apps, schema_editor):
    SocialType = apps.get_model('social', 'SocialType')
    SocialType.objects.all().delete()


class Migration(migrations.Migration):
    dependencies = [
        ('social', '0002_auto_20191202_0228'),
    ]

    operations = [
        migrations.RunPython(add_social_types, delete_social_types),
    ]
