后台挂起
This commit is contained in:
1 parent
788118ce3d
commit
19399482e1
21 files changed
+626
-50
No files matched your search
+46
@@ -0,0 +1,46 @@
|
||||
"""Add dialogues column to roundtable_jobs.
|
||||
|
||||
存研讨对话记录(leader 说明 + 各席位交付),使后台作业跑完 / 进行中用户都能看到
|
||||
真实研讨内容(而非只有流程图进度)。LONGTEXT(对话可超 64 KB),匹配
|
||||
``PortableLongText`` on ``RoundtableJobRow.dialogues``。
|
||||
|
||||
Revision ID: 20260605_01
|
||||
Revises: 20260604_01
|
||||
Create Date: 2026-06-05
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
from sqlalchemy import inspect
|
||||
from sqlalchemy.dialects.mysql import LONGTEXT
|
||||
|
||||
|
||||
revision = "20260605_01"
|
||||
down_revision = "20260604_01"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def _has_table(table_name: str) -> bool:
|
||||
inspector = inspect(op.get_bind())
|
||||
return table_name in inspector.get_table_names()
|
||||
|
||||
|
||||
def _has_column(table_name: str, column_name: str) -> bool:
|
||||
if not _has_table(table_name):
|
||||
return False
|
||||
inspector = inspect(op.get_bind())
|
||||
return any(col["name"] == column_name for col in inspector.get_columns(table_name))
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
if _has_table("roundtable_jobs") and not _has_column("roundtable_jobs", "dialogues"):
|
||||
col_type = LONGTEXT() if op.get_bind().dialect.name == "mysql" else sa.Text()
|
||||
op.add_column("roundtable_jobs", sa.Column("dialogues", col_type, nullable=True))
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
if _has_column("roundtable_jobs", "dialogues"):
|
||||
op.drop_column("roundtable_jobs", "dialogues")
|
||||
Reference in new issue
Block a user