Save JSON in DB
This commit is contained in:
28
core/migrations/0008_dropcampaign_scraped_json_and_more.py
Normal file
28
core/migrations/0008_dropcampaign_scraped_json_and_more.py
Normal file
@ -0,0 +1,28 @@
|
||||
# Generated by Django 5.1.1 on 2024-09-21 16:51
|
||||
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):
|
||||
dependencies: list[tuple[str, str]] = [
|
||||
("core", "0007_alter_game_options_alter_owner_options_and_more"),
|
||||
]
|
||||
|
||||
operations: list[Operation] = [
|
||||
migrations.AddField(
|
||||
model_name="dropcampaign",
|
||||
name="scraped_json",
|
||||
field=models.JSONField(help_text="The JSON data from the Twitch API.", null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="rewardcampaign",
|
||||
name="scraped_json",
|
||||
field=models.JSONField(help_text="The JSON data from the Twitch API.", null=True),
|
||||
),
|
||||
]
|
@ -0,0 +1,50 @@
|
||||
# Generated by Django 5.1.1 on 2024-09-21 23:56
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from django.db.migrations.operations.base import Operation
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies: list[tuple[str, str]] = [
|
||||
("core", "0008_dropcampaign_scraped_json_and_more"),
|
||||
]
|
||||
|
||||
operations: list[Operation] = [
|
||||
migrations.CreateModel(
|
||||
name="ScrapedJson",
|
||||
fields=[
|
||||
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
||||
("json_data", models.JSONField(help_text="The JSON data from the Twitch API.", unique=True)),
|
||||
("created_at", models.DateTimeField(auto_now_add=True)),
|
||||
],
|
||||
options={
|
||||
"ordering": ["-created_at"],
|
||||
},
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="dropcampaign",
|
||||
name="scraped_json",
|
||||
field=models.ForeignKey(
|
||||
help_text="Reference to the JSON data from the Twitch API.",
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.SET_NULL,
|
||||
to="core.scrapedjson",
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="rewardcampaign",
|
||||
name="scraped_json",
|
||||
field=models.ForeignKey(
|
||||
help_text="Reference to the JSON data from the Twitch API.",
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.SET_NULL,
|
||||
to="core.scrapedjson",
|
||||
),
|
||||
),
|
||||
]
|
Reference in New Issue
Block a user