new_bild
This commit is contained in:
4
app/models/base.py
Normal file
4
app/models/base.py
Normal file
@@ -0,0 +1,4 @@
|
||||
from sqlalchemy.orm import DeclarativeBase
|
||||
|
||||
class Base(DeclarativeBase):
|
||||
pass
|
||||
11
app/models/district.py
Normal file
11
app/models/district.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from sqlalchemy import String, Integer, ForeignKey
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
from app.models.base import Base
|
||||
|
||||
class District(Base):
|
||||
__tablename__ = "districts"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
name: Mapped[str] = mapped_column(String(50))
|
||||
max_clients: Mapped[int] = mapped_column(Integer)
|
||||
owner_id: Mapped[int | None] = mapped_column(ForeignKey("players.id"), nullable=True)
|
||||
11
app/models/player.py
Normal file
11
app/models/player.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from sqlalchemy import BigInteger, Integer, Float
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
from app.models.base import Base
|
||||
|
||||
class Player(Base):
|
||||
__tablename__ = "players"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
telegram_id: Mapped[int] = mapped_column(BigInteger, unique=True)
|
||||
money: Mapped[int] = mapped_column(Integer, default=10000)
|
||||
reputation: Mapped[float] = mapped_column(Float, default=1.0)
|
||||
Reference in New Issue
Block a user