<commit_before># -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models


class Migration(SchemaMigration):

    def forwards(self, orm):
        # Adding model 'CourseUserGroup'
        db.create_table('course_groups_courseusergroup', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
            ('course_id', self.gf('xmodule_django.models.CourseKeyField')(max_length=255, db_index=True)),
            ('group_type', self.gf('django.db.models.fields.CharField')(max_length=20)),
        ))
        db.send_create_signal('course_groups', ['CourseUserGroup'])

        # Adding unique constraint on 'CourseUserGroup', fields ['name', 'course_id']
        db.create_unique('course_groups_courseusergroup', ['name', 'course_id'])

        # Adding M2M table for field users on 'CourseUserGroup'
        db.create_table('course_groups_courseusergroup_users', (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('courseusergroup', models.ForeignKey(orm['course_groups.courseusergroup'], null=False)),
            ('user', models.ForeignKey(orm['auth.user'], null=False))
        ))
        db.create_unique('course_groups_courseusergroup_users', ['courseusergroup_id', 'user_id'])

    def backwards(self, orm):
        # Removing unique constraint on 'CourseUserGroup', fields ['name', 'course_id']
        db.delete_unique('course_groups_courseusergroup', ['name', 'course_id'])

        # Deleting model 'CourseUserGroup'
        db.delete_table('course_groups_courseusergroup')

        # Removing M2M table for field users on 'CourseUserGroup'
        db.delete_table('course_groups_courseusergroup_users')

    models = {
        'auth.group': {
            'Meta': {'object_name': 'Group'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
            'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
        },
        'auth.permission': {<commit_msg>avoid errors when forward-migrating course_groups after south conversion<commit_after># -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models, connection


class Migration(SchemaMigration):

    def forwards(self, orm):
        # Adding model 'CourseUserGroup'

        def table_exists(name):
            return name in connection.introspection.table_names()

        def index_exists(table_name, column_name):
            return column_name in connection.introspection.get_indexes(connection.cursor(), table_name)

        # Since this djangoapp has been converted to south migrations after-the-fact,
        # these tables/indexes should already exist when migrating an existing installation.
        if not (
            table_exists('course_groups_courseusergroup') and
            index_exists('course_groups_courseusergroup', 'name') and
            index_exists('course_groups_courseusergroup', 'course_id') and
            table_exists('course_groups_courseusergroup_users') and
            index_exists('course_groups_courseusergroup_users', 'courseusergroup_id') and
            index_exists('course_groups_courseusergroup_users', 'user_id')
        ):
            db.create_table('course_groups_courseusergroup', (
                ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
                ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
                ('course_id', self.gf('xmodule_django.models.CourseKeyField')(max_length=255, db_index=True)),
                ('group_type', self.gf('django.db.models.fields.CharField')(max_length=20)),
            ))
            db.send_create_signal('course_groups', ['CourseUserGroup'])

            # Adding unique constraint on 'CourseUserGroup', fields ['name', 'course_id']
            db.create_unique('course_groups_courseusergroup', ['name', 'course_id'])

            # Adding M2M table for field users on 'CourseUserGroup'
            db.create_table('course_groups_courseusergroup_users', (
                ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
                ('courseusergroup', models.ForeignKey(orm['course_groups.courseusergroup'], null=False)),
                ('user', models.ForeignKey(orm['auth.user'], null=False))
            ))
            db.create_unique('course_groups_courseusergroup_users', ['courseusergroup_id', 'user_id'])

    def backwards(self, orm):
        # Removing unique constraint on 'CourseUserGroup', fields ['name', 'course_id']
        db.delete_unique('course_groups_courseusergroup', ['name', 'course_id'])

        # Deleting model 'CourseUserGroup'
        db.delete_table('course_groups_courseusergroup')

        # Removing M2M table for field users on 'CourseUserGroup'
        db.delete_table('course_groups_courseusergroup_users')

    models = {
        'auth.group': {
            'Meta': {'object_name': 'Group'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
            'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
        },
        'auth.permission': {
{'fraction_non_alphanumeric': 0.14133473095737248, 'fraction_numerical': 0.004891684136967156, 'mean_word_length': 3.455252918287938, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6540615', 'n_tokens_mistral': 1675, 'n_tokens_neox': 1606, 'n_words': 301}