Skip to content

Commit

Permalink
fix: attempting to frame up a solution
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnagro committed Jan 18, 2024
1 parent 0ca71e4 commit d25c3d0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ class Migration(migrations.Migration):
# ),
# ]

operations = []
operations = [
migrations.RunPython(migrations.RunPython.noop, reverse_code=migrations.RunPython.noop)
]
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
# Generated by Django 3.2.22 on 2024-01-18 18:22

from django.apps import apps
from django.db import migrations
from django.core.exceptions import FieldDoesNotExist
from integrated_channels.blackboard.models import *


def forwards_func(apps, schema_editor):
try:
if field := BlackboardLearnerDataTransmissionAudit._meta.get_field('transmission_status'):
schema_editor.remove_field(BlackboardLearnerDataTransmissionAudit, field)
except FieldDoesNotExist:
pass

try:
if field := BlackboardLearnerAssessmentDataTransmissionAudit._meta.get_field('transmission_status'):
schema_editor.remove_field(BlackboardLearnerAssessmentDataTransmissionAudit, field)
except FieldDoesNotExist:
pass


class Migration(migrations.Migration):
Expand All @@ -16,29 +30,6 @@ class Migration(migrations.Migration):
# this migration conditionally cleans up the previous migration operations
# only if they were part of the partially applied ones

BlackboardLearnerAssessmentDataTransmissionAudit = apps.get_model('blackboard', 'BlackboardLearnerAssessmentDataTransmissionAudit')
BlackboardLearnerDataTransmissionAudit = apps.get_model('blackboard', 'BlackboardLearnerDataTransmissionAudit')

operations = []

try:
if BlackboardLearnerDataTransmissionAudit._meta.get_field('transmission_status'):
operations.append(
migrations.RemoveField(
model_name='blackboardlearnerdatatransmissionaudit',
name='transmission_status',
)
)
except FieldDoesNotExist:
pass

try:
if BlackboardLearnerAssessmentDataTransmissionAudit._meta.get_field('transmission_status'):
operations.append(
migrations.RemoveField(
model_name='blackboardlearnerassessmentdatatransmissionaudit',
name='transmission_status',
)
)
except FieldDoesNotExist:
pass
operations = [
migrations.RunPython(forwards_func, reverse_code=migrations.RunPython.noop)
]
2 changes: 2 additions & 0 deletions integrated_channels/integrated_channel/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,8 @@ class LearnerDataTransmissionAudit(TimeStampedModel):
help_text=_('Data pertaining to the transmissions API request response.')
)

transmission_status = models.JSONField(default=list, blank=True, null=True)

class Meta:
abstract = True
app_label = 'integrated_channel'
Expand Down

0 comments on commit d25c3d0

Please sign in to comment.