2
0
Fork 0

use the index luke

This commit is contained in:
Andreas (@xAndy) Zimmermann 2023-05-28 12:08:44 +02:00
parent 1f53998eb0
commit 4f4b5c3009
2 changed files with 25 additions and 2 deletions

View File

@ -0,0 +1,23 @@
# Generated by Django 4.0.4 on 2023-05-28 10:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("app", "0011_room_description"),
]
operations = [
migrations.AlterField(
model_name="shift",
name="deleted",
field=models.BooleanField(db_index=True, default=False),
),
migrations.AlterField(
model_name="shift",
name="start_at",
field=models.DateTimeField(db_index=True),
),
]

View File

@ -26,13 +26,13 @@ class Room(models.Model):
class Shift(models.Model): class Shift(models.Model):
room = models.ForeignKey(Room, on_delete=models.RESTRICT) room = models.ForeignKey(Room, on_delete=models.RESTRICT)
start_at = models.DateTimeField() start_at = models.DateTimeField(db_index=True)
duration = models.DurationField() duration = models.DurationField()
required_helpers = models.IntegerField( required_helpers = models.IntegerField(
default=0, help_text="When this is set to zero, the room value is used instead." default=0, help_text="When this is set to zero, the room value is used instead."
) )
description = models.TextField(blank=True, default="") description = models.TextField(blank=True, default="")
deleted = models.BooleanField(default=False) deleted = models.BooleanField(default=False, db_index=True)
def with_reg_count(): def with_reg_count():
return Shift.objects.annotate( return Shift.objects.annotate(