# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2019-02-07 23:11
from __future__ import unicode_literals

from django.db import migrations

from apps.rabbitmailserver.models import DefaultMailbox


def initialize_database(apps, schema_editor):
    # DefaultMailbox = apps.get_model('rabbitmailserver', 'DefaultMailbox')

    default_mailbox_names = [
        DefaultMailbox.INBOX,
        DefaultMailbox.DRAFT,
        DefaultMailbox.SENT_ITEMS,
        DefaultMailbox.TRASH
    ]

    for default_mailbox_name in default_mailbox_names:
        default_mailbox = DefaultMailbox()
        default_mailbox.mailbox_name = default_mailbox_name
        default_mailbox.save()


class Migration(migrations.Migration):

    dependencies = [
        ('rabbitmailserver', '0001_initial'),
    ]

    operations = [
        migrations.RunPython(initialize_database),
    ]
