from sqlalchemy import *
from migrate import *


def upgrade(migrate_engine):
    # Upgrade operations go here. Don't create your own engine; bind
    # migrate_engine to your metadata
    meta = MetaData()
    meta.bind = migrate_engine

    # create column:

    userdata = Table('userdata', meta, autoload=True)
    created_at = Column('created_at', String(150), nullable=True)

    userdata.drop_column(created_at)

    created_at = Column('created_at', DateTime)

    userdata.create_column(created_at)

def downgrade(migrate_engine):
    # Operations to reverse the above upgrade go here.
    meta = MetaData()
    meta.bind = migrate_engine

    # create column:
    userdata = Table('userdata', meta, autoload=True)
    created_at = Column('created_at', DateTime)

    userdata.drop_column(created_at)

    created_at = Column('created_at', String(150), nullable=True)
    userdata.create_column(created_at)

add new column