feat(briefing): add migration 0028 — briefing improvements schema
Also comments out nvidia GPU reservation in docker-compose.yml (no nvidia-container-toolkit on this host). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,55 @@
|
|||||||
|
"""Add briefing improvements: rss_items topics/classified_at, messages metadata,
|
||||||
|
rss_item_reactions, briefing_task_snapshot."""
|
||||||
|
|
||||||
|
from alembic import op
|
||||||
|
|
||||||
|
revision = "0028"
|
||||||
|
down_revision = "0027"
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade() -> None:
|
||||||
|
op.execute("""
|
||||||
|
ALTER TABLE rss_items
|
||||||
|
ADD COLUMN IF NOT EXISTS topics TEXT[] DEFAULT '{}',
|
||||||
|
ADD COLUMN IF NOT EXISTS classified_at TIMESTAMPTZ
|
||||||
|
""")
|
||||||
|
op.execute("""
|
||||||
|
ALTER TABLE messages
|
||||||
|
ADD COLUMN IF NOT EXISTS metadata JSONB
|
||||||
|
""")
|
||||||
|
op.execute("""
|
||||||
|
CREATE TABLE IF NOT EXISTS rss_item_reactions (
|
||||||
|
id SERIAL PRIMARY KEY,
|
||||||
|
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||||
|
rss_item_id INTEGER NOT NULL REFERENCES rss_items(id) ON DELETE CASCADE,
|
||||||
|
reaction TEXT NOT NULL CHECK (reaction IN ('up', 'down')),
|
||||||
|
created_at TIMESTAMPTZ DEFAULT NOW(),
|
||||||
|
UNIQUE (user_id, rss_item_id)
|
||||||
|
)
|
||||||
|
""")
|
||||||
|
op.execute(
|
||||||
|
"CREATE INDEX IF NOT EXISTS ix_rss_item_reactions_user_id "
|
||||||
|
"ON rss_item_reactions(user_id)"
|
||||||
|
)
|
||||||
|
op.execute("""
|
||||||
|
CREATE TABLE IF NOT EXISTS briefing_task_snapshot (
|
||||||
|
id SERIAL PRIMARY KEY,
|
||||||
|
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||||
|
task_id INTEGER NOT NULL REFERENCES notes(id) ON DELETE CASCADE,
|
||||||
|
snapshot_hash TEXT NOT NULL,
|
||||||
|
last_briefed TIMESTAMPTZ DEFAULT NOW(),
|
||||||
|
UNIQUE (user_id, task_id)
|
||||||
|
)
|
||||||
|
""")
|
||||||
|
op.execute(
|
||||||
|
"CREATE INDEX IF NOT EXISTS ix_briefing_task_snapshot_user_id "
|
||||||
|
"ON briefing_task_snapshot(user_id)"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade() -> None:
|
||||||
|
op.execute("DROP TABLE IF EXISTS briefing_task_snapshot")
|
||||||
|
op.execute("DROP TABLE IF EXISTS rss_item_reactions")
|
||||||
|
op.execute("ALTER TABLE messages DROP COLUMN IF EXISTS metadata")
|
||||||
|
op.execute("ALTER TABLE rss_items DROP COLUMN IF EXISTS classified_at")
|
||||||
|
op.execute("ALTER TABLE rss_items DROP COLUMN IF EXISTS topics")
|
||||||
+8
-7
@@ -55,13 +55,14 @@ services:
|
|||||||
OLLAMA_NUM_PARALLEL: "2"
|
OLLAMA_NUM_PARALLEL: "2"
|
||||||
OLLAMA_KEEP_ALIVE: "30m"
|
OLLAMA_KEEP_ALIVE: "30m"
|
||||||
OLLAMA_FLASH_ATTENTION: "1"
|
OLLAMA_FLASH_ATTENTION: "1"
|
||||||
deploy:
|
# GPU reservation commented out — no nvidia-container-toolkit on this host
|
||||||
resources:
|
# deploy:
|
||||||
reservations:
|
# resources:
|
||||||
devices:
|
# reservations:
|
||||||
- driver: nvidia
|
# devices:
|
||||||
count: all
|
# - driver: nvidia
|
||||||
capabilities: [gpu]
|
# count: all
|
||||||
|
# capabilities: [gpu]
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
pgdata:
|
pgdata:
|
||||||
|
|||||||
Reference in New Issue
Block a user