yes

On Mon, Jul 23, 2018 at 4:02 PM, Yingchen Zhang <cevin.che...@gmail.com> wrote:
> ok, tks.
>
> so I must re-edit the migrations file?
>
> 在 2018年7月24日星期二 UTC+8上午2:06:06,Mike Bayer写道:
>>
>> On Mon, Jul 23, 2018 at 1:57 PM, Yingchen Zhang <cevin....@gmail.com>
>> wrote:
>> > class User(db.Model):
>> >     __tablename__ = 'users'
>> >     id = db.Column(db.BigInteger, primary_key=True)
>> >     name = db.Column(db.VARCHAR(50), nullable=False, unique=True)
>> >     email = db.Column(db.VARCHAR(200), nullable=False)
>> >
>> >     mobile = db.Column(db.VARCHAR(20))
>> >
>> >     created_at = db.Column(db.TIMESTAMP(False), nullable=False,
>> > default=func.now())
>> >
>> >     __table_args__ = (
>> >         Index('idx_users_name', func.lower('name'), unique=True),
>> >         Index('idx_users_email', func.lower('email'), unique=True)
>> >     )
>> >
>> >     def __init__(self):
>> >         if not self.created_at:
>> >             self.created_at = now()
>> >
>> >     def __repr__(self):
>> >         return '<User %s>' % self.name
>> >
>> >
>> > got a warning:
>> >
>> > UserWarning: autogenerate skipping functional index idx_users_email; not
>> > supported by SQLAlchemy reflection  warnings.warn(msg)
>> > UserWarning: autogenerate skipping functional index idx_users_name; not
>> > supported by SQLAlchemy reflection  warnings.warn(msg)
>>
>>
>> your code is correct.  it sounds like you are attempting to use
>> autogenerate in Alembic to add these indexes in a new migration.  you
>> have to specify them manually because autogenerate does not support
>> function-based indexes (e.g. the lower() function).
>>
>>
>> >
>> >
>> > --
>> > 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+...@googlegroups.com.
>> > To post to this group, send email to sqlal...@googlegroups.com.
>> > Visit this group at https://groups.google.com/group/sqlalchemy.
>> > For more options, visit https://groups.google.com/d/optout.
>
> --
> 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.

-- 
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