from django.db import migrations, models
from django.conf import settings
from opaque_keys.edx.django.models import CourseKeyField


class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='CohortMembership',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('course_id', CourseKeyField(max_length=255)),
            ],
        ),
        migrations.CreateModel(
            name='CourseCohort',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('assignment_type', models.CharField(default='manual', max_length=20, choices=[('random', 'Random'), ('manual', 'Manual')])),
            ],
        ),
        migrations.CreateModel(
            name='CourseCohortsSettings',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('is_cohorted', models.BooleanField(default=False)),
                ('course_id', CourseKeyField(help_text='Which course are these settings associated with?', unique=True, max_length=255, db_index=True)),
                ('_cohorted_discussions', models.TextField(null=True, db_column='cohorted_discussions', blank=True)),
                ('always_cohort_inline_discussions', models.BooleanField(default=True)),
            ],
        ),
        migrations.CreateModel(
            name='CourseUserGroup',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('name', models.CharField(help_text='What is the name of this group?  Must be unique within a course.', max_length=255)),
                ('course_id', CourseKeyField(help_text='Which course is this group associated with?', max_length=255, db_index=True)),
                ('group_type', models.CharField(max_length=20, choices=[('cohort', 'Cohort')])),
                ('users', models.ManyToManyField(help_text='Who is in this group?', related_name='course_groups', to=settings.AUTH_USER_MODEL, db_index=True)),
            ],
        ),
        migrations.CreateModel(
            name='CourseUserGroupPartitionGroup',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('partition_id', models.IntegerField(help_text='contains the id of a cohorted partition in this course')),
                ('group_id', models.IntegerField(help_text='contains the id of a specific group within the cohorted partition')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('course_user_group', models.OneToOneField(to='course_groups.CourseUserGroup', on_delete=models.CASCADE)),
            ],
        ),
        migrations.AddField(
            model_name='coursecohort',
            name='course_user_group',
            field=models.OneToOneField(related_name='cohort', to='course_groups.CourseUserGroup', on_delete=models.CASCADE),
        ),
        migrations.AddField(
            model_name='cohortmembership',
            name='course_user_group',
            field=models.ForeignKey(to='course_groups.CourseUserGroup', on_delete=models.CASCADE),
        ),
        migrations.AddField(
            model_name='cohortmembership',
            name='user',
            field=models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE),
        ),
        migrations.AlterUniqueTogether(
            name='courseusergroup',
            unique_together={('name', 'course_id')},
        ),
        migrations.AlterUniqueTogether(
            name='cohortmembership',
            unique_together={('user', 'course_id')},
        ),
    ]

