B
B
blazer052016-07-01 09:08:09
Django
blazer05, 2016-07-01 09:08:09

Error 1050 when running migrate?


Why do I get the error: django.db.utils.OperationalError: (1050, "Table 'userprofile' already exists") when I add new data to the model and run makemigrations - migrate ,
and how can I fix this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
blazer05, 2016-07-01
@blazer05

Solution.
1. Delete all migrations except __init__.py from the migrations folder of your application and also delete all migrations related to your application in the database in the django_migrations table and delete the table itself for which migrations do not pass.
2. In the database settings in the settings.py file, do so and run the migrations again.

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': '',
'USER': '',
'PASSWORD': '',
'OPTIONS': {
"init_command": "SET storage_engine=MYISAM",
}
}
},

After that, the table was recreated for me and without any problems I was able to add and delete data to it!
Huge thanks to this person Viteran33 for helping me with my issue!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question