mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-17 10:13:56 -05:00
30 lines
781 B
Python
30 lines
781 B
Python
# -*- coding: utf-8 -*-
|
|
from __future__ import unicode_literals
|
|
|
|
from django.db import migrations, models
|
|
import django.utils.timezone
|
|
|
|
|
|
def set_added_time_to_created_time(apps, schema_editor):
|
|
Document = apps.get_model("documents", "Document")
|
|
for doc in Document.objects.all():
|
|
doc.added = doc.created
|
|
doc.save()
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
dependencies = [
|
|
("documents", "0019_add_consumer_user"),
|
|
]
|
|
|
|
operations = [
|
|
migrations.AddField(
|
|
model_name="document",
|
|
name="added",
|
|
field=models.DateTimeField(
|
|
db_index=True, default=django.utils.timezone.now, editable=False
|
|
),
|
|
),
|
|
migrations.RunPython(set_added_time_to_created_time),
|
|
]
|