microblog icon indicating copy to clipboard operation
microblog copied to clipboard

Chapter 4: Problem with 'flask db downgrade base'

Open DRuyters opened this issue 1 year ago • 1 comments

Hello,

When trying to downgrade the database, I get the following error:

"Cannot drop index 'ix_post_user_id': needed in a foreign key constraint"

I assume that I need to change something in one of the migrations files to solve this problem. I am running a local MySQL server so it might be related to that

DRuyters avatar Aug 31 '24 12:08 DRuyters

If this happens with the "posts table" migration included in this project, then my guess is that there is some small difference between sqlite (which is what I used when the migrations were generated) and MySQL. You can try moving the drop table call to the top to see if that helps.

miguelgrinberg avatar Aug 31 '24 13:08 miguelgrinberg