Questions tagged [flask-migrate]

Use this tag for questions related to the Flask extension flask-migrate, this extension implements SQLAlchemy database migrations. It should be used with the tag Flask too.

Flask-Migrate is an extension that handles SQLAlchemy database migrations for Flask applications using Alembic. The database operations are provided as command line arguments for Flask-Script.

Documentation is here

320 questions
2
votes
2 answers

Alembic not generating correct changes

I am using Flask-Migrate==2.0.0. Its not detecting the changes correctly. Every time I run python manage db migrate it generates a script for all models although they have been added successfully in previous revisions. I have added two new columns…
Waseem
  • 1,392
  • 5
  • 21
  • 30
2
votes
1 answer

Flask terminal command not found

I found this Stack Overflow question explaining that Flask 0.10 does not have the flask command. How should I initialize the database for Flask-Migrate? I discovered this issue when following the documentation for Flask-Migrate. After installing the…
rosendin
  • 611
  • 1
  • 10
  • 18
2
votes
1 answer

flask migrate upgrade not working after drop table

I am using SqlAlchemy and Flask-migrate for DB migration. I have successfully init the DB and upgrade once using the following: python manage.py db init python manage.py db migrate # creates the migration script,faefc6a6c7ae, as below:…
qre0ct
  • 5,680
  • 10
  • 50
  • 86
2
votes
2 answers

How to set up Flask on pythonanyhwere based on flask megatutorial

I am currently developing an application. this web app has its own domain. when initially created i set up the domain and the registrar using the cname and it succesfully displayed after a couple of hours "this is a flask app..." something like…
George Pamfilis
  • 1,397
  • 2
  • 19
  • 37
2
votes
1 answer

How does flask migrate track which revision ID is current?

I've been using Flask-Migrate incorrectly. Between two environments I have independently created the migrations folder, and added the migrations folder to the .gitignore file. This has recently caused problems because I would like to interact with…
JZ.
  • 21,147
  • 32
  • 115
  • 192
2
votes
0 answers

Flask-migrate drops tables on first migration

I'm trying to set up Flask-migrate for an app, but the first migration file always contains SQL to drop all tables rather than build them up. Here is my app structure: # app/__init__.py from flask import Flask from flask.ext.sqlalchemy import…
Casey
  • 2,611
  • 6
  • 34
  • 60
2
votes
1 answer

flask-migrate: can't upgrade database becase "table does not exist"

I am working on a flask application using sqlalchemy with a postgres database. I am migrating my databsed with flask-migrate. I had to change the name of one of my tables in the database and when trying to migrate (flask-migrate) I got an…
carl
  • 4,216
  • 9
  • 55
  • 103
2
votes
1 answer

How to sync db with Flask-Migrate in a fresh application deployment?

When deploying an application to a fresh server (i.e. the database is empty) how do I sync the database properly with Flask-Migrate? I've added Flask-Migrate to the project when I already had some schema in place so I don't have "initial"…
Warwick
  • 1,200
  • 12
  • 22
2
votes
1 answer

Flask-Migrate: alembic.util.CommandError: No such revision

I have installed the Flask-Migration and initialised the migration however I would receive the following error when i run python3 manage.py db migrate. File…
2
votes
1 answer

Flask migrate ignoring foreign key

I am using Flask-migrate to create migrations. I have 2 models as follows - class User(db.Model): id = db.Column(db.Integer, primary_key=True, autoincrement=True) name = db.Column(db.String(80), unique=True) email =…
utkbansal
  • 2,787
  • 2
  • 26
  • 47
2
votes
0 answers

Flask-Migrate: Data migrations do not aplly after schema migrations together

At first I create schema migration with Flask-Migrate (Alembic migrations for Flask). After that, I create separated data migration script (with Flask-Migrate too). But when I run ./manage db upgrade for apply all not-applied migrations, I see in…
2
votes
1 answer

How do I use flask-migrate on pythonanywhere?

Does anyone have an example of successfully using flask-migrate on pythonanywhere? Does anyone have a simple example of what an app.py using migration should look like? Something along the lines of: from flask import Flask, request,…
Peter Cotton
  • 1,671
  • 14
  • 17
2
votes
1 answer

Flask-Migrate, do not create tables if exists

I have a Flask project with MySQL database and uses SQLAlchemy as ORM and Flask-Migrate*for migrations. I wrote my models and when I run the migrations, migration file is empty because existing tables are out of Flask-Migrate's control so I actually…
1
vote
1 answer

Flask migration command is not showing error messages

We are using Flask with SQLAlchemy and Flask migrate. This was working fine so far but lately it has stopped showing error messages on failures. It just silently fails. I believe this started happening when we upgraded flask-migrate but I'm not 100%…
Ankit
  • 3,878
  • 5
  • 35
  • 51
1
vote
1 answer

unable to perform flask-migrate migrations on cloud SQL

I am trying to implement flask-migrate with cloud SQL database. for this, I created a PostgreSQL instance on cloud sql. following is my app.py file from flask import Flask from flask_sqlalchemy import SQLAlchemy from flask_migrate import…