thesis-scripts/migrations/versions/271c3e6de3d7_initial_add.py

45 lines
1.7 KiB
Python
Raw Permalink Normal View History

2026-06-14 19:38:09 +00:00
"""initial add
Revision ID: 271c3e6de3d7
Revises: 16d350f2e166
Create Date: 2026-06-14 16:27:43.274217
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
# revision identifiers, used by Alembic.
revision: str = '271c3e6de3d7'
down_revision: Union[str, Sequence[str], None] = '16d350f2e166'
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.add_column('entries', sa.Column('filename', sa.String(length=255), nullable=False))
op.add_column('entries', sa.Column('sha1', sa.String(length=255), nullable=False))
op.add_column('entries', sa.Column('sha256', sa.String(length=255), nullable=False))
op.add_column('entries', sa.Column('file_type', sa.Enum('EXE', 'DLL', name='filetype'), nullable=False))
op.add_column('entries', sa.Column('entropy', sa.Double(), nullable=False))
op.add_column('entries', sa.Column('type', sa.Enum('MALICIOUS', 'BENIGN', name='type'), nullable=False))
op.drop_column('entries', 'title')
# ### end Alembic commands ###
def downgrade() -> None:
"""Downgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('entries', sa.Column('title', mysql.VARCHAR(length=255), nullable=False))
op.drop_column('entries', 'type')
op.drop_column('entries', 'entropy')
op.drop_column('entries', 'file_type')
op.drop_column('entries', 'sha256')
op.drop_column('entries', 'sha1')
op.drop_column('entries', 'filename')
# ### end Alembic commands ###