SkierPGP/Skier

View on GitHub
migrations/versions/skier_migrate_add_added_time_field.py

Summary

Maintainability
A
0 mins
Test Coverage
"""Add added_time field.

Revision ID: 376c313a482
Revises: 45fdf20fb2f
Create Date: 2015-08-19 16:00:42.264410

"""

# revision identifiers, used by Alembic.
revision = '376c313a482'
down_revision = '45fdf20fb2f'

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('signature')
    op.add_column('key', sa.Column('added_time', sa.DateTime()))
    op.drop_column('key', 'subkeys')
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('key', sa.Column('subkeys', postgresql.ARRAY(postgresql.VARCHAR(length=255)), autoincrement=False, nullable=False))
    op.drop_column('key', 'added_time')
    op.create_table('signature',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('pgp_keyid', sa.VARCHAR(length=16), autoincrement=False, nullable=False),
    sa.Column('sigtype', sa.VARCHAR(length=16), autoincrement=False, nullable=True),
    sa.Column('key_id', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['key_id'], ['key.id'], name='signature_key_id_fkey'),
    sa.PrimaryKeyConstraint('id', name='signature_pkey')
    )
    ### end Alembic commands ###