commit
9c5fef1a4d
412 files changed
+94582
No files matched your search
@@ -0,0 +1,39 @@
|
||||
"""add feed cache table
|
||||
|
||||
Revision ID: 0011_feed_cache
|
||||
Revises: 0010_gallery_feed_indexes
|
||||
Create Date: 2026-06-15
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
|
||||
revision = "0011_feed_cache"
|
||||
down_revision = "0010_gallery_feed_indexes"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.create_table(
|
||||
"feed_cache",
|
||||
sa.Column("user_id", sa.String(length=36), nullable=False),
|
||||
sa.Column("cache_key", sa.String(length=100), nullable=False),
|
||||
sa.Column("payload", sa.JSON(), nullable=False),
|
||||
sa.Column("expires_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column("id", sa.String(length=36), nullable=False),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column("updated_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.ForeignKeyConstraint(["user_id"], ["users.id"], ondelete="CASCADE"),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
sa.UniqueConstraint("user_id", "cache_key", name="uq_feed_cache_user_key"),
|
||||
)
|
||||
op.create_index("ix_feed_cache_user_expires", "feed_cache", ["user_id", "expires_at"])
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_index("ix_feed_cache_user_expires", table_name="feed_cache")
|
||||
op.drop_table("feed_cache")
|
||||
Reference in new issue
Block a user