Forums

migrate problem

When i run migrate in the Bash console I get the error

django.db.utils.IntegrityError: NOT NULL constraint failed: new__hobbit_game.current_storystate_id

I have deleted the table to try and start again, but I am still getting the same error even though the table now does not exist!

Hi there,

If you want to rest your database and start again you need to completely delete the database and re-run your migrations. If you just delete a single table Django is unaware of that.

Also, when you get these kinds of errors the messages just above the error line will help you identify which migration caused the error.

Lee

Thanks for reply.

Problems 1) I cannot do any migration at all - i cant even create a table in a different app, it just fails with django.db.utils.IntegrityError: NOT NULL constraint failed: new__hobbit_game.current_storystate_id every time

2)I have tried opening a mySQL console with the following result DROP DATABASE 'EIPI45$HOBBIT'; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''EIPI45$HOBBIT'' at line 1 mysql> SHOW GRANTS FOR 'EIPI45'; ERROR 1142 (42000): SELECT command denied to user 'eipi45'@'10.0.0.146' for table 'user'

please advise

Try putting the database name in back ticks.

that changed it to ERROR 1044 (42000): Access denied

is there anything wrong with my settings.py declaration? 'USER': 'EIPI45', 'PASSWORD': 'flood_disputes_smothered', 'HOST': 'eipi45.mysql.eu.pythonanywhere-services.com',

Your mysql username is "eipi45"

thanks I have solved by deleting the migrations and remigrating

Glad to hear that. Let us know if there is anything else we can do.