Skip to content

Commit

Permalink
chore(backend/users/migrations): alter bearertoken expires only if null
Browse files Browse the repository at this point in the history
Signed-off-by: Thibault Camalon <[email protected]>
  • Loading branch information
thbcmlowk committed Aug 27, 2024
1 parent 9334af5 commit d987c1c
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions backend/users/migrations/0008_alter_bearertoken_expires_at.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
# Generated by Django 4.2.3 on 2024-08-06 16:29
# Generated by Django 4.2.5 on 2024-08-14 15:28

import django.utils.timezone
from django.db import migrations
from django.db import models


def set_default_expires_at(apps, schema_editor):
BearerToken = apps.get_model("users", "BearerToken") # noqa
BearerToken.objects.filter(expires_at__isnull=True).update(expires_at=django.utils.timezone.now())


class Migration(migrations.Migration):
dependencies = [
("users", "0007_implicitbearertoken_id_and_more"),
]

operations = [
migrations.AlterField(
model_name="bearertoken",
name="expires_at",
field=models.DateTimeField(default=django.utils.timezone.now),
),
]
operations = [migrations.RunPython(set_default_expires_at)]

0 comments on commit d987c1c

Please sign in to comment.