Merge pull request #3594 from ninjadq/migrator_1_2_0_rc_to_1_3_0

fix issue when upgrade from 1.2.0rc1 to 1.3.0
This commit is contained in:
Yan 2017-11-13 10:49:06 +08:00 committed by GitHub
commit 327ea1c530
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,6 +39,11 @@ def upgrade():
bind = op.get_bind() bind = op.get_bind()
session = Session(bind=bind) session = Session(bind=bind)
# This is to solve the legacy issue when upgrade from 1.2.0rc1 to 1.3.0 refered by #3077
username_coloumn = session.execute("show columns from user where field='username'").fetchone()
if username_coloumn[1] != 'varchar(255)':
op.alter_column('user', 'username', type_=sa.String(255))
# create table project_metadata # create table project_metadata
ProjectMetadata.__table__.create(bind) ProjectMetadata.__table__.create(bind)