mirror of https://github.com/MISP/misp-modules
39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
"""empty message
|
|
|
|
Revision ID: 206e0e808b0c
|
|
Revises: 3a631d400f60
|
|
Create Date: 2024-08-21 09:36:37.801809
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.exc import OperationalError
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '206e0e808b0c'
|
|
down_revision = '3a631d400f60'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
try:
|
|
with op.batch_alter_table('external_tools', schema=None) as batch_op:
|
|
batch_op.add_column(sa.Column('api_key', sa.String(length=60), nullable=True))
|
|
batch_op.create_index(batch_op.f('ix_external_tools_api_key'), ['api_key'], unique=False)
|
|
except OperationalError:
|
|
print("Column 'api_key' already exist in 'external_tools")
|
|
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
with op.batch_alter_table('external_tools', schema=None) as batch_op:
|
|
batch_op.drop_index(batch_op.f('ix_external_tools_api_key'))
|
|
batch_op.drop_column('api_key')
|
|
|
|
# ### end Alembic commands ###
|