Skip to content

Commit

Permalink
Merge pull request #108 from ccnmtl/mysql-only
Browse files Browse the repository at this point in the history
MySQL support: add the lms_course_context as a CharField
  • Loading branch information
nikolas authored Feb 6, 2018
2 parents a31d346 + 13a10b6 commit bf9b8a0
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions lti_provider/migrations/0005_auto_20171009_1234.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,26 @@
from django.db import migrations, models


class MySQLAddLMSCourseContext(migrations.AddField):

def database_forwards(
self, app_label, schema_editor, from_state, to_state):

if schema_editor.connection.vendor.startswith("mysql"):
super(MySQLAddLMSCourseContext, self).database_forwards(
app_label, schema_editor, from_state, to_state)


class PostgresAddLMSCourseContext(migrations.AddField):

def database_forwards(
self, app_label, schema_editor, from_state, to_state):

if schema_editor.connection.vendor.startswith("postgres"):
super(PostgresAddLMSCourseContext, self).database_forwards(
app_label, schema_editor, from_state, to_state)


class Migration(migrations.Migration):

dependencies = [
Expand All @@ -20,9 +40,14 @@ class Migration(migrations.Migration):
model_name='lticoursecontext',
name='uuid',
),
migrations.AddField(
PostgresAddLMSCourseContext(
model_name='lticoursecontext',
name='lms_course_context',
field=models.TextField(null=True, unique=True),
field=models.TextField(null=True, unique=True)
),
MySQLAddLMSCourseContext(
model_name='lticoursecontext',
name='lms_course_context',
field=models.CharField(max_length=255, null=True, unique=True)
)
]

0 comments on commit bf9b8a0

Please sign in to comment.