Skip to content

Commit

Permalink
feat: Extend custom image URL length limit
Browse files Browse the repository at this point in the history
  • Loading branch information
seriaati committed Jun 5, 2024
1 parent 38eb908 commit a4ec1bb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 19 deletions.
2 changes: 1 addition & 1 deletion hoyo_buddy/db/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class CardSettings(Model):
custom_images: fields.Field[list[str]] = fields.JSONField(default=[])
"""URLs of custom images."""
custom_primary_color: fields.Field[str | None] = fields.CharField(max_length=7, null=True)
current_image: fields.Field[str | None] = fields.CharField(max_length=100, null=True)
current_image: fields.Field[str | None] = fields.TextField(null=True)
template = fields.CharField(max_length=32, default="hb1")

class Meta:
Expand Down
1 change: 0 additions & 1 deletion hoyo_buddy/ui/hoyo/profile/items/add_img_btn.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class AddImageModal(Modal):
label=LocaleStr("Image URL", key="profile.add_image_modal.image_url.label"),
placeholder="https://example.com/image.png",
style=TextStyle.short,
max_length=100,
)

def __init__(self) -> None:
Expand Down
17 changes: 0 additions & 17 deletions migrations/models/10_20240525112221_update.py

This file was deleted.

11 changes: 11 additions & 0 deletions migrations/models/10_20240605201907_update.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from tortoise import BaseDBAsyncClient


async def upgrade(db: BaseDBAsyncClient) -> str:
return """
ALTER TABLE "cardsettings" ALTER COLUMN "current_image" TYPE TEXT USING "current_image"::TEXT;"""


async def downgrade(db: BaseDBAsyncClient) -> str:
return """
ALTER TABLE "cardsettings" ALTER COLUMN "current_image" TYPE VARCHAR(100) USING "current_image"::VARCHAR(100);"""

0 comments on commit a4ec1bb

Please sign in to comment.