bc111fe08a
Deploy / Build Production Runtime Images (push) Has been skipped
Deploy / Deploy Production (push) Has been skipped
Deploy / Production Browser E2E (push) Has been skipped
Deploy / Staging E2E Tests (push) Failing after 107h51m3s
Deploy / Deploy Staging (push) Failing after 107h53m29s
CI/CD Pipeline / Frontend Lint (push) Failing after 107h55m9s
CI/CD Pipeline / Validate Code Quality And Tests (push) Failing after 107h55m17s
- 新增 project_id / created_by_user_id 字段到 edit_plans 表 - Alembic 迁移 023:加列 + 索引 - Domain entity / Model / Repository / Service / Routes 全链路适配 - 所有 11 个 edit_plans 接口加 _check_project_access 鉴权(参照 assets can_access 模式) - list_plans 移除 bare except Exception(P2 修复) - Repository 新增 list_by_project / list_by_user 查询方法 - 864 tests passing
57 lines
1.3 KiB
Python
57 lines
1.3 KiB
Python
"""Task: Add project_id and created_by_user_id to edit_plans
|
|
|
|
Revision ID: 023
|
|
Revises: 022
|
|
Create Date: 2026-07-05
|
|
|
|
新增 project_id 和 created_by_user_id 字段到 edit_plans 表,
|
|
用于项目归属鉴权和用户归属追踪,修复审计发现的 P1 越权漏洞。
|
|
"""
|
|
|
|
import sqlalchemy as sa
|
|
|
|
from alembic import op
|
|
|
|
revision = "023"
|
|
down_revision = "022"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.add_column(
|
|
"edit_plans",
|
|
sa.Column("project_id", sa.String(32), nullable=False, server_default=""),
|
|
)
|
|
op.create_index(
|
|
op.f("ix_edit_plans_project_id"),
|
|
"edit_plans",
|
|
["project_id"],
|
|
unique=False,
|
|
)
|
|
|
|
op.add_column(
|
|
"edit_plans",
|
|
sa.Column("created_by_user_id", sa.String(32), nullable=False, server_default=""),
|
|
)
|
|
op.create_index(
|
|
op.f("ix_edit_plans_created_by_user_id"),
|
|
"edit_plans",
|
|
["created_by_user_id"],
|
|
unique=False,
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_index(
|
|
op.f("ix_edit_plans_created_by_user_id"),
|
|
table_name="edit_plans",
|
|
)
|
|
op.drop_column("edit_plans", "created_by_user_id")
|
|
|
|
op.drop_index(
|
|
op.f("ix_edit_plans_project_id"),
|
|
table_name="edit_plans",
|
|
)
|
|
op.drop_column("edit_plans", "project_id")
|