generated from kgod/ai-review-template
feat: initialize resume agent with OfferPai sync
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
"""Add durable reviewable resume import metadata to PostgreSQL."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
|
||||
|
||||
revision = "20260724_03"
|
||||
down_revision = "20260724_01"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
schema = op.get_context().config.get_main_option("resume_agent.schema", "resume_agent")
|
||||
bind = op.get_bind()
|
||||
bind.exec_driver_sql(
|
||||
f'''
|
||||
CREATE TABLE IF NOT EXISTS "{schema}".resume_imports (
|
||||
id VARCHAR(128) PRIMARY KEY,
|
||||
session_id VARCHAR(128) NOT NULL
|
||||
REFERENCES "{schema}".sessions(id) ON DELETE CASCADE,
|
||||
file_name VARCHAR(512) NOT NULL,
|
||||
mime_type VARCHAR(128) NOT NULL,
|
||||
size_bytes INTEGER NOT NULL CHECK (size_bytes >= 0),
|
||||
sha256 VARCHAR(64) NOT NULL,
|
||||
object_key VARCHAR(512) NOT NULL,
|
||||
status VARCHAR(32) NOT NULL,
|
||||
document JSONB,
|
||||
field_reviews JSONB NOT NULL DEFAULT '[]'::jsonb,
|
||||
error_code VARCHAR(128),
|
||||
created_at TIMESTAMPTZ NOT NULL,
|
||||
updated_at TIMESTAMPTZ NOT NULL,
|
||||
CONSTRAINT uq_resume_import_session_sha256 UNIQUE (session_id, sha256)
|
||||
)
|
||||
'''
|
||||
)
|
||||
bind.exec_driver_sql(
|
||||
f'''CREATE INDEX IF NOT EXISTS ix_resume_imports_session_created
|
||||
ON "{schema}".resume_imports (session_id, created_at)'''
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
schema = op.get_context().config.get_main_option("resume_agent.schema", "resume_agent")
|
||||
op.get_bind().exec_driver_sql(f'DROP TABLE IF EXISTS "{schema}".resume_imports')
|
||||
Reference in New Issue
Block a user