mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-05-15 12:29:29 -05:00
Try to add tz during migration
This commit is contained in:
parent
1af66c8125
commit
e47c08bde3
@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
import os
|
||||||
|
|
||||||
|
import pytz
|
||||||
from django.db import migrations
|
from django.db import migrations
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models.functions import TruncDate
|
from django.db.models.functions import TruncDate
|
||||||
@ -10,7 +12,12 @@ from django.db.models.functions import TruncDate
|
|||||||
|
|
||||||
def migrate_date(apps, schema_editor):
|
def migrate_date(apps, schema_editor):
|
||||||
Document = apps.get_model("documents", "Document")
|
Document = apps.get_model("documents", "Document")
|
||||||
Document.objects.update(created_date=TruncDate("created"))
|
Document.objects.update(
|
||||||
|
created_date=TruncDate(
|
||||||
|
"created",
|
||||||
|
tzinfo=pytz.timezone(os.getenv("PAPERLESS_TIME_ZONE", "UTC")),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user