class Migration(migrations.Migration):

    dependencies = [
        ('api', '0001_initial'),
    ]

    operations = [
        migrations.AlterField(
            model_name='agent',
            name='address',
            field=models.GenericIPAddressField(validators=[django.core.validators.validate_ipv4_address], verbose_name='IP Address'),
        ),
        migrations.AlterField(
            model_name='event',
            name='level',
            field=models.CharField(max_length=20, validators=[api.models.confirm_level], verbose_name='Level'),
        ),
        migrations.AlterField(
            model_name='user',
            name='email',
            field=models.CharField(max_length=254, validators=[django.core.validators.EmailValidator()], verbose_name='e-mail'),
        ),
        migrations.AlterField(
            model_name='user',
            name='password',
            field=models.CharField(max_length=50, validators=[django.core.validators.MinLengthValidator(8)], verbose_name='Password'),
        ),
    ]
Beispiel #2
0
class Migration(migrations.Migration):

    dependencies = [
        ('api', '0002_auto_20200618_0552'),
    ]

    operations = [
        migrations.AlterField(
            model_name='agent',
            name='address',
            field=models.GenericIPAddressField(
                validators=[django.core.validators.validate_ipv4_address],
                verbose_name='IP'),
        ),
        migrations.AlterField(
            model_name='event',
            name='level',
            field=models.CharField(max_length=20,
                                   validators=[api.models.validate_level],
                                   verbose_name='Nível'),
        ),
        migrations.AlterField(
            model_name='user',
            name='email',
            field=models.CharField(
                max_length=254,
                validators=[django.core.validators.EmailValidator],
                verbose_name='Email'),
        ),
        migrations.AlterField(
            model_name='user',
            name='password',
            field=models.CharField(
                max_length=50,
                validators=[django.core.validators.MinLengthValidator(8)],
                verbose_name='Senha'),
        ),
    ]
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Agent',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=50)),
                ('status', models.BooleanField(default=False)),
                ('env', models.CharField(max_length=20)),
                ('version', models.CharField(max_length=5)),
                ('address', models.GenericIPAddressField(protocol='IPv4')),
            ],
        ),
        migrations.CreateModel(
            name='Event',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('level',
                 models.CharField(choices=[('CRITICAL', 'CRITICAL'),
                                           ('DEBUG', 'DEBUG'),
                                           ('ERROR', 'ERROR'),
                                           ('WARNING', 'WARNING'),
                                           ('INFO', 'INFO')],
                                  max_length=20,
                                  validators=[api.models.validate_level])),
                ('data', models.TextField()),
                ('arquivado', models.BooleanField(default=False)),
                ('date', models.DateField(auto_now=True)),
                ('agent',
                 models.ForeignKey(
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     to='api.Agent')),
            ],
        ),
        migrations.CreateModel(
            name='Group',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=50)),
            ],
        ),
        migrations.CreateModel(
            name='GroupUser',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('group_id',
                 models.ForeignKey(
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     to='api.Group')),
            ],
        ),
        migrations.CreateModel(
            name='User',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=50)),
                ('last_login', models.DateTimeField(auto_now=True)),
                ('email',
                 models.CharField(
                     max_length=254,
                     validators=[django.core.validators.EmailValidator()])),
                ('password',
                 models.CharField(
                     max_length=50,
                     validators=[django.core.validators.EmailValidator()])),
            ],
        ),
        migrations.AddField(
            model_name='groupuser',
            name='user_id',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.DO_NOTHING, to='api.User'),
        ),
        migrations.AddField(
            model_name='event',
            name='user',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.DO_NOTHING, to='api.User'),
        ),
    ]
Beispiel #4
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Agent',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=50, verbose_name='Name')),
                ('status', models.BooleanField(verbose_name='')),
                ('env', models.CharField(max_length=20, verbose_name='Env')),
                ('version',
                 models.CharField(max_length=5, verbose_name='Version')),
                ('address',
                 models.GenericIPAddressField(
                     validators=[django.core.validators.validate_ipv4_address],
                     verbose_name='IPV4')),
            ],
        ),
        migrations.CreateModel(
            name='Group',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=50, verbose_name='Name')),
            ],
        ),
        migrations.CreateModel(
            name='User',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=50, verbose_name='Name')),
                ('last_login',
                 models.DateTimeField(auto_now=True,
                                      verbose_name='Last Login')),
                ('email',
                 models.CharField(
                     max_length=254,
                     unique=True,
                     validators=[django.core.validators.EmailValidator()])),
                ('password',
                 models.CharField(
                     max_length=50,
                     validators=[django.core.validators.MinLengthValidator(8)],
                     verbose_name='Password')),
            ],
        ),
        migrations.CreateModel(
            name='GroupUser',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('group',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='api.Group')),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='api.User')),
            ],
        ),
        migrations.CreateModel(
            name='Event',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('level',
                 models.CharField(default='INFO',
                                  max_length=20,
                                  validators=[api.models.level_validator],
                                  verbose_name='Level')),
                ('data', models.TextField(verbose_name='Data')),
                ('arquivado', models.BooleanField(verbose_name='Archive')),
                ('date',
                 models.DateTimeField(auto_now=True, verbose_name='Date')),
                ('agent_id',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='api.Agent')),
                ('user_id',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='api.User')),
            ],
        ),
    ]
