24b28bfc89
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Successful in 1s
CI/CD Pipeline / Check push changed paths (pull_request) Has been skipped
CI/CD Pipeline / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 1s
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / PR Build Web Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been skipped
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 17s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 51s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 1m5s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 1m44s
CI/CD Pipeline / Validate - Style (pull_request) Successful in 1m58s
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Successful in 1m59s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 2m59s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 6m16s
AI Code Review / AI Code Review (pull_request) Successful in 6m23s
CI/CD Pipeline / Validate - Security (pull_request) Has been cancelled
CI/CD Pipeline / Build Production API Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Web Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Deploy Production (pull_request) Has been cancelled
CI/CD Pipeline / Production Browser E2E (pull_request) Has been cancelled
CI/CD Pipeline / Canary Release to Production (pull_request) Has been cancelled
CI/CD Pipeline / CI Gate (pull_request) Has been cancelled
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 5m28s
- 新建 ScriptModel (packages/adapters/sqlalchemy_impl/models.py) 字段: id, user_id(indexed), title, content, segments(JSON), tags(JSON), created_at, updated_at - 新建 script_service.py: CRUD 封装,用户隔离,tag 筛选,分页 - 新建 schemas/script.py: Pydantic request/response schemas - 新建 routes/scripts.py: RESTful API (GET/POST/PUT/DELETE /api/v1/scripts) - 新建 alembic 070_add_scripts_table.py: scripts 表 + user_id 索引 - 注册路由到 router.py (prefix=/scripts, tag=ScriptLibrary) - 35 单元测试: service 15 + schema/route 20
49 lines
1.4 KiB
Python
49 lines
1.4 KiB
Python
"""Add scripts table for oral broadcast script library (Issue #1795)
|
|
|
|
Revision ID: 070_add_scripts
|
|
Revises: 069_project_is_default
|
|
Create Date: 2026-09-08
|
|
|
|
新建 scripts 表,支持口播文案 CRUD + 分段存储。
|
|
"""
|
|
|
|
import sqlalchemy as sa
|
|
|
|
from alembic import op
|
|
|
|
revision = "070_add_scripts"
|
|
down_revision = "069_project_is_default"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.create_table(
|
|
"scripts",
|
|
sa.Column("id", sa.String(36), nullable=False),
|
|
sa.Column("user_id", sa.String(36), nullable=False),
|
|
sa.Column("title", sa.String(255), nullable=False),
|
|
sa.Column("content", sa.Text(), nullable=False, server_default=""),
|
|
sa.Column("segments", sa.JSON(), nullable=False, server_default="[]"),
|
|
sa.Column("tags", sa.JSON(), nullable=False, server_default="[]"),
|
|
sa.Column(
|
|
"created_at",
|
|
sa.DateTime(timezone=True),
|
|
nullable=False,
|
|
server_default=sa.func.now(),
|
|
),
|
|
sa.Column(
|
|
"updated_at",
|
|
sa.DateTime(timezone=True),
|
|
nullable=False,
|
|
server_default=sa.func.now(),
|
|
),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
)
|
|
op.create_index("ix_scripts_user_id", "scripts", ["user_id"])
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_index("ix_scripts_user_id", table_name="scripts")
|
|
op.drop_table("scripts")
|