app/migrations/versions/2022_031015_b500363567e3_create_admin_audit_log.py

41 lines
1.1 KiB
Python
Raw Normal View History

2022-03-10 23:13:31 +08:00
"""Create admin audit log
Revision ID: b500363567e3
Revises: 9282e982bc05
Create Date: 2022-03-10 15:26:54.538717
"""
import sqlalchemy_utils
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = 'b500363567e3'
down_revision = '9282e982bc05'
branch_labels = None
depends_on = None
def upgrade():
op.create
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('admin_audit_log', 'data',
existing_type=postgresql.JSONB(astext_type=sa.Text()),
nullable=False)
op.alter_column('admin_audit_log', 'model_id',
existing_type=sa.INTEGER(),
nullable=False)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('admin_audit_log', 'model_id',
existing_type=sa.INTEGER(),
nullable=True)
op.alter_column('admin_audit_log', 'data',
existing_type=postgresql.JSONB(astext_type=sa.Text()),
nullable=True)
# ### end Alembic commands ###