# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-23 14:42
from __future__ import unicode_literals

import django.contrib.postgres.fields
import django.contrib.postgres.fields.jsonb
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import uuid


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Api',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('name', models.CharField(max_length=200, unique=True)),
                ('hosts', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=200, validators=[django.core.validators.RegexValidator(regex='(?=^.{4,253}$)(^((?!-)[a-zA-Z0-9-]{1,63}(?<!-)\\.)+[a-zA-Z]{2,63}\\.?$)')]), size=None)),
                ('upstream_url', models.URLField()),
            ],
        ),
        migrations.CreateModel(
            name='Consumer',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('username', models.CharField(max_length=200, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='ConsumerKey',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('key', models.CharField(max_length=200)),
                ('consumer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api_bouncer.Consumer')),
            ],
        ),
        migrations.CreateModel(
            name='Plugin',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=32)),
                ('config', django.contrib.postgres.fields.jsonb.JSONField(default={}, null=True)),
                ('api', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='plugins', to='api_bouncer.Api')),
            ],
        ),
        migrations.AlterUniqueTogether(
            name='plugin',
            unique_together=set([('api', 'name', 'config')]),
        ),
        migrations.AlterUniqueTogether(
            name='consumerkey',
            unique_together=set([('consumer', 'key')]),
        ),
    ]