[((202, 259), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (233, 259), False, 'from django.db import migrations, models\n'), ((3807, 3907), 'django.db.migrations.AlterUniqueTogether', 'migrations.AlterUniqueTogether', ([], {'name': '"""courseusergroup"""', 'unique_together': "{('name', 'course_id')}"}), "(name='courseusergroup', unique_together={(\n    'name', 'course_id')})\n", (3837, 3907), False, 'from django.db import migrations, models\n'), ((3947, 4048), 'django.db.migrations.AlterUniqueTogether', 'migrations.AlterUniqueTogether', ([], {'name': '"""cohortmembership"""', 'unique_together': "{('user', 'course_id')}"}), "(name='cohortmembership', unique_together={(\n    'user', 'course_id')})\n", (3977, 4048), False, 'from django.db import migrations, models\n'), ((3261, 3371), 'django.db.models.OneToOneField', 'models.OneToOneField', ([], {'related_name': '"""cohort"""', 'to': '"""course_groups.CourseUserGroup"""', 'on_delete': 'models.CASCADE'}), "(related_name='cohort', to=\n    'course_groups.CourseUserGroup', on_delete=models.CASCADE)\n", (3281, 3371), False, 'from django.db import migrations, models\n'), ((3507, 3586), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'to': '"""course_groups.CourseUserGroup"""', 'on_delete': 'models.CASCADE'}), "(to='course_groups.CourseUserGroup', on_delete=models.CASCADE)\n", (3524, 3586), False, 'from django.db import migrations, models\n'), ((3714, 3786), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'to': 'settings.AUTH_USER_MODEL', 'on_delete': 'models.CASCADE'}), '(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)\n', (3731, 3786), False, 'from django.db import migrations, models\n'), ((400, 493), 'django.db.models.AutoField', 'models.AutoField', ([], {'verbose_name': '"""ID"""', 'serialize': '(False)', 'auto_created': '(True)', 'primary_key': '(True)'}), "(verbose_name='ID', serialize=False, auto_created=True,\n    primary_key=True)\n", (416, 493), False, 'from django.db import migrations, models\n'), ((522, 552), 'opaque_keys.edx.django.models.CourseKeyField', 'CourseKeyField', ([], {'max_length': '(255)'}), '(max_length=255)\n', (536, 552), False, 'from opaque_keys.edx.django.models import CourseKeyField\n'), ((690, 783), 'django.db.models.AutoField', 'models.AutoField', ([], {'verbose_name': '"""ID"""', 'serialize': '(False)', 'auto_created': '(True)', 'primary_key': '(True)'}), "(verbose_name='ID', serialize=False, auto_created=True,\n    primary_key=True)\n", (706, 783), False, 'from django.db import migrations, models\n'), ((818, 925), 'django.db.models.CharField', 'models.CharField', ([], {'default': '"""manual"""', 'max_length': '(20)', 'choices': "[('random', 'Random'), ('manual', 'Manual')]"}), "(default='manual', max_length=20, choices=[('random',\n    'Random'), ('manual', 'Manual')])\n", (834, 925), False, 'from django.db import migrations, models\n'), ((1068, 1161), 'django.db.models.AutoField', 'models.AutoField', ([], {'verbose_name': '"""ID"""', 'serialize': '(False)', 'auto_created': '(True)', 'primary_key': '(True)'}), "(verbose_name='ID', serialize=False, auto_created=True,\n    primary_key=True)\n", (1084, 1161), False, 'from django.db import migrations, models\n'), ((1192, 1226), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (1211, 1226), False, 'from django.db import migrations, models\n'), ((1259, 1383), 'opaque_keys.edx.django.models.CourseKeyField', 'CourseKeyField', ([], {'help_text': '"""Which course are these settings associated with?"""', 'unique': '(True)', 'max_length': '(255)', 'db_index': '(True)'}), "(help_text='Which course are these settings associated with?',\n    unique=True, max_length=255, db_index=True)\n", (1273, 1383), False, 'from opaque_keys.edx.django.models import CourseKeyField\n'), ((1424, 1497), 'django.db.models.TextField', 'models.TextField', ([], {'null': '(True)', 'db_column': '"""cohorted_discussions"""', 'blank': '(True)'}), "(null=True, db_column='cohorted_discussions', blank=True)\n", (1440, 1497), False, 'from django.db import migrations, models\n'), ((1553, 1586), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(True)'}), '(default=True)\n', (1572, 1586), False, 'from django.db import migrations, models\n'), ((1727, 1820), 'django.db.models.AutoField', 'models.AutoField', ([], {'verbose_name': '"""ID"""', 'serialize': '(False)', 'auto_created': '(True)', 'primary_key': '(True)'}), "(verbose_name='ID', serialize=False, auto_created=True,\n    primary_key=True)\n", (1743, 1820), False, 'from django.db import migrations, models\n'), ((1844, 1963), 'django.db.models.CharField', 'models.CharField', ([], {'help_text': '"""What is the name of this group?  Must be unique within a course."""', 'max_length': '(255)'}), "(help_text=\n    'What is the name of this group?  Must be unique within a course.',\n    max_length=255)\n", (1860, 1963), False, 'from django.db import migrations, models\n'), ((1987, 2093), 'opaque_keys.edx.django.models.CourseKeyField', 'CourseKeyField', ([], {'help_text': '"""Which course is this group associated with?"""', 'max_length': '(255)', 'db_index': '(True)'}), "(help_text='Which course is this group associated with?',\n    max_length=255, db_index=True)\n", (2001, 2093), False, 'from opaque_keys.edx.django.models import CourseKeyField\n'), ((2123, 2186), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(20)', 'choices': "[('cohort', 'Cohort')]"}), "(max_length=20, choices=[('cohort', 'Cohort')])\n", (2139, 2186), False, 'from django.db import migrations, models\n'), ((2215, 2351), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'help_text': '"""Who is in this group?"""', 'related_name': '"""course_groups"""', 'to': 'settings.AUTH_USER_MODEL', 'db_index': '(True)'}), "(help_text='Who is in this group?', related_name=\n    'course_groups', to=settings.AUTH_USER_MODEL, db_index=True)\n", (2237, 2351), False, 'from django.db import migrations, models\n'), ((2501, 2594), 'django.db.models.AutoField', 'models.AutoField', ([], {'verbose_name': '"""ID"""', 'serialize': '(False)', 'auto_created': '(True)', 'primary_key': '(True)'}), "(verbose_name='ID', serialize=False, auto_created=True,\n    primary_key=True)\n", (2517, 2594), False, 'from django.db import migrations, models\n'), ((2626, 2718), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'help_text': '"""contains the id of a cohorted partition in this course"""'}), "(help_text=\n    'contains the id of a cohorted partition in this course')\n", (2645, 2718), False, 'from django.db import migrations, models\n'), ((2745, 2848), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'help_text': '"""contains the id of a specific group within the cohorted partition"""'}), "(help_text=\n    'contains the id of a specific group within the cohorted partition')\n", (2764, 2848), False, 'from django.db import migrations, models\n'), ((2877, 2916), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now_add': '(True)'}), '(auto_now_add=True)\n', (2897, 2916), False, 'from django.db import migrations, models\n'), ((2950, 2985), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now': '(True)'}), '(auto_now=True)\n', (2970, 2985), False, 'from django.db import migrations, models\n'), ((3026, 3113), 'django.db.models.OneToOneField', 'models.OneToOneField', ([], {'to': '"""course_groups.CourseUserGroup"""', 'on_delete': 'models.CASCADE'}), "(to='course_groups.CourseUserGroup', on_delete=models.\n    CASCADE)\n", (3046, 3113), False, 'from django.db import migrations, models\n')]