Commit 446bc77f by Matjaz Gregoric

Make Answer.course_key non-nullable.

Previous migration populates any null course_key fields, so we can now
change the column to not allow NULL values.

We make the deprecated course_id nullable, to be able to start ignoring
it later.
parent bcf79115
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('problem_builder', '0004_copy_course_ids'),
]
operations = [
migrations.AlterField(
model_name='answer',
name='course_id',
field=models.CharField(default=None, max_length=50, null=True, db_index=True, blank=True),
),
migrations.AlterField(
model_name='answer',
name='course_key',
field=models.CharField(max_length=255, db_index=True),
),
]
...@@ -43,11 +43,9 @@ class Answer(models.Model): ...@@ -43,11 +43,9 @@ class Answer(models.Model):
name = models.CharField(max_length=50, db_index=True) name = models.CharField(max_length=50, db_index=True)
student_id = models.CharField(max_length=32, db_index=True) student_id = models.CharField(max_length=32, db_index=True)
# course_id is deprecated; it will be removed in next release. # course_id is deprecated; it will be removed in next release.
course_id = models.CharField(max_length=50, db_index=True) course_id = models.CharField(max_length=50, db_index=True, null=True, default=None)
# course_key is the new course_id replacement with extended max_length. # course_key is the new course_id replacement with extended max_length.
# We need to allow NULL values during the transition period, course_key = models.CharField(max_length=255, db_index=True)
# but we will remove the null=True and default=None parameters in next release.
course_key = models.CharField(max_length=255, db_index=True, null=True, default=None)
student_input = models.TextField(blank=True, default='') student_input = models.TextField(blank=True, default='')
created_on = models.DateTimeField('created on', auto_now_add=True) created_on = models.DateTimeField('created on', auto_now_add=True)
modified_on = models.DateTimeField('modified on', auto_now=True) modified_on = models.DateTimeField('modified on', auto_now=True)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment