Code Monkey home page Code Monkey logo

Comments (4)

miguelgrinberg avatar miguelgrinberg commented on May 22, 2024 1

The db.create_all() call at the end of your models module should be removed. When you use Flask-Migrate the creation of tables is handled by the extension.

Try the following: remove that db.create_all() call, then delete all your database tables. Check in your migration/versions folder and if you have any files there remove them as well. Now call app_db.py db migrate. This should generate a migration that should include your tables. Review the new script added in migrations/versions and once you are satisfied with it run app_db.py db upgrade to trigger the creation of the tables in the database.

from flask-migrate.

miguelgrinberg avatar miguelgrinberg commented on May 22, 2024

Closing due to inactivity. I assume you worked out your problem, if not please reopen.

from flask-migrate.

danidee10 avatar danidee10 commented on May 22, 2024

@miguelgrinberg i don't think it's necessary to drop all the db tables (especially when you have important information in them)....in my case i simply:

  • commented out db.create_all()
  • then i deleted the new table that was created

after that alembic detected the new table and the migration worked without any problem

from flask-migrate.

miguelgrinberg avatar miguelgrinberg commented on May 22, 2024

@danidee10 you need to delete only the tables that you want the migration to pick up. In the case of this issue, the OP needed all the tables added to the migration, that is why I recommended all of them to be dropped.

from flask-migrate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.