add telegram auth and reminders foundation
This commit is contained in:
39
alembic/versions/202605120001_push_subscriptions.py
Normal file
39
alembic/versions/202605120001_push_subscriptions.py
Normal file
@@ -0,0 +1,39 @@
|
||||
"""push subscriptions
|
||||
|
||||
Revision ID: 202605120001
|
||||
Revises: 202605110003
|
||||
Create Date: 2026-05-12
|
||||
"""
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
revision: str = "202605120001"
|
||||
down_revision: str | None = "202605110003"
|
||||
branch_labels: str | Sequence[str] | None = None
|
||||
depends_on: str | Sequence[str] | None = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.create_table(
|
||||
"push_subscriptions",
|
||||
sa.Column("id", sa.Integer(), nullable=False),
|
||||
sa.Column("user_id", sa.Integer(), nullable=False),
|
||||
sa.Column("endpoint", sa.Text(), nullable=False),
|
||||
sa.Column("p256dh", sa.String(length=256), nullable=True),
|
||||
sa.Column("auth", sa.String(length=256), nullable=True),
|
||||
sa.Column("user_agent", sa.String(length=256), nullable=True),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.func.now(), nullable=False),
|
||||
sa.Column("updated_at", sa.DateTime(timezone=True), server_default=sa.func.now(), nullable=False),
|
||||
sa.ForeignKeyConstraint(["user_id"], ["users.id"], ondelete="CASCADE"),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
sa.UniqueConstraint("user_id", "endpoint", name="uq_push_user_endpoint"),
|
||||
)
|
||||
op.create_index(op.f("ix_push_subscriptions_user_id"), "push_subscriptions", ["user_id"])
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_index(op.f("ix_push_subscriptions_user_id"), table_name="push_subscriptions")
|
||||
op.drop_table("push_subscriptions")
|
||||
Reference in New Issue
Block a user