I'm asking this on the official Django community after I asked on 
Stackoverflow because I still don't know what is the best practice for this 
particular action. 

(Original Question on Stackoverflow here 
<https://stackoverflow.com/questions/52225453/what-is-django-commend-equivalent-to-rails-rails-db-drop/52226394?noredirect=1#comment91407548_52226394>:
 
What is Django commend equivalent to Rails' $ rails db drop)

My scenario goes as follow: 

1. I create 2 model class objects, Post, Product in models.py 
2. Post has 2 attributes: post_title, post_text. Product has its own but 
that's irrelevant. 
3. I make migrations and migrate. 
4. Then I go to /admin of my page and add some rows both on Post and 
Product. 

5. Now I remember that I I forgot to add an attribute post_author on Post 
and adds it in models.py
6. If I make migrations, Django warns me that already existing rows needs 
default values since they don't have this new attributes. 
7. I don't want any post without an author so I want to drop this existing 
rows and make it all again. 
8. However, I don't want to lose any Product rows already created. 


Here's the question: How do I drop ONLY Post table leaving Product and my 
Superuser intact? 

Original Stackoverflow post suggests manually removing db.sqlite3 file and 
migrations files but I really don't think this is the way to go and there 
must be some best practice or commend for this since Django is already at 
2.1.

If not, I think there must be a good reason not to have one and I want to 
know why. 



-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a8170e3d-ae7f-4b59-9330-fef33fb9816d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to