رفتن به نوشته‌ها

Prevent migration errors in django

If you are a django developer maybe you worry about migrations errors while updating new files on server. It was one of the reasons to stop a startup for me.

But now I think I found a way to prevent such errors. At first migration mostly we have no problem. But if we face errors we can clear migration files in migration folders and do makemigrate and migrate again. But the problem suffers whenever we are at the middle of the project and we have data in database. At this time, it would be better to take backup of previous migration files on server. After replacing other files, we replace the migration files with the previous files. means we delete new migration files. Then, we do makemigration and migrate again.

So the migration takes place on the server and maybe we won’t face strange errors.

منتشر شده در جنگو

اولین باشید که نظر می دهید

دیدگاهتان را بنویسید

نشانی ایمیل شما منتشر نخواهد شد. بخش‌های موردنیاز علامت‌گذاری شده‌اند *