feat: add cloudonix cdr

This commit is contained in:
Abhishek Kumar 2026-01-29 17:45:46 +05:30
parent 91911769b0
commit 07558ec785
6 changed files with 211 additions and 10 deletions

View file

@ -0,0 +1,46 @@
"""add partial index on call_id for workflow run
Revision ID: d1dac4c93e61
Revises: 181475b2a1a1
Create Date: 2026-01-29 16:28:04.105202
"""
from typing import Sequence, Union
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "d1dac4c93e61"
down_revision: Union[str, None] = "181475b2a1a1"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f("ix_api_keys_key_hash"), table_name="api_keys")
op.create_index(op.f("ix_api_keys_key_hash"), "api_keys", ["key_hash"], unique=True)
op.create_index(
"idx_workflow_runs_call_id",
"workflow_runs",
[sa.literal_column("(gathered_context->>'call_id')")],
unique=False,
postgresql_where=sa.text("gathered_context->>'call_id' IS NOT NULL"),
)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(
"idx_workflow_runs_call_id",
table_name="workflow_runs",
postgresql_where=sa.text("gathered_context->>'call_id' IS NOT NULL"),
)
op.drop_index(op.f("ix_api_keys_key_hash"), table_name="api_keys")
op.create_index(
op.f("ix_api_keys_key_hash"), "api_keys", ["key_hash"], unique=False
)
# ### end Alembic commands ###