API
This commit is contained in:
36
alembic/versions/003_proactive_actions.py
Normal file
36
alembic/versions/003_proactive_actions.py
Normal file
@@ -0,0 +1,36 @@
|
||||
"""Proactive actions table for Argus layer
|
||||
|
||||
Revision ID: 003
|
||||
Revises: 002
|
||||
Create Date: 2026-03-28
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
|
||||
revision = "003"
|
||||
down_revision = "002"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.execute("""
|
||||
CREATE TABLE IF NOT EXISTS public.proactive_actions (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
user_id UUID NOT NULL REFERENCES public.users(id) ON DELETE CASCADE,
|
||||
session_id UUID REFERENCES public.sessions(id) ON DELETE SET NULL,
|
||||
friction_type TEXT NOT NULL,
|
||||
proposed_action TEXT NOT NULL,
|
||||
user_choice TEXT,
|
||||
chosen_action TEXT,
|
||||
executed BOOLEAN DEFAULT false,
|
||||
detected_at TIMESTAMPTZ DEFAULT now(),
|
||||
responded_at TIMESTAMPTZ
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_proactive_user ON proactive_actions(user_id, friction_type);
|
||||
""")
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.execute("DROP TABLE IF EXISTS public.proactive_actions CASCADE;")
|
||||
Reference in New Issue
Block a user