Beispiel #5
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Address',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('latitude', models.FloatField(blank=True, null=True)),
                ('longitude', models.FloatField(blank=True, null=True)),
                ('pincode', models.CharField(max_length=9)),
                ('extra',
                 models.CharField(blank=True, max_length=100, null=True)),
            ],
            options={
                'db_table': 'address',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Appointment',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('create_on',
                 models.DateTimeField(default=api.models.current_timestamp)),
                ('date', models.DateField()),
                ('time', models.TimeField()),
            ],
        ),
        migrations.CreateModel(
            name='City',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=60)),
                ('code', models.IntegerField(unique=True)),
            ],
            options={
                'db_table': 'cities',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Clinician',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('work_timings',
                 django.contrib.postgres.fields.ArrayField(
                     base_field=django.contrib.postgres.fields.ArrayField(
                         base_field=models.TimeField(), size=2),
                     size=7)),
                ('break_timings',
                 django.contrib.postgres.fields.ArrayField(
                     base_field=django.contrib.postgres.fields.ArrayField(
                         base_field=models.TimeField(), size=2),
                     size=7)),
                ('vacations',
                 django.contrib.postgres.fields.ArrayField(
                     base_field=django.contrib.postgres.fields.ArrayField(
                         base_field=models.DateField(), size=2),
                     size=None)),
                ('education', models.TextField()),
                ('experience',
                 django.contrib.postgres.fields.ArrayField(
                     base_field=models.TextField(), size=None)),
            ],
            options={
                'db_table': 'clinicians',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Country',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=50, unique=True)),
                ('code', models.IntegerField(unique=True)),
            ],
            options={
                'db_table': 'countries',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Coupon',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('uid', models.UUIDField(default=uuid.uuid4, editable=False)),
                ('name', models.CharField(max_length=30)),
                ('quantity', models.PositiveSmallIntegerField()),
                ('validty', models.BooleanField(default=True)),
                ('expiry', models.DateField()),
                ('date_added',
                 models.DateTimeField(default=api.models.current_timestamp,
                                      editable=False)),
            ],
            options={
                'db_table': 'coupons',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='DiscountCard',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('code', models.CharField(max_length=3)),
                ('name', models.CharField(max_length=40, unique=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('quantity', models.PositiveSmallIntegerField(default=0)),
                ('price', models.PositiveSmallIntegerField(default=0)),
                ('validity', models.DateField()),
            ],
            options={
                'db_table': 'discountcards',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='District',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=60)),
                ('code', models.IntegerField(unique=True)),
                ('city',
                 models.ForeignKey(
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     to='api.City')),
            ],
            options={
                'db_table': 'districts',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='HealthCheckup',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('title', models.CharField(max_length=40, unique=True)),
                ('description', models.TextField()),
                ('price', models.PositiveSmallIntegerField(default=0)),
                ('image', models.ImageField(upload_to='health_checks')),
            ],
            options={
                'db_table': 'healthchecks',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Provider',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('is_branch', models.BooleanField(default=False)),
                ('active_from', models.DateField()),
                ('address',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     to='api.Address')),
                ('clinicians', models.ManyToManyField(to='api.Clinician')),
                ('parent_provider',
                 models.OneToOneField(
                     blank=True,
                     null=True,
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     to='api.Provider')),
            ],
            options={
                'db_table': 'providers',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Question',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('question', models.CharField(max_length=100)),
            ],
            options={
                'db_table': 'questions',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Reseller',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
            ],
            options={
                'db_table': 'resellers',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='SalesAgent',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('resellers', models.ManyToManyField(to='api.Reseller')),
            ],
            options={
                'db_table': 'salesagents',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Seeker',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('profession',
                 models.CharField(choices=[('doctor', 'doctor'),
                                           ('teacher', 'teacher'),
                                           ('engineer', 'engineer'),
                                           ('professor', 'professor'),
                                           ('business', 'business'),
                                           ('other', 'other')],
                                  max_length=100)),
                ('language',
                 models.CharField(choices=[('english', 'english'),
                                           ('hindi', 'hindi'),
                                           ('telugu', 'telugu'),
                                           ('marathi', 'marathi'),
                                           ('malayalam', 'malayalam'),
                                           ('gujarati', 'gujarati'),
                                           ('bhojpuri', 'bhojpuri'),
                                           ('tamil', 'tamil'),
                                           ('other', 'other')],
                                  max_length=100)),
                ('dob', models.DateField()),
                ('profile_pic',
                 models.ImageField(default='default_profile.jpg',
                                   upload_to='profile_pics')),
                ('family',
                 models.ManyToManyField(related_name='_seeker_family_+',
                                        to='api.Seeker')),
            ],
            options={
                'db_table': 'seekers',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Speciality',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=50, unique=True)),
                ('description', models.TextField()),
            ],
            options={
                'db_table': 'specialities',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Sponsor',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('org_name', models.CharField(max_length=50)),
                ('org_size', models.PositiveSmallIntegerField(default=10)),
            ],
            options={
                'db_table': 'sponsors',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='State',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=60)),
                ('code', models.IntegerField(unique=True)),
                ('country',
                 models.ForeignKey(
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     to='api.Country')),
            ],
            options={
                'db_table': 'states',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Test',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=40)),
                ('code', models.CharField(max_length=10)),
                ('department', models.CharField(max_length=70)),
                ('description', models.TextField()),
            ],
            options={
                'db_table': 'tests',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='TestCategory',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=40)),
                ('description', models.TextField()),
            ],
            options={
                'db_table': 'test_categories',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Testimonial',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('text', models.TextField()),
                ('date_added',
                 models.DateTimeField(default=api.models.current_timestamp)),
                ('user',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     to='api.Seeker')),
            ],
            options={
                'db_table': 'testimonials',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='TestSubcategory',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=40)),
                ('description', models.TextField()),
                ('category',
                 models.ForeignKey(
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     to='api.TestCategory')),
            ],
            options={
                'db_table': 'test_subcategories',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Transaction',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('uid', models.UUIDField(default=uuid.uuid4, editable=False)),
                ('IP', models.GenericIPAddressField(editable=False)),
                ('timestamp',
                 models.DateTimeField(default=api.models.current_timestamp,
                                      editable=False)),
                ('amount', models.PositiveSmallIntegerField(default=0)),
                ('status',
                 models.CharField(choices=[('1', 'Paid to Pheatlh'),
                                           ('2', 'Paid to user'),
                                           ('3', 'Pending'), ('4', 'Failed')],
                                  max_length=1)),
            ],
            options={
                'db_table': 'transactions',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='User',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('status', models.NullBooleanField(default=True,
                                                   editable=False)),
                ('role',
                 models.CharField(choices=[('healthprovider',
                                            'healthprovider'),
                                           ('healthseeker', 'healthseeker'),
                                           ('clinician', 'clinician'),
                                           ('sponsor', 'sponsor'),
                                           ('salesagent', 'salesagent'),
                                           ('reseller', 'reseller'),
                                           ('admin', 'admin')],
                                  editable=False,
                                  max_length=30)),
                ('reg_date',
                 models.DateTimeField(default=api.models.current_timestamp,
                                      editable=False)),
                ('last_update', models.DateTimeField(editable=False)),
                ('last_IP', models.GenericIPAddressField(editable=False)),
                ('email', models.EmailField(max_length=254)),
                ('name', models.CharField(max_length=150)),
                ('mobile',
                 models.CharField(max_length=15,
                                  validators=[
                                      django.core.validators.RegexValidator(
                                          message='Invalid Number',
                                          regex='^(\\+\\d{1,3}[- ]?)?\\d{10}$')
                                  ])),
                ('password', models.CharField(max_length=100)),
                ('gender',
                 models.CharField(choices=[('M', 'Male'), ('F', 'Female'),
                                           ('O', 'Other')],
                                  max_length=1)),
                ('answer', models.CharField(max_length=100)),
                ('question',
                 models.ForeignKey(
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     to='api.Question')),
            ],
            options={
                'db_table': 'users',
                'managed': True,
            },
        ),
        migrations.AddField(
            model_name='transaction',
            name='receiver',
            field=models.OneToOneField(
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name='received',
                to='api.User'),
        ),
        migrations.AddField(
            model_name='transaction',
            name='sender',
            field=models.OneToOneField(
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name='issued',
                to='api.User'),
        ),
        migrations.AddField(
            model_name='test',
            name='subcategory',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.DO_NOTHING,
                to='api.TestSubcategory'),
        ),
        migrations.AddField(
            model_name='sponsor',
            name='user',
            field=models.OneToOneField(
                on_delete=django.db.models.deletion.DO_NOTHING, to='api.User'),
        ),
        migrations.AddField(
            model_name='seeker',
            name='user',
            field=models.OneToOneField(
                on_delete=django.db.models.deletion.DO_NOTHING, to='api.User'),
        ),
        migrations.AddField(
            model_name='salesagent',
            name='user',
            field=models.OneToOneField(
                on_delete=django.db.models.deletion.DO_NOTHING, to='api.User'),
        ),
        migrations.AddField(
            model_name='reseller',
            name='user',
            field=models.OneToOneField(
                on_delete=django.db.models.deletion.DO_NOTHING, to='api.User'),
        ),
        migrations.AddField(
            model_name='provider',
            name='poc',
            field=models.OneToOneField(
                on_delete=django.db.models.deletion.DO_NOTHING, to='api.User'),
        ),
        migrations.AddField(
            model_name='provider',
            name='specialities',
            field=models.ManyToManyField(to='api.Speciality'),
        ),
        migrations.AddField(
            model_name='healthcheckup',
            name='tests',
            field=models.ManyToManyField(to='api.Test'),
        ),
        migrations.AddField(
            model_name='discountcard',
            name='health_checkups',
            field=models.ManyToManyField(to='api.HealthCheckup'),
        ),
        migrations.AddField(
            model_name='clinician',
            name='specialities',
            field=models.ManyToManyField(to='api.Speciality'),
        ),
        migrations.AddField(
            model_name='clinician',
            name='user',
            field=models.OneToOneField(
                on_delete=django.db.models.deletion.DO_NOTHING, to='api.User'),
        ),
        migrations.AddField(
            model_name='city',
            name='state',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.DO_NOTHING,
                to='api.State'),
        ),
        migrations.AddField(
            model_name='appointment',
            name='provider',
            field=models.OneToOneField(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                to='api.Provider'),
        ),
        migrations.AddField(
            model_name='appointment',
            name='under',
            field=models.OneToOneField(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                to='api.Clinician'),
        ),
        migrations.AddField(
            model_name='address',
            name='district',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.DO_NOTHING,
                to='api.District'),
        ),
    ]
