# -*- coding: utf-8 -*-

"""Encriptación de archivos

Revision ID: 1f38671f53c3
Revises: 4312431622eb
Create Date: 2015-11-01 19:36:09.819480

"""

# revision identifiers, used by Alembic.
revision = '1f38671f53c3'
down_revision = '4312431622eb'

from alembic import op
import sqlalchemy as sa


def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('analysis_file_encryption',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('encrypted_secret_key', sa.Text(), nullable=True),
    sa.Column('analysis_file_id', sa.Integer(), nullable=True),
    sa.Column('profile_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['analysis_file_id'], ['analysis_file.id'], ),
    sa.ForeignKeyConstraint(['profile_id'], ['profile.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.add_column(u'analysis_file', sa.Column('is_encrypted', sa.Boolean(), nullable=True))
    op.add_column(u'user', sa.Column('rsa_private_key', sa.Text(), nullable=True))
    op.add_column(u'user', sa.Column('rsa_public_key', sa.Text(), nullable=True))
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_column(u'user', 'rsa_public_key')
    op.drop_column(u'user', 'rsa_private_key')
    op.drop_column(u'analysis_file', 'is_encrypted')
    op.drop_table('analysis_file_encryption')
    ### end Alembic commands ###
