419cc3fb6a
CI/CD Pipeline / Check if frontend-only change (push) Has been skipped
CI/CD Pipeline / Build Production API Image (push) Has been skipped
CI/CD Pipeline / Build Production Web Image (push) Has been skipped
CI/CD Pipeline / Build Production Worker Image (push) Has been skipped
CI/CD Pipeline / Deploy Production (push) Has been skipped
CI/CD Pipeline / Production Browser E2E (push) Has been skipped
CI/CD Pipeline / Build Staging Web Image (push) Successful in 3m12s
CI/CD Pipeline / Validate Code Quality And Tests (push) Successful in 5m56s
CI/CD Pipeline / Frontend Unit Tests (push) Successful in 5m58s
CI/CD Pipeline / Frontend Lint (push) Successful in 6m32s
CI/CD Pipeline / Unit Tests (push) Failing after 6m48s
CI/CD Pipeline / Build Staging API Image (push) Successful in 8m5s
CI/CD Pipeline / Integration Tests (push) Successful in 2m9s
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 9m50s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 2m1s
CI/CD Pipeline / ACR Image Cleanup (push) Successful in 41s
CI/CD Pipeline / Staging E2E Tests (push) Failing after 1m34s
CI/CD Pipeline / Staging API Integration Tests (push) Successful in 3m40s
Co-authored-by: xiaoxia <dev@xiaoxiajianji.com> Co-committed-by: xiaoxia <dev@xiaoxiajianji.com>
65 lines
1.9 KiB
Python
Executable File
65 lines
1.9 KiB
Python
Executable File
"""Phase 2 - 模板发布版本化:version字段 + 发布历史表
|
|
|
|
Revision ID: 047
|
|
Revises: 046
|
|
Create Date: 2026-07-20
|
|
|
|
Changes:
|
|
1. edit_templates 加 version 字段(INT,默认1,每次发布+1)
|
|
2. 新建 edit_template_versions 表存发布历史快照,支持回滚
|
|
"""
|
|
|
|
import sqlalchemy as sa
|
|
|
|
from alembic import op
|
|
|
|
revision = "047_template_versioning"
|
|
down_revision = "046_task_title"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
conn = op.get_bind()
|
|
|
|
# 1. edit_templates 加 version 字段
|
|
op.add_column(
|
|
"edit_templates",
|
|
sa.Column("version", sa.Integer, nullable=False, server_default="1"),
|
|
)
|
|
|
|
# 2. 新建 edit_template_versions 发布历史表
|
|
conn.execute(sa.text("""
|
|
CREATE TABLE IF NOT EXISTS edit_template_versions (
|
|
id VARCHAR(36) PRIMARY KEY,
|
|
template_id VARCHAR(32) NOT NULL,
|
|
version INTEGER NOT NULL,
|
|
name VARCHAR(200) NOT NULL DEFAULT '',
|
|
editing_mode VARCHAR(30) NOT NULL DEFAULT 'one_take',
|
|
config JSONB NOT NULL DEFAULT '{}',
|
|
clip_configs JSONB NOT NULL DEFAULT '[]',
|
|
change_note VARCHAR(500) NOT NULL DEFAULT '',
|
|
published_by VARCHAR(36) NOT NULL DEFAULT '',
|
|
created_at TIMESTAMP NOT NULL DEFAULT NOW()
|
|
)
|
|
"""))
|
|
|
|
conn.execute(
|
|
sa.text(
|
|
"CREATE INDEX IF NOT EXISTS ix_edit_template_versions_template_id " "ON edit_template_versions(template_id)"
|
|
)
|
|
)
|
|
conn.execute(
|
|
sa.text(
|
|
"CREATE UNIQUE INDEX IF NOT EXISTS ix_edit_template_versions_template_version "
|
|
"ON edit_template_versions(template_id, version)"
|
|
)
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
conn = op.get_bind()
|
|
|
|
conn.execute(sa.text("DROP TABLE IF EXISTS edit_template_versions"))
|
|
op.drop_column("edit_templates", "version")
|