# Generated by Django 3.2.2 on 2021-08-25 01:53

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='BucketRegion',
            fields=[
                ('reg_id', models.AutoField(auto_created=True, primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=100, verbose_name='name')),
                ('secret_key', models.CharField(max_length=50, verbose_name='secret key')),
                ('access_key', models.CharField(max_length=50, verbose_name='access key')),
                ('server', models.CharField(max_length=20, verbose_name='server ip')),
                ('type', models.CharField(default='local', max_length=20, verbose_name='region type')),
                ('state', models.CharField(choices=[('e', 'enable'), ('d', 'disable')], default='e', max_length=1, verbose_name='region state')),
                ('create_time', models.DateTimeField(auto_now=True)),
            ],
        ),
        migrations.CreateModel(
            name='BucketType',
            fields=[
                ('bucket_type_id', models.AutoField(auto_created=True, primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=20, unique=True, verbose_name='bucket type name')),
                ('price', models.FloatField(verbose_name='bucket price')),
                ('create_time', models.DateTimeField(auto_now=True)),
            ],
        ),
        migrations.CreateModel(
            name='Offset',
            fields=[
                ('off_id', models.AutoField(auto_created=True, primary_key=True, serialize=False)),
                ('code', models.CharField(max_length=6, unique=True, verbose_name='offset code')),
                ('offset', models.FloatField(verbose_name='offset value')),
                ('used_times', models.IntegerField(default=0, verbose_name='used times')),
                ('max_use_times', models.IntegerField(default=0, verbose_name='max use times')),
                ('valid_days', models.IntegerField(default=0, verbose_name='valid days')),
                ('create_time', models.DateTimeField(auto_now=True)),
            ],
        ),
        migrations.CreateModel(
            name='Buckets',
            fields=[
                ('bucket_id', models.AutoField(auto_created=True, primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=63, null=True, unique=True, verbose_name='bucket name')),
                ('version_control', models.BooleanField(default=False, verbose_name='version control')),
                ('permission', models.CharField(default='private', max_length=50)),
                ('state', models.CharField(choices=[('e', 'enable'), ('d', 'disable'), ('s', 'suspend')], default='e', max_length=1, verbose_name='state')),
                ('backup', models.BooleanField(default=False, verbose_name='backup flag')),
                ('read_only', models.BooleanField(default=False, verbose_name='read only flag')),
                ('pid', models.IntegerField(default=0, verbose_name='parent id of bucket')),
                ('create_time', models.DateTimeField(auto_now=True)),
                ('bucket_region', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='buckets.bucketregion')),
                ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='user', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='BucketAcl',
            fields=[
                ('acl_bid', models.AutoField(auto_created=True, primary_key=True, serialize=False)),
                ('permission', models.CharField(default='private', max_length=50, verbose_name='bucket permission')),
                ('create_time', models.DateTimeField(auto_now=True)),
                ('bucket', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='bucket_acl', to='buckets.buckets')),
                ('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
