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.
This commit is contained in:
Peter Fogg
2016-01-14 15:41:15 -05:00
parent c37378fe29
commit 4f3234433b

View File

@@ -11,13 +11,18 @@ class Migration(migrations.Migration):
]
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'),
),
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'),
),
]
)
]