I have a fairly large Flask app, and my typical workflow to create new data tables is as follows:
I create a class in models.py, such as the below:
class ExampleModel(db.Model):
__tablename__ = 'example_table'
id = db.Column(db.Integer, primary_key=True)
text = db.Column(db.String(100))
Then I run flask db migrate
and flask db upgrade
. After these commands, the table is created and I can insert data normally
item = ExampleModel(text='something')
db.session.add(item)
db.session.commit()
Up until now I've had no problems using the above workflow, even immediately before I started having issues. I added a table, and then added some columns to it, and basically just ran into trouble with the nullable values and whatnot (user error). I didn't do much other than delete some model classes, migration scripts, and manually deleted a table in psql (I am using Postgres).
Now, I am unable to execute a test case (ExampleModel) from above. When I try this simple example, no migration script is created in the migrations directory
Output from flask db migrate
:
INFO [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO [alembic.runtime.migration] Will assume transactional DDL.
Output from flask db upgrade
:
INFO [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO [alembic.runtime.migration] Will assume transactional DDL.
Things I've tried:
- Rebasing from master, essentially starting over
- Using the test model above
- Deleting
migrations
directory and creating a new one
My config and init files should be fine- they are unchanged since this was last working. I'm stumped on this one