python - Flask-Migrate not creating migrations -
i have app_db module in application
import os flask import flask flask.ext.sqlalchemy import sqlalchemy flask.ext.script import manager flask.ext.migrate import migrate, migratecommand app.models.models import * if os.environ.get('database_url') none: sqlalchemy_database_uri = 'postgresql://ewojitxcrklhxpq:wkao8d-hdr2hgoqxyadbjmkhgr@ec2-23-23-214-211.compute-1.amazonaws.com:5432/d7i8ucmlletq2mmv' else: sqlalchemy_database_uri = os.environ['database_url'] app = flask(__name__) app.config['sqlalchemy_database_uri'] = sqlalchemy_database_uri db = sqlalchemy(app) migrate = migrate(app, db) manager = manager(app) manager.add_command('db', migratecommand) if(__name__=='main'): manager.run()
all model classes in app.models.models
. application connects db , returns results correctly when run python app_db.py db init
no migration created ? doing wrong ?
if trying create automatic migration script, reason alembic not detecting changes changes in database, there no difference between models , database schema. try deleting tables in database db.drop_all()
, try again.
Comments
Post a Comment