from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('course_modes', '0004_auto_20151113_1457'),
    ]

    operations = [
        migrations.RemoveField(
            model_name='coursemode',
            name='expiration_datetime',
        ),
        migrations.AddField(
            model_name='coursemode',
            name='_expiration_datetime',
            field=models.DateTimeField(db_column=b'expiration_datetime', default=None, blank=True, help_text='OPTIONAL: After this date/time, users will no longer be able to enroll in this mode. Leave this blank if users can enroll in this mode until enrollment closes for the course.', null=True, verbose_name='Upgrade Deadline'),
        ),
    ]

from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('course_modes', '0004_auto_20151113_1457'),
    ]

    operations = [
        migrations.SeparateDatabaseAndState(
            database_operations=[],
            state_operations=[
                    migrations.RemoveField(
                        model_name='coursemode',
                        name='expiration_datetime',
                    ),
                    migrations.AddField(
                        model_name='coursemode',
                        name='_expiration_datetime',
                        field=models.DateTimeField(db_column=b'expiration_datetime', default=None, blank=True, help_text='OPTIONAL: After this date/time, users will no longer be able to enroll in this mode. Leave this blank if users can enroll in this mode until enrollment closes for the course.', null=True, verbose_name='Upgrade Deadline'),
                    ),
            ]
        )
    ]

Change broken course_modes migration to not touch the database.
Change broken course_modes migration to not touch the database.

Changing a field name in the way that we did (updating the Python
variable name and switching it to point to the old DB column) confuses
Django's migration autodetector. No DB changes are actually necessary,
but it thinks that a field has been removed and a new one added. This
means that Django will ask users to generate the migration it thinks
is necessary, which ended up with us dropping data. The fix is to run
the same migration on Django's internal model of the DB state, but not
actually touch the DB.

  from __future__ import unicode_literals
  
  from django.db import migrations, models
  
  
  class Migration(migrations.Migration):
  
      dependencies = [
          ('course_modes', '0004_auto_20151113_1457'),
      ]
  
      operations = [
+         migrations.SeparateDatabaseAndState(
+             database_operations=[],
+             state_operations=[
-         migrations.RemoveField(
+                     migrations.RemoveField(
-             model_name='coursemode',
+                         model_name='coursemode',
-             name='expiration_datetime',
+                         name='expiration_datetime',
-         ),
+                     ),
-         migrations.AddField(
+                     migrations.AddField(
-             model_name='coursemode',
+                         model_name='coursemode',
-             name='_expiration_datetime',
+                         name='_expiration_datetime',
-             field=models.DateTimeField(db_column=b'expiration_datetime', default=None, blank=True, help_text='OPTIONAL: After this date/time, users will no longer be able to enroll in this mode. Leave this blank if users can enroll in this mode until enrollment closes for the course.', null=True, verbose_name='Upgrade Deadline'),
+                         field=models.DateTimeField(db_column=b'expiration_datetime', default=None, blank=True, help_text='OPTIONAL: After this date/time, users will no longer be able to enroll in this mode. Leave this blank if users can enroll in this mode until enrollment closes for the course.', null=True, verbose_name='Upgrade Deadline'),
+                     ),
+             ]
-         ),
+         )
      ]
  
Change broken course_modes migration to not touch the database.
## Code Before:
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('course_modes', '0004_auto_20151113_1457'),
    ]

    operations = [
        migrations.RemoveField(
            model_name='coursemode',
            name='expiration_datetime',
        ),
        migrations.AddField(
            model_name='coursemode',
            name='_expiration_datetime',
            field=models.DateTimeField(db_column=b'expiration_datetime', default=None, blank=True, help_text='OPTIONAL: After this date/time, users will no longer be able to enroll in this mode. Leave this blank if users can enroll in this mode until enrollment closes for the course.', null=True, verbose_name='Upgrade Deadline'),
        ),
    ]

## Instruction:
Change broken course_modes migration to not touch the database.
## Code After:
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('course_modes', '0004_auto_20151113_1457'),
    ]

    operations = [
        migrations.SeparateDatabaseAndState(
            database_operations=[],
            state_operations=[
                    migrations.RemoveField(
                        model_name='coursemode',
                        name='expiration_datetime',
                    ),
                    migrations.AddField(
                        model_name='coursemode',
                        name='_expiration_datetime',
                        field=models.DateTimeField(db_column=b'expiration_datetime', default=None, blank=True, help_text='OPTIONAL: After this date/time, users will no longer be able to enroll in this mode. Leave this blank if users can enroll in this mode until enrollment closes for the course.', null=True, verbose_name='Upgrade Deadline'),
                    ),
            ]
        )
    ]
