How to check if models are in sync with generated migrations? #491
-
Hi, alembic-autogen-check is a nice tool to check that with
I saw this and this topic, but those are checking database and migrations sync, not models and migrations sync. Thanks for help in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
The tool that you referenced does not check for sync between models and migrations, it checks for sync between models and your database. You can do the same with the |
Beta Was this translation helpful? Give feedback.
-
thank you @miguelgrinberg for clear answer :) Ticket/discussion can be closed. |
Beta Was this translation helpful? Give feedback.
-
I can see that |
Beta Was this translation helpful? Give feedback.
The tool that you referenced does not check for sync between models and migrations, it checks for sync between models and your database.
You can do the same with the
flask db migrate
command. If this command returns an error, then your models are identical to your database tables and there is nothing to migrate. If this command generates a migration file, that means that there are some differences and these will be listed in the generated migration script. If you don't care to keep the generate migration script, you can safely delete it.