立项配置数据入库、审计日志数据入库、编辑页UI界面美化、设备管理内容补充、审计日志显示优化
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
"""add material_equipments table
|
||||
|
||||
Revision ID: 20260227_01
|
||||
Revises: 20260213_03
|
||||
Create Date: 2026-02-27 10:30:00.000000
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "20260227_01"
|
||||
down_revision: Union[str, None] = "20260213_03"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
bind = op.get_bind()
|
||||
inspector = sa.inspect(bind)
|
||||
|
||||
if "material_equipments" not in inspector.get_table_names():
|
||||
op.create_table(
|
||||
"material_equipments",
|
||||
sa.Column("id", postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column("study_id", postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column("name", sa.String(length=255), nullable=False),
|
||||
sa.Column("spec_model", sa.String(length=255), nullable=False),
|
||||
sa.Column("unit", sa.String(length=50), nullable=True),
|
||||
sa.Column("brand", sa.String(length=100), nullable=False),
|
||||
sa.Column("origin", sa.String(length=255), nullable=True),
|
||||
sa.Column("production_permit_file_name", sa.String(length=255), nullable=True),
|
||||
sa.Column("tech_index_file_name", sa.String(length=255), nullable=True),
|
||||
sa.Column("need_calibration", sa.Boolean(), nullable=False, server_default=sa.text("false")),
|
||||
sa.Column("calibration_cycle_days", sa.Integer(), nullable=True),
|
||||
sa.Column("created_by", postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.text("now()"), nullable=False),
|
||||
sa.Column("updated_at", sa.DateTime(timezone=True), server_default=sa.text("now()"), nullable=False),
|
||||
sa.ForeignKeyConstraint(["study_id"], ["studies.id"]),
|
||||
sa.ForeignKeyConstraint(["created_by"], ["users.id"]),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
|
||||
indexes = {idx["name"] for idx in inspector.get_indexes("material_equipments")}
|
||||
index_name = op.f("ix_material_equipments_study_id")
|
||||
if index_name not in indexes:
|
||||
op.create_index(index_name, "material_equipments", ["study_id"], unique=False)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
bind = op.get_bind()
|
||||
inspector = sa.inspect(bind)
|
||||
|
||||
if "material_equipments" in inspector.get_table_names():
|
||||
indexes = {idx["name"] for idx in inspector.get_indexes("material_equipments")}
|
||||
index_name = op.f("ix_material_equipments_study_id")
|
||||
if index_name in indexes:
|
||||
op.drop_index(index_name, table_name="material_equipments")
|
||||
op.drop_table("material_equipments")
|
||||
@@ -0,0 +1,48 @@
|
||||
"""add milestone editor fields
|
||||
|
||||
Revision ID: 20260227_02
|
||||
Revises: 20260227_01
|
||||
Create Date: 2026-02-27 11:20:00.000000
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "20260227_02"
|
||||
down_revision: Union[str, None] = "20260227_01"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
bind = op.get_bind()
|
||||
inspector = sa.inspect(bind)
|
||||
columns = {col["name"] for col in inspector.get_columns("milestones")}
|
||||
|
||||
if "adjusted_start_date" not in columns:
|
||||
op.add_column("milestones", sa.Column("adjusted_start_date", sa.Date(), nullable=True))
|
||||
if "adjusted_end_date" not in columns:
|
||||
op.add_column("milestones", sa.Column("adjusted_end_date", sa.Date(), nullable=True))
|
||||
if "actual_start_date" not in columns:
|
||||
op.add_column("milestones", sa.Column("actual_start_date", sa.Date(), nullable=True))
|
||||
if "actual_end_date" not in columns:
|
||||
op.add_column("milestones", sa.Column("actual_end_date", sa.Date(), nullable=True))
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
bind = op.get_bind()
|
||||
inspector = sa.inspect(bind)
|
||||
columns = {col["name"] for col in inspector.get_columns("milestones")}
|
||||
|
||||
if "actual_end_date" in columns:
|
||||
op.drop_column("milestones", "actual_end_date")
|
||||
if "actual_start_date" in columns:
|
||||
op.drop_column("milestones", "actual_start_date")
|
||||
if "adjusted_end_date" in columns:
|
||||
op.drop_column("milestones", "adjusted_end_date")
|
||||
if "adjusted_start_date" in columns:
|
||||
op.drop_column("milestones", "adjusted_start_date")
|
||||
@@ -0,0 +1,38 @@
|
||||
"""add published project snapshot to study_setup_configs
|
||||
|
||||
Revision ID: 20260227_03
|
||||
Revises: 20260227_02
|
||||
Create Date: 2026-02-27 12:20:00.000000
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "20260227_03"
|
||||
down_revision: Union[str, None] = "20260227_02"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
bind = op.get_bind()
|
||||
inspector = sa.inspect(bind)
|
||||
columns = {col["name"] for col in inspector.get_columns("study_setup_configs")}
|
||||
if "published_project_snapshot" not in columns:
|
||||
op.add_column(
|
||||
"study_setup_configs",
|
||||
sa.Column("published_project_snapshot", postgresql.JSONB(astext_type=sa.Text()), nullable=True),
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
bind = op.get_bind()
|
||||
inspector = sa.inspect(bind)
|
||||
columns = {col["name"] for col in inspector.get_columns("study_setup_configs")}
|
||||
if "published_project_snapshot" in columns:
|
||||
op.drop_column("study_setup_configs", "published_project_snapshot")
|
||||
Reference in New Issue
Block a user