开发者

How to use sqlalchemy-migrate with declarative db model

开发者 https://www.devze.com 2023-03-20 08:34 出处:网络
I try add to some table new column, how its described in documentation for sqlalchemy-migrate< like:

I try add to some table new column, how its described in documentation for sqlalchemy-migrate< like:

col = Column('col1', String, default='foobar')
col.create(table, populate_default=True)

But I get error, i think its because i use declarative models, how i can us开发者_开发问答e migrations?


def upgrade(migrate_engine):
    Base.metadata.bind = migrate_engine
    col = Column('col1', String, default='foobar')
    col.create(table, populate_default=True)`

worked for me.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号