Beispiel #6
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='User',
            fields=[
                ('password', models.CharField(max_length=128, verbose_name='password')),
                ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
                ('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
                ('email', models.EmailField(max_length=255, unique=True, verbose_name='email address')),
                ('name', models.CharField(max_length=255, verbose_name='name')),
                ('is_active', models.BooleanField(default=True)),
                ('is_admin', models.BooleanField(default=False)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Category',
            fields=[
                ('created', models.DateTimeField(editable=False)),
                ('modified', models.DateTimeField(editable=False)),
                ('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=128)),
            ],
            options={
                'abstract': False,
            },
            bases=(api.models.UpdateMixin, models.Model),
        ),
        migrations.CreateModel(
            name='Channel',
            fields=[
                ('created', models.DateTimeField(editable=False)),
                ('modified', models.DateTimeField(editable=False)),
                ('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
                ('number', models.CharField(max_length=8)),
                ('name', models.CharField(max_length=8)),
                ('callsign', models.CharField(max_length=32)),
                ('stream', models.CharField(max_length=256, null=True)),
                ('hd', models.BooleanField(default=False)),
            ],
            bases=(api.models.UpdateMixin, models.Model),
        ),
        migrations.CreateModel(
            name='Device',
            fields=[
                ('created', models.DateTimeField(editable=False)),
                ('modified', models.DateTimeField(editable=False)),
                ('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
                ('user_agent', models.TextField(unique=True)),
                ('last_ip_address', models.GenericIPAddressField(null=True)),
                ('device_brand', models.CharField(max_length=32, null=True)),
                ('device_family', models.CharField(max_length=32, null=True)),
                ('device_model', models.CharField(max_length=32, null=True)),
                ('os_family', models.CharField(max_length=32, null=True)),
                ('os_major', models.CharField(max_length=32, null=True)),
                ('os_minor', models.CharField(max_length=32, null=True)),
                ('os_patch', models.CharField(max_length=32, null=True)),
                ('os_patch_minor', models.CharField(max_length=32, null=True)),
                ('user_agent_family', models.CharField(max_length=32, null=True)),
                ('user_agent_major', models.CharField(max_length=32, null=True)),
                ('user_agent_minor', models.CharField(max_length=32, null=True)),
                ('user_agent_patch', models.CharField(max_length=32, null=True)),
            ],
            options={
                'abstract': False,
            },
            bases=(api.models.UpdateMixin, models.Model),
        ),
        migrations.CreateModel(
            name='DeviceCursor',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('cursor', models.DecimalField(decimal_places=6, default=0.0, max_digits=12)),
                ('device', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='devicecursor', to='api.Device')),
            ],
            bases=(api.models.UpdateMixin, models.Model),
        ),
        migrations.CreateModel(
            name='Episode',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('season', models.PositiveSmallIntegerField(null=True)),
                ('episode', models.PositiveSmallIntegerField(null=True)),
            ],
            bases=(api.models.UpdateMixin, models.Model),
        ),
        migrations.CreateModel(
            name='Image',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
                ('url', models.URLField(unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='Media',
            fields=[
                ('created', models.DateTimeField(editable=False)),
                ('modified', models.DateTimeField(editable=False)),
                ('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
                ('type', models.SmallIntegerField(choices=[(0, 'Movie'), (1, 'Series'), (2, 'Show')])),
                ('title', models.CharField(max_length=256)),
                ('subtitle', models.CharField(max_length=256)),
                ('desc', models.TextField()),
                ('year', models.SmallIntegerField(null=True)),
            ],
            options={
                'abstract': False,
            },
            bases=(api.models.UpdateMixin, models.Model),
        ),
        migrations.CreateModel(
            name='MediaActor',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(editable=False)),
                ('modified', models.DateTimeField(editable=False)),
            ],
            options={
                'abstract': False,
            },
            bases=(api.models.UpdateMixin, models.Model),
        ),
        migrations.CreateModel(
            name='Person',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=16)),
            ],
        ),
        migrations.CreateModel(
            name='Program',
            fields=[
                ('created', models.DateTimeField(editable=False)),
                ('modified', models.DateTimeField(editable=False)),
                ('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
                ('program_id', models.CharField(max_length=32, unique=True)),
                ('season', models.PositiveSmallIntegerField(null=True)),
                ('episode', models.PositiveSmallIntegerField(null=True)),
                ('title', models.CharField(max_length=256)),
                ('subtitle', models.CharField(max_length=256, null=True)),
                ('desc', models.TextField(null=True)),
                ('previously_shown', models.BooleanField(default=True)),
            ],
            options={
                'abstract': False,
            },
            bases=(api.models.UpdateMixin, models.Model),
        ),
        migrations.CreateModel(
            name='ProgramActor',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(editable=False)),
                ('modified', models.DateTimeField(editable=False)),
                ('person', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Person')),
                ('program', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Program')),
            ],
            options={
                'abstract': False,
            },
            bases=(api.models.UpdateMixin, models.Model),
        ),
        migrations.CreateModel(
            name='Rating',
            fields=[
                ('created', models.DateTimeField(editable=False)),
                ('modified', models.DateTimeField(editable=False)),
                ('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=16)),
            ],
            options={
                'abstract': False,
            },
            bases=(api.models.UpdateMixin, models.Model),
        ),
        migrations.CreateModel(
            name='Recording',
            fields=[
                ('created', models.DateTimeField(editable=False)),
                ('modified', models.DateTimeField(editable=False)),
                ('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
                ('start', models.DateTimeField()),
                ('stop', models.DateTimeField()),
                ('status', models.SmallIntegerField(choices=[(0, 'none'), (1, 'recording'), (2, 'error'), (3, 'done')], default=0)),
                ('pid', models.IntegerField(null=True)),
            ],
            options={
                'abstract': False,
            },
            bases=(api.models.UpdateMixin, models.Model),
        ),
        migrations.CreateModel(
            name='Schedule',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
                ('start', models.DateTimeField()),
                ('stop', models.DateTimeField()),
                ('duration', models.IntegerField()),
                ('channel', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='programs', to='api.Channel')),
                ('program', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='schedules', to='api.Program')),
                ('rating', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='api.Rating')),
            ],
            bases=(api.models.UpdateMixin, models.Model),
        ),
        migrations.CreateModel(
            name='Stream',
            fields=[
                ('created', models.DateTimeField(editable=False)),
                ('modified', models.DateTimeField(editable=False)),
                ('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
                ('type', models.SmallIntegerField(choices=[(0, 'hls'), (1, 'raw')])),
                ('path', api.models.DirectoryPathField(max_length=256, null=True)),
                ('pid', models.IntegerField(null=True)),
            ],
            options={
                'abstract': False,
            },
            bases=(api.models.UpdateMixin, models.Model),
        ),
        migrations.CreateModel(
            name='Tuner',
            fields=[
                ('created', models.DateTimeField(editable=False)),
                ('modified', models.DateTimeField(editable=False)),
                ('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
                ('device_id', models.IntegerField(unique=True)),
                ('device_ip', models.GenericIPAddressField()),
                ('model', models.CharField(max_length=48)),
                ('tuner_count', models.SmallIntegerField()),
            ],
            options={
                'abstract': False,
            },
            bases=(api.models.UpdateMixin, models.Model),
        ),
        migrations.CreateModel(
            name='Movie',
            fields=[
                ('media_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='api.Media')),
                ('width', models.SmallIntegerField(null=True)),
                ('height', models.SmallIntegerField(null=True)),
                ('video_enc', models.CharField(max_length=32, null=True)),
                ('size', models.IntegerField(null=True)),
                ('audio_enc', models.CharField(max_length=32, null=True)),
                ('duration', models.DecimalField(decimal_places=6, max_digits=12, null=True)),
                ('format', models.CharField(max_length=32, null=True)),
                ('play_count', models.IntegerField(default=0)),
                ('path', api.models.FilePathField(auto_create_parent=True, max_length=256, must_exist=False, relative_to='/var/tmp/dsdvr/media')),
            ],
            options={
                'abstract': False,
            },
            bases=('api.media',),
        ),
        migrations.CreateModel(
            name='Series',
            fields=[
                ('media_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='api.Media')),
            ],
            options={
                'abstract': False,
            },
            bases=('api.media',),
        ),
        migrations.CreateModel(
            name='Show',
            fields=[
                ('media_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='api.Media')),
                ('width', models.SmallIntegerField(null=True)),
                ('height', models.SmallIntegerField(null=True)),
                ('video_enc', models.CharField(max_length=32, null=True)),
                ('size', models.IntegerField(null=True)),
                ('audio_enc', models.CharField(max_length=32, null=True)),
                ('duration', models.DecimalField(decimal_places=6, max_digits=12, null=True)),
                ('format', models.CharField(max_length=32, null=True)),
                ('play_count', models.IntegerField(default=0)),
                ('path', api.models.FilePathField(auto_create_parent=True, max_length=256, must_exist=False, relative_to='/var/tmp/dsdvr/media')),
            ],
            options={
                'abstract': False,
            },
            bases=('api.media',),
        ),
        migrations.AddField(
            model_name='stream',
            name='media',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='stream', to='api.Media'),
        ),
        migrations.AddField(
            model_name='recording',
            name='media',
            field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='recording', to='api.Media'),
        ),
        migrations.AddField(
            model_name='recording',
            name='program',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='recording', to='api.Program'),
        ),
        migrations.AddField(
            model_name='program',
            name='actors',
            field=models.ManyToManyField(through='api.ProgramActor', to='api.Person'),
        ),
        migrations.AddField(
            model_name='program',
            name='categories',
            field=models.ManyToManyField(related_name='programs', to='api.Category'),
        ),
        migrations.AddField(
            model_name='program',
            name='images',
            field=models.ManyToManyField(related_name='programs', to='api.Image'),
        ),
        migrations.AddField(
            model_name='program',
            name='poster',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='program_posters', to='api.Image'),
        ),
        migrations.AddField(
            model_name='mediaactor',
            name='media',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Media'),
        ),
        migrations.AddField(
            model_name='mediaactor',
            name='person',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Person'),
        ),
        migrations.AddField(
            model_name='media',
            name='actors',
            field=models.ManyToManyField(through='api.MediaActor', to='api.Person'),
        ),
        migrations.AddField(
            model_name='media',
            name='categories',
            field=models.ManyToManyField(related_name='media', to='api.Category'),
        ),
        migrations.AddField(
            model_name='media',
            name='images',
            field=models.ManyToManyField(related_name='media', to='api.Image'),
        ),
        migrations.AddField(
            model_name='media',
            name='poster',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='media_posters', to='api.Image'),
        ),
        migrations.AddField(
            model_name='media',
            name='rating',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='api.Rating'),
        ),
        migrations.AddField(
            model_name='devicecursor',
            name='stream',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='devicecursor', to='api.Stream'),
        ),
        migrations.AddField(
            model_name='channel',
            name='images',
            field=models.ManyToManyField(related_name='channels', to='api.Image'),
        ),
        migrations.AddField(
            model_name='channel',
            name='poster',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='channel_posters', to='api.Image'),
        ),
        migrations.AddField(
            model_name='channel',
            name='tuner',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='channels', to='api.Tuner'),
        ),
        migrations.AddField(
            model_name='show',
            name='program',
            field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='shows', to='api.Program'),
        ),
        migrations.AddField(
            model_name='show',
            name='series',
            field=models.ManyToManyField(through='api.Episode', to='api.Series'),
        ),
        migrations.AlterUniqueTogether(
            name='schedule',
            unique_together={('channel', 'start'), ('channel', 'stop')},
        ),
        migrations.AddField(
            model_name='movie',
            name='program',
            field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='movies', to='api.Program'),
        ),
        migrations.AddField(
            model_name='episode',
            name='series',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Series'),
        ),
        migrations.AddField(
            model_name='episode',
            name='show',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='api.Show'),
        ),
        migrations.AlterUniqueTogether(
            name='devicecursor',
            unique_together={('device', 'cursor')},
        ),
        migrations.AlterUniqueTogether(
            name='channel',
            unique_together={('tuner', 'number')},
        ),
    ]
