feat(models): Tag.__table_args__ matches j26042101 indices

Move __table_args__ below column declarations to match the convention
used by SeriesPage, ImportTask, ImageTagPrediction, SuggestionFeedback.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-04-22 12:57:58 -04:00
parent 97ad60b973
commit 1a83c634c8
+12 -12
View File
@@ -42,6 +42,18 @@ class ImageRecord(db.Model):
)
class Tag(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(255), nullable=False)
kind = db.Column(db.String(64), nullable=True)
fandom_id = db.Column(db.Integer, db.ForeignKey("tag.id", ondelete="SET NULL"), nullable=True)
fandom = db.relationship("Tag", remote_side="Tag.id", foreign_keys=[fandom_id])
images = db.relationship(
"ImageRecord",
secondary=image_tags,
back_populates="tags",
passive_deletes=True,
)
__table_args__ = (
db.Index(
'tag_character_with_fandom_uniq', 'name', 'fandom_id',
@@ -61,18 +73,6 @@ class Tag(db.Model):
db.Index('tag_kind_idx', 'kind'),
)
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(255), nullable=False)
kind = db.Column(db.String(64), nullable=True)
fandom_id = db.Column(db.Integer, db.ForeignKey("tag.id", ondelete="SET NULL"), nullable=True)
fandom = db.relationship("Tag", remote_side="Tag.id", foreign_keys=[fandom_id])
images = db.relationship(
"ImageRecord",
secondary=image_tags,
back_populates="tags",
passive_deletes=True,
)
@property
def display_name(self) -> str:
"""Human-readable rendering of this tag.