From c68b0904a73b4b66ee6b5e50b806a4074b08c002 Mon Sep 17 00:00:00 2001 From: Leon Sandøy Date: Tue, 22 Dec 2020 00:06:25 +0100 Subject: Make last_updated field automatically update. Previously, we were operating under a bad assumption that we would be updating the last_updated field in the RepositoryMetadata objects whenever we updated the objects with new data from the GitHub API. Upon closer inspection, this is not at all what we're doing, and some of those repository objects had not been updated in over a year! This introduces `auto_now` to the field, which will ensure that it is automatically updated whenever the object is updated. --- .../migrations/0002_auto_now_on_repository_metadata.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 pydis_site/apps/home/migrations/0002_auto_now_on_repository_metadata.py (limited to 'pydis_site/apps/home/migrations') diff --git a/pydis_site/apps/home/migrations/0002_auto_now_on_repository_metadata.py b/pydis_site/apps/home/migrations/0002_auto_now_on_repository_metadata.py new file mode 100644 index 00000000..7e78045b --- /dev/null +++ b/pydis_site/apps/home/migrations/0002_auto_now_on_repository_metadata.py @@ -0,0 +1,18 @@ +# Generated by Django 3.0.11 on 2020-12-21 22:57 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('home', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='repositorymetadata', + name='last_updated', + field=models.DateTimeField(auto_now=True, help_text='The date and time this data was last fetched.'), + ), + ] -- cgit v1.2.3