from sqlalchemy import *
from migrate import *


from migrate.changeset import schema
pre_meta = MetaData()
post_meta = MetaData()
threads = Table('threads', post_meta,
    Column('created_at', TIMESTAMP, nullable=False),
    Column('updated_at', TIMESTAMP, nullable=False),
    Column('id', Integer, primary_key=True, nullable=False),
    Column('firstmail', Integer),
    Column('date', DateTime),
    Column('islabeled', Boolean),
    Column('istrained', Boolean),
    Column('opened', Boolean),
    Column('body', Text),
    Column('maintopic', String),
)


def upgrade(migrate_engine):
    # Upgrade operations go here. Don't create your own engine; bind
    # migrate_engine to your metadata
    pre_meta.bind = migrate_engine
    post_meta.bind = migrate_engine
    post_meta.tables['threads'].columns['istrained'].create()


def downgrade(migrate_engine):
    # Operations to reverse the above upgrade go here.
    pre_meta.bind = migrate_engine
    post_meta.bind = migrate_engine
    post_meta.tables['threads'].columns['istrained'].drop()

