flask-sqlalchemy
flask-sqlalchemy copied to clipboard
add CLI commands
Add a flask db create CLI command to call create_all(). Possibly add a command for drop_all() as well. Add an option add_cli_group that can either be a bool or a string. If it's a string, it changes the name from flask db to something else.
PR #520 has some discussion about whether it's a good idea to allow dropping from the CLI, either as a separate command with confirmation or as an option to create.
The db name is also overloaded by Flask-Alembic and Flask-Migrate. Assuming they're registered after Flask-SQLAlchemy, they will just overwrite it. Or they can detect it db is already registered and add their commands to the group.
I'm not 100% sure we even need the CLI commands, it only covers a use case where the app is simple enough to not use migrations, but doesn't just call create_all when creating the app.