Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

1.3 KB
Raw Blame
"""index human and harness inbox inputs

Revision ID: 20260716_0030
Revises: 20260707_0029
Create Date: 2026-07-16
"""

from __future__ import annotations

from alembic import op

revision = "20260716_0030"
down_revision = "20260707_0029"
branch_labels = None
depends_on = None


def upgrade() -> None:
    bind = op.get_bind()
    bind.exec_driver_sql(
        "update messages set author = 'harness', type = 'harness' "
        "where source = 'harness' and author = 'user' and type = 'user'"
    )
    bind.exec_driver_sql("drop index if exists ix_messages_inbox_user_send")
    bind.exec_driver_sql(
        "create index ix_messages_inbox_user_send "
        "on messages (platform, session_id, created_at desc, id desc) "
        "where session_id is not null and "
        "((author = 'user' and type = 'user') or "
        "(author = 'harness' and type = 'harness'))"
    )


def downgrade() -> None:
    bind = op.get_bind()
    bind.exec_driver_sql("drop index if exists ix_messages_inbox_user_send")
    bind.exec_driver_sql(
        "create index ix_messages_inbox_user_send "
        "on messages (platform, session_id, created_at desc, id desc) "
        "where session_id is not null and author = 'user' "
        "and type not in ('queued', 'draft', 'pending', 'harness_dedupe')"
    )