I'm trying to extend the flask-base project https://github.com/hack4impact/flask-base/tree/master/app which comes with a user model only. I've added to the project so that the dev database looks like the screenshot above.
My model folder is made up of the provided user class and miscellaneous.py.
I've added other_models.py which contains:
class Account(db.Model):
__tablename__ = 'accounts'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(140))
type = db.Column(db.String(1400))
class Postings(db.Model):
__tablename__ = 'postings'
index = db.Column(db.Integer, primary_key=True)
property_name = db.Column(db.Text)
class Property(db.Model):
__tablename__ = 'properties'
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String(140))
The problem is that that I now want to make migrations using the built in flask-migrate, to ease deployment, but not all the models are being recognized. After running:
python manage.py db init
python manage.py db migrate
I get:
INFO [alembic.runtime.migration] Context impl SQLiteImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
INFO [alembic.autogenerate.compare] Detected added table 'properties'
Where are the rest of the table migrations?
In app/models/init.py , I have
"""
These imports enable us to make all defined models members of the models
module (as opposed to just their python files)
"""
from .user import * # noqa
from .miscellaneous import * # noqa
from .other_models import Postings, Property,Account
Based on https://github.com/miguelgrinberg/Flask-Migrate/issues/31, I have tried renaming the original db from data-dev.sqlite to o-data-dev.sqlite
I removed the migrations folder and reran:
python manage.py db init
python manage.py db migrate
But I'm getting the exact same result.
INFO [alembic.runtime.migration] Context impl SQLiteImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
INFO [alembic.autogenerate.compare] Detected added table 'properties'
How can I get this working?