Adding indexes to SQLAlchemy models after table creation

前端 未结 6 1109
野性不改
野性不改 2021-01-31 16:20

I have a flask-sqlalchemy model:

class MyModel(db.Model):
__tablename__ = \'targets\'
id = db.Column(db.Integer, primary_key=True)
url = db.Column(db.String(2048         


        
6条回答
  •  深忆病人
    2021-01-31 17:15

    Use flask-migrate.It's cool. After you add the index,just use this command:

    python manage.py db migrate
    

    Everything works fine

提交回复
热议问题