Also set duration_manual to zero
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
7842d6f45d
commit
97467c7a52
|
@ -6,7 +6,7 @@ RUN npm install && \
|
||||||
|
|
||||||
FROM python:3.10.9-alpine
|
FROM python:3.10.9-alpine
|
||||||
|
|
||||||
ENV VERSION_NUMBER 0.1.2-8-gb77089f
|
ENV VERSION_NUMBER 0.1.2-9-g7842d6f
|
||||||
ENV PROD 1
|
ENV PROD 1
|
||||||
|
|
||||||
RUN apk add \
|
RUN apk add \
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
# Generated by Django 4.1.5 on 2023-01-09 18:04
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
from datetime import timedelta
|
||||||
|
|
||||||
|
|
||||||
|
def set_duration_manual_none_to_zero(apps, schema_editor):
|
||||||
|
Session = apps.get_model("tracker", "Session")
|
||||||
|
for session in Session.objects.all():
|
||||||
|
if session.duration_calculated == None:
|
||||||
|
session.duration_calculated = timedelta(0)
|
||||||
|
session.save()
|
||||||
|
|
||||||
|
|
||||||
|
def revert_set_duration_manual_none_to_zero(apps, schema_editor):
|
||||||
|
Session = apps.get_model("tracker", "Session")
|
||||||
|
for session in Session.objects.all():
|
||||||
|
if session.duration_calculated == timedelta(0):
|
||||||
|
session.duration_calculated = None
|
||||||
|
session.save()
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("tracker", "0005_auto_20230109_1843"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(
|
||||||
|
set_duration_manual_none_to_zero,
|
||||||
|
revert_set_duration_manual_none_to_zero,
|
||||||
|
)
|
||||||
|
]
|
Loading…
Reference in New Issue