44 lines
1.5 KiB
Python
44 lines
1.5 KiB
Python
"""create audit logs table
|
|
|
|
Revision ID: 73b754d5b2c5
|
|
Revises: c37ba6143f83
|
|
Create Date: 2026-03-30 15:43:16.849980
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = '73b754d5b2c5'
|
|
down_revision: Union[str, Sequence[str], None] = 'c37ba6143f83'
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
"""Upgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('audit_logs',
|
|
sa.Column('id', sa.UUID(), nullable=False),
|
|
sa.Column('module_name', sa.String(length=100), nullable=False),
|
|
sa.Column('action_type', sa.String(length=20), nullable=False),
|
|
sa.Column('description', sa.Text(), nullable=True),
|
|
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_index(op.f('ix_audit_logs_id'), 'audit_logs', ['id'], unique=False)
|
|
op.create_index(op.f('ix_audit_logs_module_name'), 'audit_logs', ['module_name'], unique=False)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
"""Downgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_index(op.f('ix_audit_logs_module_name'), table_name='audit_logs')
|
|
op.drop_index(op.f('ix_audit_logs_id'), table_name='audit_logs')
|
|
op.drop_table('audit_logs')
|
|
# ### end Alembic commands ###
|