Cannot complete Flask-Migration

后端 未结 8 2141
刺人心
刺人心 2021-02-02 13:27

I\'ve setup a local Postgres DB with SQLAlchemy and cannot commit my first entry. I keep on getting this error...

ProgrammingError: (ProgrammingError) relation          


        
8条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-02 14:05

    I ran into a similar issue. After performing the python manage.py db migrate command the database tables were not created, there was only an alembic table in the database.

    I found the solution in the flask-migrate documentation: https://flask-migrate.readthedocs.org/en/latest/

    The migration script needs to be reviewed and edited, as Alembic currently does not detect every change you make to your models. In particular, Alembic is currently unable to detect indexes. Once finalized, the migration script also needs to be added to version control.

    Then you can apply the migration to the database:

    python manage.py db upgrade
    

    This command created the tables and applied the database migrations.

提交回复
热议问题