Skip to content
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 does not support Flask-Script any more. #74

Open
fabianfreyer opened this issue Jun 21, 2021 · 3 comments
Open

Flask-Migrate does not support Flask-Script any more. #74

fabianfreyer opened this issue Jun 21, 2021 · 3 comments

Comments

@fabianfreyer
Copy link
Collaborator

fabianfreyer commented Jun 21, 2021

See: miguelgrinberg/Flask-Migrate#407
should migrate to flask CLI: https://blog.miguelgrinberg.com/post/migrating-from-flask-script-to-the-new-flask-cli

@destroyer22719
Copy link

Hi there, I've tried reading the documentation and from what I understand the issue is MigrateCommand doesn't exist in the first place with newer versions of Flask-Migrate migrate in which you can't use the manager.add_command method from Flask-Script. I've read the guide and do I even need to use the manager.add_command or it's successor Flask-Cli's equivalent?

from flask import Flask, render_template
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate, MigrateCommand
from flask_script import Manager
#
app = Flask(__name__)
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///database.db"

db = SQLAlchemy(app)
migrate = Migrate(app, db)

manager = Manager(app)
manager.add_command("db", MigrateCommand)

@aminPial
Copy link

Simple downgrade to:

Flask-Migrate==2.5.2
Flask-Script==2.0.6

to make it work.

@dkhusted
Copy link

You could use pip install --force-reinstall flask_migrate==2.5.2 and afterwards same trick with flask-script. I would recommend doing this in a virtual env, since you only need it for this one instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants