feat: переезд на tortose
This commit is contained in:
@@ -1,18 +1,20 @@
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from sqlalchemy import BigInteger
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from src import domain
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .subscription import Subscription
|
||||
from tortoise import fields
|
||||
from tortoise.models import Model
|
||||
|
||||
|
||||
class Subscriber(domain.Base):
|
||||
telegram_id: Mapped[int] = mapped_column(BigInteger, unique=True, index=True)
|
||||
username: Mapped[str | None]
|
||||
first_name: Mapped[str | None]
|
||||
last_name: Mapped[str | None]
|
||||
class Subscriber(Model):
|
||||
id = fields.UUIDField(pk=True)
|
||||
telegram_id = fields.BigIntField(unique=True, index=True)
|
||||
username = fields.CharField(max_length=255, null=True)
|
||||
first_name = fields.CharField(max_length=255, null=True)
|
||||
last_name = fields.CharField(max_length=255, null=True)
|
||||
|
||||
subscriptions: Mapped[list['Subscription']] = relationship(back_populates='subscriber')
|
||||
created_at = fields.DatetimeField(auto_now_add=True)
|
||||
updated_at = fields.DatetimeField(auto_now=True)
|
||||
deleted_at = fields.DatetimeField(null=True)
|
||||
|
||||
# Reverse relations:
|
||||
# subscriptions: fields.ReverseRelation['Subscription']
|
||||
|
||||
class Meta:
|
||||
table = 'subscriber'
|
||||
|
||||
Reference in New Issue
Block a user