reference the chat in the podcast

This commit is contained in:
CREDO23 2025-10-23 23:49:49 +02:00 committed by thierryverse
parent aaa6ee22ed
commit 666ea87a9d
4 changed files with 45 additions and 3 deletions

View file

@ -1,4 +1,6 @@
"""Add podcast staleness detection columns
"""Add podcast staleness detection columns to chats and podcasts tables
This feature allows the system to detect when a podcast is outdated compared to the current state of the chat it was generated from, enabling users to regenerate podcasts when needed.
Revision ID: 32
Revises: 31
@ -18,7 +20,7 @@ depends_on: str | Sequence[str] | None = None
def upgrade() -> None:
"""Add state_version to chats table and chat_state_version to podcasts table."""
"""Add state_version, chat_state_version, and chat_id to chats and podcasts tables."""
# Add state_version column to chats table with default value of 1
op.add_column(
@ -31,12 +33,18 @@ def upgrade() -> None:
"podcasts", sa.Column("chat_state_version", sa.BigInteger(), nullable=True)
)
# Add chat_id column to podcasts table (nullable, set when podcast is generated from a chat)
op.add_column("podcasts", sa.Column("chat_id", sa.Integer(), nullable=True))
def downgrade() -> None:
"""Remove state_version and chat_state_version columns."""
"""Remove state_version, chat_state_version, and chat_id columns."""
# Remove chat_state_version from podcasts table
op.drop_column("podcasts", "chat_state_version")
# Remove chat_id from podcasts table
op.drop_column("podcasts", "chat_id")
# Remove state_version from chats table
op.drop_column("chats", "state_version")