# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-06-29 05:07
from __future__ import unicode_literals

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


class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('users', '0012_auto_20170513_0710'),
        ('data', '0026_auto_20170603_0123'),
    ]

    operations = [
        migrations.CreateModel(
            name='CompanyCustomData',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('value', models.TextField()),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('account', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, related_name='company_custom_data', to='users.Account')),
                ('company', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='company_custom_data', to='data.Company')),
            ],
        ),
        migrations.CreateModel(
            name='CompanyCustomField',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('display_name', models.TextField()),
                ('api_name', models.TextField(unique=True)),
                ('type', models.TextField(choices=[(b'model', b'model'), (b'string', b'string'), (b'text', b'text'), (b'date', b'date'), (b'money', b'money'), (b'image', b'image'), (b'number', b'number'), (b'choice', b'choice')])),
                ('required', models.BooleanField(default=False)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('account', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, related_name='company_custom_fields', to='users.Account')),
                ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='company_custom_fields', to=settings.AUTH_USER_MODEL)),
                ('source', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, related_name='company_custom_fields', to='data.DataSourceOption')),
            ],
        ),
        migrations.AddField(
            model_name='companycustomdata',
            name='field',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='company_custom_data', to='data.CompanyCustomField'),
        ),
        migrations.AddField(
            model_name='companycustomdata',
            name='owner',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='company_custom_data', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AlterUniqueTogether(
            name='companycustomdata',
            unique_together=set([('company', 'field')]),
        ),
    ]
