Drawback of delete all migrations file

32 views
Skip to first unread message

Sylvain Dégué

unread,
Dec 9, 2016, 1:39:50 PM12/9/16
to Django users
Im about to lauch a project that uses django for the api. So im only using the admin side for now. Ive been having problem concerning the database and forms.
Ive made many mistake while updating the database, when certain field didnt allow null. It caused IntegrityError, which I was able to fix

SO im thinking about reset completly my production database and remove all the migrations to start fresh. I dont have much data in the production database so its probably the best time.


Is there any drawback to flushing the database and removing the migrations files 

Matthew Pava

unread,
Dec 9, 2016, 1:52:16 PM12/9/16
to django...@googlegroups.com

If you made any of your customizations to the migrations files, then you will lose that information.

 

You may want to consider using Django’s dumpdata management command to save all the data on your production database (and loaddata to restore it).

https://docs.djangoproject.com/en/1.10/ref/django-admin/#dumpdata

 

Otherwise, flush away.  During the development of my project, at least at the beginning, I always deleted all of the migration files until I settled on a model that worked for me and I started adding my own customizations to them.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/bff6a050-8a28-48f4-abf2-57f17c3c8a04%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Abraham Varricatt

unread,
Dec 9, 2016, 1:54:08 PM12/9/16
to Django users
Hello Sylvain,

I think you have two concerns here,

On Friday, December 9, 2016 at 1:39:50 PM UTC-5, Sylvain Dégué wrote:
SO im thinking about reset completly my production database and remove all the migrations to start fresh. I dont have much data in the production database so its probably the best time.


Is there any drawback to flushing the database and removing the migrations files 

What is impact of removing migrations?
The migrations store information about how you changed your database schema over time. If this historical information is un-necessary for you, then there's no point in having it around.

What is impact of flushing the database?
This is something only you can answer - we have no knowledge of your business, and only you will know how best to support your customers. But since we are talking about a production database, might I offer an alternative? Take a backup of your database and store it somewhere. You don't need to keep it running, but having it around might be useful later on. 

Yours,
Abraham V.

Sylvain Dégué

unread,
Dec 9, 2016, 7:49:50 PM12/9/16
to Django users
Thanks guy!!But how do I reload the my previous data to the new database if the model changed??

Sylvain Dégué

unread,
Dec 9, 2016, 7:54:29 PM12/9/16
to Django users
NVM i read loaddata documentation
Reply all
Reply to author
Forward
0 new messages