Skip to content

Commit

Permalink
updated migration with datamigation from empty string to null (#1091)
Browse files Browse the repository at this point in the history
  • Loading branch information
muhammad-ali-e authored Jan 24, 2025
1 parent 28e2163 commit c3980ec
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions backend/usage_v2/migrations/0002_alter_usage_run_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,21 @@
from django.db import migrations, models


def convert_empty_to_null(apps, schema_editor):
usage = apps.get_model("usage_v2", "Usage")
usage.objects.filter(run_id="").update(run_id=None)


class Migration(migrations.Migration):

dependencies = [
("usage_v2", "0001_initial"),
]

operations = [
migrations.RunPython(
convert_empty_to_null, reverse_code=migrations.RunPython.noop
),
migrations.AlterField(
model_name="usage",
name="run_id",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def usage() -> Any:
workflow_id = payload.get("workflow_id")
execution_id = payload.get("execution_id", "")
adapter_instance_id = payload.get("adapter_instance_id", "")
run_id = payload.get("run_id", "")
run_id = payload.get("run_id")
usage_type = payload.get("usage_type", "")
llm_usage_reason = payload.get("llm_usage_reason", "")
model_name = payload.get("model_name", "")
Expand Down

0 comments on commit c3980ec

Please sign in to comment.