On Thu, Jul 26, 2018 at 11:03 AM Yingchen Zhang <cevin.che...@gmail.com> wrote:
>
> old model
>
> class User(db.Model):
>     __tablename__ = 'users'
>     id = db.Column(db.BigInteger, primary_key=True)
>     name = db.Column(db.VARCHAR(50), nullable=False)
>
>     email = db.Column(db.VARCHAR(200), nullable=False)
>
>     time = db.Column(db.INTGER, nullable=False)
>
>
> new model
>
> class User(db.Model):
>     __tablename__ = 'users'
>     id = db.Column(db.BigInteger, primary_key=True)
>     name = db.Column(db.VARCHAR(50), nullable=False)
>
>     email = db.Column(db.VARCHAR(200), nullable=False)
>
>     time = db.Column(db.TIMESTAMP(timezone=True), nullable=False)
>
>
> new database table and is still empty, so do not ask why... emmmm
>
> I use flask-sqlalchemy migration tool. When I modified User mode and run 
> `python manager.py db migrate`.got :
>
> `INFO  [alembic.env] No changes in schema detected.`
>
> So, Sqlalchemy migrate tool only support create and drop ?

Alembic (the library that flask-sqlalchemy is using for migrations)
supports changing column types. However, it doesn't *auto-detect*
changes of column types by default:

http://alembic.zzzcomputing.com/en/latest/autogenerate.html#what-does-autogenerate-detect-and-what-does-it-not-detect

"""
Autogenerate can optionally detect:

Change of column type. This will occur if you set the
EnvironmentContext.configure.compare_type parameter to True, or to a
custom callable function. The feature works well in most cases, but is
off by default so that it can be tested on the target schema first. It
can also be customized by passing a callable here; see the section
Comparing Types for details.
"""

Hope that helps,

Simon

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to