On Dec 6, 2015 4:48 PM, "Mike Dewhirst" <mi...@dewhirst.com.au> wrote: > > On 7/12/2015 7:21 AM, Alexander Whatley wrote: >> >> This question may just be due to my inexperience with Django, but >> whenever I modify one of my Model elements and change its parameters, I >> have to close my IDE and manually use the command prompt to drop the SQL >> Table corresponding to the Model, and then migrate the new model, which >> is very annoying. >
Are you creating a new migration after each set of changes and then applying that new migration? Why is it that you are expecting a table to drop when all you are doing is modifying an existing table/model? If that's the case, the existing table would be altered, not dropped and recreated with the new attributes (which would cause a loss of data and likely other issues with related data). If the standard migration process is not working, you should post up the errors that you are getting. Your IDE should have little to do with this process, aside from maybe triggering the migration scripts to run if it supports such an operation. > > It sounds like this is a feature your IDE should provide. Django has the necessary functionality but won't do it unbidden. > > > > Is there a built in feature in Django that allows me >> >> to get around having to do this, and if not, is there one in >> development? Thanks. >> If you are expecting (well, desiring) this behavior, you'll likely need to write your own management command to perform this task, which is pretty simple. I wrote one that does something similar to what you are expecting, except that it drops the entire database, creates a new one, applies all existing migrations, and then populates the DB with dummy data that I've generated (since I'm working on models that expect that data to be present already and its a pain to manually create it via the web browser every time). Think of an online demo of an application that resets itself every hour. https://docs.djangoproject.com/en/1.9/howto/custom-management-commands/ I do think a built-in admin command to "reset" the entire database would be handy, but I've been too lazy to put in the feature request. -James -- 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+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2Be%2BciXohddFptGwZxy%2B24AmYJqA2Ej6_3mv_pn%3Dmx%3DwbZ4m3A%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.