-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flask-Migrate integration #738
Comments
I'd be happy to write some docs on it if I get some pointers. |
OK, I have it working now. I heavily borrowed ideas from superset. It would be great if fabmanager supports flask-migrate by default (contributions welcome?). I now wrote my own flask-script cli commands to implement it. I made a script in app/bin/<appname> with the following:
And then in app/cli.py I implemented the command like this:
From there, you can start the flask-migrate stuff with
Further down, change the existing target_metadata variable to:
This will ensure it finds your flask_appbuilder sqlalchemy metadata. If you don't, it will actually create scripts to remove all flask_appbuilder tables, because it doesn't know about them. |
Hi @dolfandringa , New 0.11.0 solves this issue, made a small quickhowto with Flask-Migrate has an example: https://github.com/dpgaspar/Flask-AppBuilder/tree/master/examples/quickmigrate |
Alright, since I use mysql as the store, I found out the problem. It's because that the type of the column "active" in the table ab_user is tinyint but is bool in model instead, so flask-migrate(alembic) detects the difference every time I try to upgrade, but as it's mentioned here, I think changing the column type to bool in mysql makes no sense, but I still don't know why it just stuck. |
I see a script db_migrate and db_upgrade in the bin folder, but no docs on how I am supposed to use it with flask appbuilder.
I see issue #373 about someone trying to integrate it themselves, and I can probably get that idea to work (I think the error there is he just doesn't import the model) but is there a way this is supposed to be integrated in flask appbuilder? Wouldn't it make sense to integrate it in fabmanager?
The text was updated successfully, but these errors were encountered: