feat(backend): read time of my messages from the archive, exact dates and group readers asked from telegram on demand
This commit is contained in:
1 parent
f27943aae6
commit
d8dd08d7de
10 files changed
+497
-9
No files matched your search
@@ -0,0 +1,51 @@
|
||||
"""message reads
|
||||
|
||||
Revision ID: d7a3c5e9f2b1
|
||||
Revises: f8c2d6e1a4b7
|
||||
Create Date: 2026-10-19 01:00:00.000000
|
||||
|
||||
"""
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
from alembic import op
|
||||
|
||||
revision: str = "d7a3c5e9f2b1"
|
||||
down_revision: str | None = "f8c2d6e1a4b7"
|
||||
branch_labels: str | Sequence[str] | None = None
|
||||
depends_on: str | Sequence[str] | None = None
|
||||
|
||||
_READS = """
|
||||
CREATE TABLE message_reads (
|
||||
account_id integer NOT NULL,
|
||||
chat_id bigint NOT NULL,
|
||||
message_id bigint NOT NULL,
|
||||
reader_id bigint NOT NULL,
|
||||
read_at timestamptz NOT NULL,
|
||||
source text NOT NULL,
|
||||
fetched_at timestamptz NOT NULL DEFAULT now(),
|
||||
PRIMARY KEY (account_id, chat_id, message_id, reader_id)
|
||||
)
|
||||
"""
|
||||
|
||||
_FETCHES = """
|
||||
CREATE TABLE read_fetches (
|
||||
account_id integer NOT NULL,
|
||||
chat_id bigint NOT NULL,
|
||||
message_id bigint NOT NULL,
|
||||
outcome text NOT NULL,
|
||||
fetched_at timestamptz NOT NULL DEFAULT now(),
|
||||
retry_at timestamptz NOT NULL,
|
||||
PRIMARY KEY (account_id, chat_id, message_id)
|
||||
)
|
||||
"""
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.execute(_READS)
|
||||
op.execute(_FETCHES)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.execute("DROP TABLE IF EXISTS read_fetches")
|
||||
op.execute("DROP TABLE IF EXISTS message_reads")
|
||||
Reference in new issue
Block a user