reactions + the great merge
This commit is contained in:
parent
6871aa2449
commit
01dafa0d88
6 changed files with 144 additions and 4 deletions
|
|
@ -1,7 +1,7 @@
|
|||
from typing import List, Optional
|
||||
|
||||
from sqlalchemy import CHAR, ForeignKeyConstraint, Index, String, TIMESTAMP, text
|
||||
from sqlalchemy.dialects.mysql import INTEGER, TINYINT
|
||||
from sqlalchemy import CHAR, Computed, ForeignKeyConstraint, Index, LargeBinary, String, TIMESTAMP, VARBINARY, text
|
||||
from sqlalchemy.dialects.mysql import BIGINT, INTEGER, TINYINT
|
||||
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column, relationship
|
||||
import datetime
|
||||
|
||||
|
|
@ -9,6 +9,16 @@ class Base(DeclarativeBase):
|
|||
pass
|
||||
|
||||
|
||||
class AccountMessages(Base):
|
||||
__tablename__ = 'account_messages'
|
||||
__table_args__ = (
|
||||
Index('account', 'account', 'history_id'),
|
||||
)
|
||||
|
||||
history_id: Mapped[int] = mapped_column(BIGINT(20), primary_key=True)
|
||||
account: Mapped[bytes] = mapped_column(VARBINARY(64))
|
||||
|
||||
|
||||
class AlertEndpoints(Base):
|
||||
__tablename__ = 'alert_endpoints'
|
||||
__table_args__ = (
|
||||
|
|
@ -24,6 +34,34 @@ class AlertEndpoints(Base):
|
|||
created_at: Mapped[Optional[datetime.datetime]] = mapped_column(TIMESTAMP, server_default=text('current_timestamp()'))
|
||||
|
||||
|
||||
class Forget(Base):
|
||||
__tablename__ = 'forget'
|
||||
|
||||
id: Mapped[int] = mapped_column(BIGINT(20), primary_key=True)
|
||||
account: Mapped[bytes] = mapped_column(VARBINARY(64))
|
||||
|
||||
|
||||
class History(Base):
|
||||
__tablename__ = 'history'
|
||||
__table_args__ = (
|
||||
Index('msgid', 'msgid'),
|
||||
)
|
||||
|
||||
msgid: Mapped[int] = mapped_column(BIGINT(20), primary_key=True)
|
||||
data: Mapped[bytes] = mapped_column(LargeBinary)
|
||||
target: Mapped[bytes] = mapped_column(VARBINARY(64))
|
||||
sender: Mapped[bytes] = mapped_column(VARBINARY(64))
|
||||
nanotime: Mapped[int] = mapped_column(BIGINT(20))
|
||||
pm: Mapped[Optional[int]] = mapped_column(TINYINT(1), Computed("(substr(`target`,1,1) <> '#')", persisted=True))
|
||||
|
||||
|
||||
class Metadata(Base):
|
||||
__tablename__ = 'metadata'
|
||||
|
||||
key_name: Mapped[str] = mapped_column(String(32), primary_key=True)
|
||||
value: Mapped[str] = mapped_column(String(32))
|
||||
|
||||
|
||||
class Uploads(Base):
|
||||
__tablename__ = 'uploads'
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue