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:
+12
-12
@@ -42,6 +42,18 @@ class ImageRecord(db.Model):
|
|||||||
)
|
)
|
||||||
|
|
||||||
class Tag(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__ = (
|
__table_args__ = (
|
||||||
db.Index(
|
db.Index(
|
||||||
'tag_character_with_fandom_uniq', 'name', 'fandom_id',
|
'tag_character_with_fandom_uniq', 'name', 'fandom_id',
|
||||||
@@ -61,18 +73,6 @@ class Tag(db.Model):
|
|||||||
db.Index('tag_kind_idx', 'kind'),
|
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
|
@property
|
||||||
def display_name(self) -> str:
|
def display_name(self) -> str:
|
||||||
"""Human-readable rendering of this tag.
|
"""Human-readable rendering of this tag.
|
||||||
|
|||||||
Reference in New Issue
Block a user