Beispiel #7
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Agent',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=50)),
                ('status', models.BooleanField()),
                ('env', models.CharField(max_length=20)),
                ('version', models.CharField(max_length=5)),
                ('address', models.GenericIPAddressField(protocol='IPv4')),
            ],
        ),
        migrations.CreateModel(
            name='Group',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=50)),
            ],
        ),
        migrations.CreateModel(
            name='User',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=50)),
                ('last_login', models.DateTimeField(auto_now=True)),
                ('email', models.EmailField(max_length=254)),
                ('password',
                 models.CharField(
                     max_length=50,
                     validators=[django.core.validators.MinLengthValidator(8)
                                 ])),
            ],
        ),
        migrations.CreateModel(
            name='GroupUser',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('group',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='api.Group')),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='api.User')),
            ],
        ),
        migrations.CreateModel(
            name='Event',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('level',
                 models.CharField(max_length=20,
                                  validators=[api.models.validate_level])),
                ('data', models.TextField()),
                ('arquivado', models.BooleanField()),
                ('date', models.DateField(auto_now=True)),
                ('agent',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='api.Agent')),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='api.User')),
            ],
        ),
    ]
Beispiel #8
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0011_update_proxy_permissions'),
    ]

    operations = [
        migrations.CreateModel(
            name='UserProfile',
            fields=[
                ('password',
                 models.CharField(max_length=128, verbose_name='password')),
                ('last_login',
                 models.DateTimeField(blank=True,
                                      null=True,
                                      verbose_name='last login')),
                ('is_superuser',
                 models.BooleanField(
                     default=False,
                     help_text=
                     'Designates that this user has all permissions without explicitly assigning them.',
                     verbose_name='superuser status')),
                ('username',
                 models.CharField(
                     error_messages={
                         'unique': 'A user with that username already exists.'
                     },
                     help_text=
                     'Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.',
                     max_length=150,
                     unique=True,
                     validators=[
                         django.contrib.auth.validators.
                         UnicodeUsernameValidator()
                     ],
                     verbose_name='username')),
                ('first_name',
                 models.CharField(blank=True,
                                  max_length=30,
                                  verbose_name='first name')),
                ('last_name',
                 models.CharField(blank=True,
                                  max_length=150,
                                  verbose_name='last name')),
                ('email',
                 models.EmailField(blank=True,
                                   max_length=254,
                                   verbose_name='email address')),
                ('is_staff',
                 models.BooleanField(
                     default=False,
                     help_text=
                     'Designates whether the user can log into this admin site.',
                     verbose_name='staff status')),
                ('is_active',
                 models.BooleanField(
                     default=True,
                     help_text=
                     'Designates whether this user should be treated as active. Unselect this instead of deleting accounts.',
                     verbose_name='active')),
                ('date_joined',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      verbose_name='date joined')),
                ('id',
                 models.UUIDField(default=api.utils.common.make_uuid,
                                  help_text='ID of user',
                                  primary_key=True,
                                  serialize=False)),
                ('role',
                 models.CharField(choices=[('administrator', 'Administrator'),
                                           ('operator', 'Operator'),
                                           ('user', 'User')],
                                  default=2,
                                  max_length=64)),
                ('groups',
                 models.ManyToManyField(
                     blank=True,
                     help_text=
                     'The groups this user belongs to. A user will get all permissions granted to each of their groups.',
                     related_name='user_set',
                     related_query_name='user',
                     to='auth.Group',
                     verbose_name='groups')),
            ],
            options={
                'verbose_name': 'User Info',
                'verbose_name_plural': 'User Info',
                'ordering': ['-date_joined'],
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='Agent',
            fields=[
                ('id',
                 models.UUIDField(default=api.utils.common.make_uuid,
                                  help_text='ID of agent',
                                  primary_key=True,
                                  serialize=False)),
                ('name',
                 models.CharField(
                     default='agent-00743671da9f4c0394985719ec9518eb',
                     help_text='Agent name, can be generated automatically.',
                     max_length=64)),
                ('image',
                 models.CharField(default='',
                                  help_text='Image name for deploy agent',
                                  max_length=64)),
                ('ip',
                 models.GenericIPAddressField(help_text='Agent IP Address')),
                ('status',
                 models.CharField(choices=[('inactive', 'Inactive'),
                                           ('active', 'Active')],
                                  default='active',
                                  help_text='Status of agent',
                                  max_length=10)),
                ('log_level',
                 models.CharField(choices=[('info', 'Info'),
                                           ('warning', 'Warning'),
                                           ('debug', 'Debug'),
                                           ('error', 'Error'),
                                           ('critical', 'Critical')],
                                  default='info',
                                  help_text='Log level of agent',
                                  max_length=10)),
                ('type',
                 models.CharField(choices=[('docker', 'Docker'),
                                           ('kubernetes', 'Kubernetes')],
                                  default='docker',
                                  help_text='Type of agent',
                                  max_length=32)),
                ('schedulable',
                 models.BooleanField(
                     default=True,
                     help_text='Whether agent can be scheduled')),
                ('capacity',
                 models.IntegerField(
                     default=1,
                     help_text='Capacity of agent',
                     validators=[
                         django.core.validators.MinValueValidator(1),
                         django.core.validators.MaxValueValidator(100)
                     ])),
                ('node_capacity',
                 models.IntegerField(
                     default=6,
                     help_text='Capacity of node',
                     validators=[
                         django.core.validators.MinValueValidator(1),
                         django.core.validators.MaxValueValidator(600)
                     ])),
                ('config_file',
                 models.FileField(
                     blank=True,
                     help_text='Config file for agent',
                     max_length=256,
                     upload_to=api.models.get_agent_config_file_path)),
                ('created_at',
                 models.DateTimeField(auto_now_add=True,
                                      help_text='Create time of agent')),
            ],
            options={
                'ordering': ('-created_at', ),
            },
        ),
        migrations.CreateModel(
            name='FabricCA',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('admin_name',
                 models.CharField(default='admin',
                                  help_text='Admin username for ca server',
                                  max_length=32)),
                ('admin_password',
                 models.CharField(default='adminpw',
                                  help_text='Admin password for ca server',
                                  max_length=32)),
                ('hosts',
                 django.contrib.postgres.fields.jsonb.JSONField(
                     blank=True,
                     default=list,
                     help_text='Hosts for ca',
                     null=True)),
                ('type',
                 models.CharField(choices=[('tls', 'TLS'),
                                           ('signature', 'Signature')],
                                  default='signature',
                                  help_text='Fabric ca server type',
                                  max_length=32)),
            ],
        ),
        migrations.CreateModel(
            name='FabricPeer',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(default='',
                                  help_text='Name of peer node',
                                  max_length=64)),
                ('gossip_use_leader_reflection',
                 models.BooleanField(
                     default=True, help_text='Gossip use leader reflection')),
                ('gossip_org_leader',
                 models.BooleanField(default=False,
                                     help_text='Gossip org leader')),
                ('gossip_skip_handshake',
                 models.BooleanField(default=True,
                                     help_text='Gossip skip handshake')),
                ('local_msp_id',
                 models.CharField(default='',
                                  help_text='Local msp id of peer node',
                                  max_length=64)),
            ],
        ),
        migrations.CreateModel(
            name='Govern',
            fields=[
                ('id',
                 models.UUIDField(default=api.utils.common.make_uuid,
                                  help_text='ID of govern',
                                  primary_key=True,
                                  serialize=False)),
                ('name',
                 models.CharField(default='',
                                  help_text='Name of govern',
                                  max_length=64)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
        ),
        migrations.CreateModel(
            name='Network',
            fields=[
                ('id',
                 models.UUIDField(default=api.utils.common.make_uuid,
                                  help_text='ID of network',
                                  primary_key=True,
                                  serialize=False)),
                ('type',
                 models.CharField(default='fabric',
                                  help_text="Type of network, ['fabric']",
                                  max_length=64)),
                ('version',
                 models.CharField(
                     default='',
                     help_text=
                     "\n    Version of network.\n    Fabric supported versions: ['1.4.2', '1.5']\n    ",
                     max_length=64)),
                ('created_at',
                 models.DateTimeField(auto_now_add=True,
                                      help_text='Create time of network')),
                ('govern',
                 models.ForeignKey(help_text='Govern of node',
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='api.Govern')),
            ],
            options={
                'ordering': ('-created_at', ),
            },
        ),
        migrations.CreateModel(
            name='Node',
            fields=[
                ('id',
                 models.UUIDField(default=api.utils.common.make_uuid,
                                  help_text='ID of node',
                                  primary_key=True,
                                  serialize=False)),
                ('name',
                 models.CharField(default='',
                                  help_text='Node name',
                                  max_length=64)),
                ('network_type',
                 models.CharField(choices=[('fabric', 'Fabric')],
                                  default='fabric',
                                  help_text='Network type of node',
                                  max_length=64)),
                ('network_version',
                 models.CharField(
                     default='',
                     help_text=
                     "\n    Version of network for node.\n    Fabric supported versions: ['1.4.2', '1.5']\n    ",
                     max_length=64)),
                ('type',
                 models.CharField(
                     help_text=
                     "\n    Node type defined for network.\n    Fabric available types: ['ca', 'orderer', 'peer']\n    ",
                     max_length=64)),
                ('urls',
                 django.contrib.postgres.fields.jsonb.JSONField(
                     blank=True,
                     default=dict,
                     help_text='URL configurations for node',
                     null=True)),
                ('created_at',
                 models.DateTimeField(auto_now_add=True,
                                      help_text='Create time of network')),
                ('status',
                 models.CharField(choices=[('deploying', 'Deploying'),
                                           ('running', 'Running'),
                                           ('stopped', 'Stopped'),
                                           ('deleting', 'Deleting'),
                                           ('error', 'Error'),
                                           ('deleted', 'Deleted')],
                                  default='deploying',
                                  help_text='Status of node',
                                  max_length=64)),
                ('compose_file',
                 models.FileField(
                     blank=True,
                     help_text=
                     'Compose file for node, if agent type is docker.',
                     max_length=256,
                     null=True,
                     upload_to=api.models.get_compose_file_path)),
                ('file',
                 models.FileField(blank=True,
                                  help_text='File of node',
                                  max_length=256,
                                  null=True,
                                  upload_to=api.models.get_node_file_path)),
                ('agent',
                 models.ForeignKey(help_text='Agent of node',
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='api.Agent')),
                ('ca',
                 models.ForeignKey(help_text='CA configuration of node',
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='api.FabricCA')),
                ('govern',
                 models.ForeignKey(help_text='Govern of node',
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='api.Govern')),
                ('network',
                 models.ForeignKey(help_text='Network which node joined.',
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='api.Network')),
            ],
            options={
                'ordering': ('-created_at', ),
            },
        ),
        migrations.CreateModel(
            name='NodeUser',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(default='',
                                  help_text='User name of node',
                                  max_length=64)),
                ('secret',
                 models.CharField(default='',
                                  help_text='User secret of node',
                                  max_length=64)),
                ('user_type',
                 models.CharField(choices=[('peer', 'Peer'),
                                           ('orderer', 'Orderer'),
                                           ('user', 'User')],
                                  default='peer',
                                  help_text='User type of node',
                                  max_length=64)),
                ('status',
                 models.CharField(choices=[('registering', 'Registering'),
                                           ('registered', 'Registered'),
                                           ('fail', 'Fail')],
                                  default='registering',
                                  help_text='Status of node user',
                                  max_length=32)),
                ('attrs',
                 models.CharField(default='',
                                  help_text='Attributes of node user',
                                  max_length=512)),
                ('node',
                 models.ForeignKey(help_text='Node of user',
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='api.Node')),
            ],
            options={
                'ordering': ('id', ),
            },
        ),
        migrations.CreateModel(
            name='Organization',
            fields=[
                ('id',
                 models.UUIDField(default=api.utils.common.make_uuid,
                                  help_text='ID of organization',
                                  primary_key=True,
                                  serialize=False)),
                ('name',
                 models.CharField(default='',
                                  help_text='Name of organization',
                                  max_length=64)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
        ),
        migrations.CreateModel(
            name='PeerCa',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('address',
                 models.CharField(default='',
                                  help_text='Node Address of ca',
                                  max_length=128)),
                ('certificate',
                 models.FileField(
                     blank=True,
                     help_text='Certificate file for ca node.',
                     max_length=256,
                     null=True,
                     upload_to=api.models.get_ca_certificate_path)),
                ('type',
                 models.CharField(choices=[('tls', 'TLS'),
                                           ('signature', 'Signature')],
                                  default='signature',
                                  help_text='Type of ca node for peer',
                                  max_length=64)),
                ('node',
                 models.ForeignKey(help_text='CA node of peer',
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='api.Node')),
                ('peer',
                 models.ForeignKey(help_text='Peer node',
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='api.FabricPeer')),
            ],
        ),
        migrations.CreateModel(
            name='Port',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('external',
                 models.IntegerField(
                     default=0,
                     help_text='External port',
                     validators=[
                         django.core.validators.MinValueValidator(1),
                         django.core.validators.MaxValueValidator(65535)
                     ])),
                ('internal',
                 models.IntegerField(
                     default=0,
                     help_text='Internal port',
                     validators=[
                         django.core.validators.MinValueValidator(1),
                         django.core.validators.MaxValueValidator(65535)
                     ])),
                ('node',
                 models.ForeignKey(help_text='Node of port',
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='api.Node')),
            ],
            options={
                'ordering': ('external', ),
            },
        ),
        migrations.CreateModel(
            name='PeerCaUser',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('username',
                 models.CharField(
                     default='',
                     help_text='If user not set, set username/password',
                     max_length=64)),
                ('password',
                 models.CharField(
                     default='',
                     help_text='If user not set, set username/password',
                     max_length=64)),
                ('type',
                 models.CharField(choices=[('peer', 'Peer'),
                                           ('orderer', 'Orderer'),
                                           ('user', 'User')],
                                  default='user',
                                  help_text='User type of ca',
                                  max_length=64)),
                ('peer_ca',
                 models.ForeignKey(help_text='Peer Ca configuration',
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='api.PeerCa')),
                ('user',
                 models.ForeignKey(help_text='User of ca node',
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='api.NodeUser')),
            ],
        ),
        migrations.AddField(
            model_name='node',
            name='organization',
            field=models.ForeignKey(
                help_text='Organization of node',
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to='api.Organization'),
        ),
        migrations.AddField(
            model_name='node',
            name='peer',
            field=models.ForeignKey(
                help_text='Peer configuration of node',
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to='api.FabricPeer'),
        ),
        migrations.AddField(
            model_name='node',
            name='user',
            field=models.ForeignKey(
                help_text='User of node',
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to=settings.AUTH_USER_MODEL),
        ),
        migrations.CreateModel(
            name='KubernetesConfig',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('credential_type',
                 models.CharField(choices=[('cert_key', 'CertKey'),
                                           ('config', 'Config'),
                                           ('username_password',
                                            'UsernamePassword')],
                                  default='cert_key',
                                  help_text='Credential type of k8s',
                                  max_length=32)),
                ('enable_ssl',
                 models.BooleanField(default=False,
                                     help_text='Whether enable ssl for api')),
                ('ssl_ca',
                 models.TextField(blank=True,
                                  default='',
                                  help_text='Ca file content for ssl')),
                ('nfs_server',
                 models.CharField(blank=True,
                                  default='',
                                  help_text='NFS server address for k8s',
                                  max_length=256)),
                ('parameters',
                 django.contrib.postgres.fields.jsonb.JSONField(
                     blank=True,
                     default=dict,
                     help_text='Extra parameters for kubernetes',
                     null=True)),
                ('cert',
                 models.TextField(blank=True,
                                  default='',
                                  help_text='Cert content for k8s')),
                ('key',
                 models.TextField(blank=True,
                                  default='',
                                  help_text='Key content for k8s')),
                ('username',
                 models.CharField(blank=True,
                                  default='',
                                  help_text='Username for k8s credential',
                                  max_length=128)),
                ('password',
                 models.CharField(blank=True,
                                  default='',
                                  help_text='Password for k8s credential',
                                  max_length=128)),
                ('agent',
                 models.ForeignKey(help_text='Agent of kubernetes config',
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='api.Agent')),
            ],
        ),
        migrations.CreateModel(
            name='File',
            fields=[
                ('id',
                 models.UUIDField(default=api.utils.common.make_uuid,
                                  help_text='ID of file',
                                  primary_key=True,
                                  serialize=False)),
                ('name',
                 models.CharField(default='',
                                  help_text='File name',
                                  max_length=64)),
                ('file',
                 models.FileField(blank=True,
                                  help_text='File',
                                  max_length=256,
                                  upload_to=api.models.get_file_path)),
                ('created_at',
                 models.DateTimeField(auto_now_add=True,
                                      help_text='Create time of agent')),
                ('type',
                 models.CharField(choices=[('certificate', 'Certificate')],
                                  default='certificate',
                                  help_text='File type',
                                  max_length=32)),
                ('organization',
                 models.ForeignKey(help_text='Organization of file',
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='api.Organization')),
            ],
            options={
                'ordering': ('-created_at', ),
            },
        ),
        migrations.AddField(
            model_name='agent',
            name='govern',
            field=models.ForeignKey(
                help_text='Govern of agent',
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to='api.Govern'),
        ),
        migrations.AddField(
            model_name='agent',
            name='organization',
            field=models.ForeignKey(
                help_text='Organization of agent',
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to='api.Organization'),
        ),
        migrations.AddField(
            model_name='userprofile',
            name='organization',
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to='api.Organization'),
        ),
        migrations.AddField(
            model_name='userprofile',
            name='user_permissions',
            field=models.ManyToManyField(
                blank=True,
                help_text='Specific permissions for this user.',
                related_name='user_set',
                related_query_name='user',
                to='auth.Permission',
                verbose_name='user permissions'),
        ),
    ]