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

import random

from django.db import migrations, models
import phonenumber_field.modelfields


def random_confirmation_code():
    return '{0:04d}'.format(random.SystemRandom().randint(1, 9999))


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='PhoneConfirmation',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('phone_number', phonenumber_field.modelfields.PhoneNumberField(db_index=True, max_length=128)),
                ('code', models.CharField(default=random_confirmation_code, max_length=6)),
            ],
        ),
        migrations.AlterIndexTogether(
            name='phoneconfirmation',
            index_together=set([('phone_number', 'code'), ('created_at', 'phone_number', 'code')]),
        ),
    ]
