I'm using Flask-SQLAlchemy connect to multiple databases.
class Car(db.Model):
id = db.Column(db.Integer, primary_key=True)
brand = db.Column(db.String(80), unique=True)
class Dog(db.Model):
__bind_key__ = 'database_2'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80), unique=True)
and use command to init migrations
flask db init --multidb
then I got two databases,'default' and 'database_2'. When I use command
flask db migrate
to migrate, only default db schemas been generated to migrate scripts.
And then, when I use command
flask db upgrade
'default' and 'database_2' both got car table. Dog table didnt in the migration script.
I need car table in default db and dog table in database_2.
How can i migrate multi databases with different tables?
Need help,thank you.