@@ -0,0 +1,42 @@
|
||||
"""Удаление lab_audit_log — аудит lab только в application log.
|
||||
|
||||
Revision ID: drop_lab_audit_log
|
||||
Revises: lab_component_nutrients
|
||||
Create Date: 2026-06-08
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
revision = "drop_lab_audit_log"
|
||||
down_revision = "lab_component_nutrients"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade(**kw) -> None:
|
||||
if kw.get("tag") == "reports":
|
||||
return
|
||||
bind = op.get_bind()
|
||||
if "lab_audit_log" in sa.inspect(bind).get_table_names():
|
||||
op.drop_table("lab_audit_log")
|
||||
|
||||
|
||||
def downgrade(**kw) -> None:
|
||||
if kw.get("tag") == "reports":
|
||||
return
|
||||
bind = op.get_bind()
|
||||
if "lab_audit_log" not in sa.inspect(bind).get_table_names():
|
||||
op.create_table(
|
||||
"lab_audit_log",
|
||||
sa.Column("id", sa.String(length=36), primary_key=True),
|
||||
sa.Column("user_id", sa.String(length=50), nullable=True),
|
||||
sa.Column("action", sa.String(length=50), nullable=False),
|
||||
sa.Column("entity_type", sa.String(length=50), nullable=False),
|
||||
sa.Column("entity_id", sa.String(length=36), nullable=True),
|
||||
sa.Column("metadata_json", sa.Text(), nullable=False, server_default="{}"),
|
||||
sa.Column("created_at", sa.DateTime(), nullable=True),
|
||||
sa.Column("updated_at", sa.DateTime(), nullable=True),
|
||||
)
|
||||
Reference in New Issue
Block a user