Add new field to scrobbles for page data

This commit is contained in:
2024-01-22 19:40:39 -05:00
parent a274796405
commit 80d197bc54
2 changed files with 25 additions and 1 deletions

View File

@ -0,0 +1,23 @@
# Generated by Django 4.2.9 on 2024-01-22 00:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("scrobbles", "0045_scrobble_webpage_alter_scrobble_media_type"),
]
operations = [
migrations.AddField(
model_name="scrobble",
name="book_page_data",
field=models.JSONField(blank=True, null=True),
),
migrations.AlterField(
model_name="chartrecord",
name="year",
field=models.IntegerField(blank=True, null=True),
),
]

View File

@ -338,7 +338,7 @@ class ChartRecord(TimeStampedModel):
user = models.ForeignKey(User, on_delete=models.DO_NOTHING, **BNULL)
rank = models.IntegerField(db_index=True)
count = models.IntegerField(default=0)
year = models.IntegerField(default=timezone.now().year)
year = models.IntegerField(**BNULL)
month = models.IntegerField(**BNULL)
week = models.IntegerField(**BNULL)
day = models.IntegerField(**BNULL)
@ -522,6 +522,7 @@ class Scrobble(TimeStampedModel):
# Fields for keeping track long content like books and games
book_pages_read = models.IntegerField(**BNULL)
book_page_data = models.JSONField(**BNULL)
videogame_save_data = models.FileField(
upload_to="scrobbles/videogame_save_data/", **BNULL
)