**** CubicPower OpenStack Study ****
def downgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine
token = Table('token', meta, autoload=True)
old_id_col = token.c.id
old_id_col.alter(name='id_hash')
# Note: We obtain a new metadata reference to avoid
# sqlalchemy.exc.ArgumentError:
# Trying to redefine primary-key column 'id' as a non-primary-key...
meta = MetaData()
meta.bind = migrate_engine
token = Table('token', meta, autoload=True)
new_id = Column("id", String(2048))
token.create_column(new_id)
**** CubicPower OpenStack Study ****
def upgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine
token = Table('token', meta, autoload=True)
token.drop_column('id')
token = Table('token', meta, autoload=True)
id_col = token.c.id_hash
id_col.alter(name='id')