18 lines
589 B
Python
18 lines
589 B
Python
from sqlalchemy import ForeignKey, String
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
|
|
from ttfrog.db.base import BaseObject
|
|
|
|
__all__ = [
|
|
"Skill",
|
|
]
|
|
|
|
|
|
class Skill(BaseObject):
|
|
__tablename__ = "skill"
|
|
id: Mapped[int] = mapped_column(init=False, primary_key=True, autoincrement=True)
|
|
name: Mapped[str] = mapped_column(String(collation="NOCASE"), nullable=False, unique=True)
|
|
base_id: Mapped[int] = mapped_column(ForeignKey("skill.id"), nullable=True, default=None)
|
|
|
|
parent: Mapped["Skill"] = relationship(init=False, remote_side=id, uselist=False)
|