Add application_id column to AuditEvent

Use application_id and portfolio_id if the resource is a portfolio in AuditableMixin
Clean up some residual references to workspace
This commit is contained in:
leigh-mil
2019-05-15 18:14:26 -04:00
parent 42900a20a6
commit b3ecd1658c
5 changed files with 83 additions and 11 deletions

View File

@@ -0,0 +1,32 @@
"""add_appliction_id_to_auditevent
Revision ID: c5deba1826be
Revises: 404bb5bb3a0e
Create Date: 2019-05-15 16:30:27.981456
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = 'c5deba1826be'
down_revision = '404bb5bb3a0e'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('audit_events', sa.Column('application_id', postgresql.UUID(as_uuid=True), nullable=True))
op.create_index(op.f('ix_audit_events_application_id'), 'audit_events', ['application_id'], unique=False)
op.create_foreign_key('audit_events_application_application_id', 'audit_events', 'applications', ['application_id'], ['id'])
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint('audit_events_application_application_id', 'audit_events', type_='foreignkey')
op.drop_index(op.f('ix_audit_events_application_id'), table_name='audit_events')
op.drop_column('audit_events', 'application_id')
# ### end Alembic commands ###