NexusDash-izebra/migrations/versions/bd908969d8fe_add_audit_log_table.py

36 lines
1023 B
Python
Raw Normal View History

2022-02-12 03:48:16 +00:00
"""Add audit_log table
2022-02-12 03:45:07 +00:00
2022-02-12 03:48:16 +00:00
Revision ID: bd908969d8fe
2022-02-12 03:45:07 +00:00
Revises: aee4c6c24811
2022-02-12 03:48:16 +00:00
Create Date: 2022-02-11 21:48:03.798474
2022-02-12 03:45:07 +00:00
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
# revision identifiers, used by Alembic.
2022-02-12 03:48:16 +00:00
revision = 'bd908969d8fe'
2022-02-12 03:45:07 +00:00
down_revision = 'aee4c6c24811'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('audit_logs',
2022-02-12 03:48:16 +00:00
sa.Column('id', mysql.INTEGER(), nullable=False),
sa.Column('account_id', sa.Integer(), nullable=True),
sa.Column('action', mysql.TEXT(), nullable=True),
sa.Column('date', mysql.TIMESTAMP(), server_default=sa.text('now()'), nullable=False),
sa.ForeignKeyConstraint(['account_id'], ['accounts.id'], ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id')
2022-02-12 03:45:07 +00:00
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('audit_logs')
# ### end Alembic commands ###