def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('dataset', 'collection_date',
existing_type=mysql.DATETIME(),
type_=sa.Text(),
existing_nullable=True)
op.alter_column('dataset', 'latitude',
existing_type=mysql.FLOAT(),
type_=sa.Text(),
existing_nullable=True)
op.alter_column('dataset', 'longitude',
existing_type=mysql.FLOAT(),
type_=sa.Text(),
existing_nullable=True)
op.alter_column('user', 'admin',
existing_type=mysql.TINYINT(display_width=1),
type_=sa.Boolean(),
existing_nullable=True)
# ### end Alembic commands ###
python类TINYINT的实例源码
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('user', 'admin',
existing_type=sa.Boolean(),
type_=mysql.TINYINT(display_width=1),
existing_nullable=True)
op.alter_column('dataset', 'longitude',
existing_type=sa.Text(),
type_=mysql.FLOAT(),
existing_nullable=True)
op.alter_column('dataset', 'latitude',
existing_type=sa.Text(),
type_=mysql.FLOAT(),
existing_nullable=True)
op.alter_column('dataset', 'collection_date',
existing_type=sa.Text(),
type_=mysql.DATETIME(),
existing_nullable=True)
# ### end Alembic commands ###
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_table('roles',
sa.Column('id', mysql.INTEGER(display_width=11), nullable=False),
sa.Column('name', mysql.VARCHAR(collation=u'utf8_unicode_ci', length=64), nullable=True),
sa.PrimaryKeyConstraint('id'),
mysql_collate=u'utf8_unicode_ci',
mysql_default_charset=u'utf8',
mysql_engine=u'InnoDB'
)
op.create_table('users',
sa.Column('id', mysql.INTEGER(display_width=11), nullable=False),
sa.Column('username', mysql.VARCHAR(collation=u'utf8_unicode_ci', length=64), nullable=True),
sa.Column('role_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
sa.Column('email', mysql.VARCHAR(collation=u'utf8_unicode_ci', length=64), nullable=True),
sa.Column('password_hash', mysql.VARCHAR(collation=u'utf8_unicode_ci', length=128), nullable=True),
sa.Column('confirmed', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True),
sa.ForeignKeyConstraint(['role_id'], [u'roles.id'], name=u'users_ibfk_1'),
sa.PrimaryKeyConstraint('id'),
mysql_collate=u'utf8_unicode_ci',
mysql_default_charset=u'utf8',
mysql_engine=u'InnoDB'
)
op.drop_table('context_show')
### end Alembic commands ###
def column_reflect(inspector, table, column_info):
if type(column_info['type']) is mysql.TINYINT:
column_info['type'] = Boolean()
#from application import User, Project, Branch, Thread, Comment, Likes, User_Tag, File_Tag, Named_Tag, Custom_Tag, Free_Tag, limiter, mail
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('dataset', sa.Column('meta_latitude', sa.Float(), nullable=True))
op.add_column('dataset', sa.Column('meta_longitude', sa.Float(), nullable=True))
op.alter_column('user', 'admin',
existing_type=mysql.TINYINT(display_width=1),
type_=sa.Boolean(),
existing_nullable=True)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('user', 'admin',
existing_type=sa.Boolean(),
type_=mysql.TINYINT(display_width=1),
existing_nullable=True)
op.drop_column('dataset', 'meta_longitude')
op.drop_column('dataset', 'meta_latitude')
# ### end Alembic commands ###
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column('match', sa.Column('playout_enabled', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True))
op.add_column('match', sa.Column('overtime_enabled', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True))
### end Alembic commands ###