# Generated by Django 2.0.9 on 2018-11-15 16:14

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    dependencies = [
        ('django_mailbox', '0006_mailbox_last_polling'),
        ('crm', '0020_message'),
    ]

    operations = [
        migrations.CreateModel(
            name='ProjectMessage',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='crm.Employee')),
            ],
        ),
        migrations.RemoveField(
            model_name='message',
            name='employee',
        ),
        migrations.RemoveField(
            model_name='message',
            name='message_ptr',
        ),
        migrations.RemoveField(
            model_name='message',
            name='project',
        ),
        migrations.DeleteModel(
            name='Message',
        ),
        migrations.AddField(
            model_name='projectmessage',
            name='message',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='django_mailbox.Message'),
        ),
        migrations.AddField(
            model_name='projectmessage',
            name='project',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='crm.Project'),
        ),
        migrations.AddField(
            model_name='employee',
            name='messages',
            field=models.ManyToManyField(related_name='authors', through='crm.ProjectMessage', to='django_mailbox.Message'),
        ),
        migrations.AddField(
            model_name='project',
            name='messages',
            field=models.ManyToManyField(related_name='projects', through='crm.ProjectMessage', to='django_mailbox.Message'),
        ),
    ]
