# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-03 11:20
from __future__ import unicode_literals

import cryptofield.fields
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Alias',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('account', models.CharField(max_length=249)),
                ('enabled', models.BooleanField(default=True)),
            ],
            options={
                'verbose_name_plural': 'aliases',
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Domain',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=252, unique=True)),
                ('enabled', models.BooleanField(default=True)),
            ],
        ),
        migrations.CreateModel(
            name='Mailbox',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('account', models.CharField(max_length=249)),
                ('enabled', models.BooleanField(default=True)),
                ('password', cryptofield.fields.CryptoField(max_length=256)),
                ('domain', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='maccman.Domain')),
            ],
            options={
                'verbose_name_plural': 'mailboxes',
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Target',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('address', models.CharField(max_length=254, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='UserProfile',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('allowed_domains', models.ManyToManyField(blank=True, db_table='maccman_users_domains', to='maccman.Domain')),
                ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddField(
            model_name='mailbox',
            name='profile',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='maccman.UserProfile'),
        ),
        migrations.AddField(
            model_name='domain',
            name='owner',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='maccman.UserProfile'),
        ),
        migrations.AddField(
            model_name='alias',
            name='domain',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='maccman.Domain'),
        ),
        migrations.AddField(
            model_name='alias',
            name='profile',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='maccman.UserProfile'),
        ),
        migrations.AddField(
            model_name='alias',
            name='targets',
            field=models.ManyToManyField(db_table='maccman_aliases_targets', to='maccman.Target'),
        ),
        migrations.AlterUniqueTogether(
            name='mailbox',
            unique_together=set([('account', 'domain')]),
        ),
        migrations.AlterUniqueTogether(
            name='alias',
            unique_together=set([('account', 'domain')]),
        ),
    ]
