From 5efa9ff3da8e0ecdb97691a26d2697c0042962f6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joakim=20Hells=C3=A9n?= <tlovinator@gmail.com>
Date: Wed, 18 Dec 2024 23:37:01 +0100
Subject: [PATCH] Fix created_at using auto_created instead of auto_now_add

---
 core/migrations/0004_alter_game_created_at.py | 25 +++++++++++++++++++
 core/models.py                                |  2 +-
 2 files changed, 26 insertions(+), 1 deletion(-)
 create mode 100644 core/migrations/0004_alter_game_created_at.py

diff --git a/core/migrations/0004_alter_game_created_at.py b/core/migrations/0004_alter_game_created_at.py
new file mode 100644
index 0000000..f6f81cc
--- /dev/null
+++ b/core/migrations/0004_alter_game_created_at.py
@@ -0,0 +1,25 @@
+# Generated by Django 5.1.4 on 2024-12-18 22:35
+from __future__ import annotations
+
+from typing import TYPE_CHECKING
+
+from django.db import migrations, models
+
+if TYPE_CHECKING:
+    from django.db.migrations.operations.base import Operation
+
+
+class Migration(migrations.Migration):
+    """Fix created_at using auto_created instead of auto_now_add."""
+
+    dependencies: list[tuple[str, str]] = [
+        ("core", "0003_alter_benefit_created_at_and_more"),
+    ]
+
+    operations: list[Operation] = [
+        migrations.AlterField(
+            model_name="game",
+            name="created_at",
+            field=models.DateTimeField(auto_now_add=True, help_text="When the game was first added to the database."),
+        ),
+    ]
diff --git a/core/models.py b/core/models.py
index bbe1a41..542edfd 100644
--- a/core/models.py
+++ b/core/models.py
@@ -133,7 +133,7 @@ class Game(auto_prefetch.Model):
     # Django fields
     # "155409827"
     twitch_id = models.TextField(primary_key=True, help_text="The Twitch ID of the game.")
-    created_at = models.DateTimeField(auto_created=True, help_text="When the game was first added to the database.")
+    created_at = models.DateTimeField(auto_now_add=True, help_text="When the game was first added to the database.")
     modified_at = models.DateTimeField(auto_now=True, help_text="When the game was last modified.")
 
     # Twitch fields