Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<blockquote> <p>EDIT - I'm putting a comment below at the top of this as it's important to read it before the > accepted answer that follows @andybak</p> <blockquote> <p>@Dominique: Your advice regarding manage.py reset south is dangerous and may destroy the database if there are any third party apps using south in the project, as pointed out by @thnee below. Since your answer has so many upvotes I'd really appreciate it if you could edit it and add at least a warning about this, or (even better) change it to reflect @hobs approach (which is just as convenient, but doesn't affect other apps) - thanks! – chrisv Mar 26 '13 at 9:09</p> </blockquote> <p>Accepted answer follows below:</p> </blockquote> <p>First, <a href="http://groups.google.com/group/south-users/browse_thread/thread/888413f195acd9c2/0ee513da38240e19" rel="noreferrer">an answer by the South author</a>:</p> <blockquote> <p>As long as you take care to do it on all deployments simultaneously, there shouldn't be any problem with this. Personally, I'd do:</p> <pre><code> rm -r appname/migrations/ ./manage.py reset south ./manage.py convert_to_south appname </code></pre> <p>(Notice that the “<code>reset south</code>” part clears migration records for ALL apps, so make sure you either run the other two lines for all apps or delete selectively).</p> <p>The <code>convert_to_south</code> call at the end makes a new migration and fake-applies it (since your database already has the corresponding tables). There's no need to drop all the app tables during the process.</p> </blockquote> <p>Here's what I'm doing on my dev + production server when I need to get rid of all these unneeded dev migrations: </p> <ol> <li>Make sure we have the same DB schema on both sides</li> <li>delete every migrations folder on both sides</li> <li>run ./manage.py reset south (as the post says) on both sides = clears the south table *</li> <li>run ./manage.py <strong>convert_to_south</strong> on both sides (faking 0001 migration)</li> <li>then I can re-start to make migrations and push the migrations folders on my server</li> </ol> <p>* except if you want to clean only one app among others, if so you'll need to edit your south_history table and delete only the entries about your app.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload