# Generated by Django 3.0.3 on 2020-02-11 12:19
from django.conf import settings
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import pangea.core.models
import uuid
[docs]class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0011_update_proxy_permissions'),
]
operations = [
migrations.CreateModel(
name='PangeaUser',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('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')),
('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')),
('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')),
('email', models.EmailField(max_length=254, unique=True, verbose_name='email address')),
('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')),
('user_permissions', 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')),
],
options={
'verbose_name': 'user',
'verbose_name_plural': 'users',
'abstract': False,
},
),
migrations.CreateModel(
name='Organization',
fields=[
('created_at', models.DateTimeField(blank=True, db_index=True, null=True)),
('updated_at', models.DateTimeField(blank=True, db_index=True, null=True)),
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('name', models.TextField(unique=True)),
('users', models.ManyToManyField(to=settings.AUTH_USER_MODEL)),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='Sample',
fields=[
('created_at', models.DateTimeField(blank=True, db_index=True, null=True)),
('updated_at', models.DateTimeField(blank=True, db_index=True, null=True)),
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('name', models.TextField()),
('metadata', django.contrib.postgres.fields.jsonb.JSONField(default=dict)),
],
),
migrations.CreateModel(
name='SampleAnalysisResult',
fields=[
('created_at', models.DateTimeField(blank=True, db_index=True, null=True)),
('updated_at', models.DateTimeField(blank=True, db_index=True, null=True)),
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('module_name', models.TextField(db_index=True)),
('replicate', models.TextField(default=pangea.core.models.random_replicate_name)),
('status', models.TextField(choices=[('pending', 'Pending'), ('error', 'Error'), ('working', 'Working'), ('success', 'Success')], default='pending')),
('sample', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='analysis_result_set', to='core.Sample')),
],
options={
'unique_together': {('module_name', 'replicate', 'sample')},
},
),
migrations.CreateModel(
name='SampleGroup',
fields=[
('created_at', models.DateTimeField(blank=True, db_index=True, null=True)),
('updated_at', models.DateTimeField(blank=True, db_index=True, null=True)),
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('name', models.TextField(unique=True)),
('description', models.TextField(default='')),
('is_public', models.BooleanField(default=True)),
('theme', models.TextField(blank=True)),
('organization', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Organization')),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='SampleGroupAnalysisResult',
fields=[
('created_at', models.DateTimeField(blank=True, db_index=True, null=True)),
('updated_at', models.DateTimeField(blank=True, db_index=True, null=True)),
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('module_name', models.TextField(db_index=True)),
('replicate', models.TextField(default=pangea.core.models.random_replicate_name)),
('status', models.TextField(choices=[('pending', 'Pending'), ('error', 'Error'), ('working', 'Working'), ('success', 'Success')], default='pending')),
('sample_group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='analysis_result_set', to='core.SampleGroup')),
],
options={
'unique_together': {('module_name', 'replicate', 'sample_group')},
},
),
migrations.CreateModel(
name='SampleLibrary',
fields=[
('created_at', models.DateTimeField(blank=True, db_index=True, null=True)),
('updated_at', models.DateTimeField(blank=True, db_index=True, null=True)),
('group', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, related_name='library', serialize=False, to='core.SampleGroup')),
],
options={
'abstract': False,
},
),
migrations.AddField(
model_name='sample',
name='sample_groups',
field=models.ManyToManyField(to='core.SampleGroup'),
),
migrations.CreateModel(
name='SampleGroupAnalysisResultField',
fields=[
('created_at', models.DateTimeField(blank=True, db_index=True, null=True)),
('updated_at', models.DateTimeField(blank=True, db_index=True, null=True)),
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('name', models.TextField()),
('stored_data', django.contrib.postgres.fields.jsonb.JSONField()),
('analysis_result', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='fields', to='core.SampleGroupAnalysisResult')),
],
options={
'abstract': False,
'unique_together': {('analysis_result', 'name')},
},
),
migrations.CreateModel(
name='SampleAnalysisResultField',
fields=[
('created_at', models.DateTimeField(blank=True, db_index=True, null=True)),
('updated_at', models.DateTimeField(blank=True, db_index=True, null=True)),
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('name', models.TextField()),
('stored_data', django.contrib.postgres.fields.jsonb.JSONField()),
('analysis_result', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='fields', to='core.SampleAnalysisResult')),
],
options={
'abstract': False,
'unique_together': {('analysis_result', 'name')},
},
),
migrations.AddField(
model_name='sample',
name='library',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='owned_samples', to='core.SampleLibrary'),
),
migrations.AlterUniqueTogether(
name='sample',
unique_together={('name', 'library')},
),
]