Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The app you need is <a href="http://south.aeracode.org/" rel="nofollow noreferrer">South</a><br> Here are the steps (refer to the doc for more details) : </p> <pre><code>./manage.py convert_to_south yourapp </code></pre> <p>this will create a migration folder and fake a first migration </p> <p>Then add a <code>new_dateOfJoin</code> DateField in your models.py :</p> <pre><code>./manage.py migrate yourapp </code></pre> <p>this will create and apply immediatly a migration (named 0002_...) to add this field in the db</p> <p>Create a <a href="http://south.aeracode.org/docs/tutorial/part3.html#data-migrations" rel="nofollow noreferrer">datamigration 0003 file</a> where you will just cast your text value to date and save it in your new field Then apply this migration :</p> <pre><code>./manage.py migrate yourapp </code></pre> <p>Modify your models.py file to comment out the old datefield and migrate again (this will create the 0004_.... migration file)</p> <p>The last step is to rename the db field so you don't have to modify your existing code:</p> <pre><code>./manage.py schemamigration yourapp rename_dateofjoin --empty </code></pre> <p>This will create an empty schema migration file named <code>0005_rename_dateofjoin</code><br> Manually modify this 0005 file like explained <a href="https://stackoverflow.com/questions/2862979/easiest-way-to-rename-a-model-using-django-south">here</a> , but use <code>db.rename_column('app_foo', 'name', 'full_name')</code> like in <a href="https://stackoverflow.com/questions/3235995/django-how-to-rename-a-model-field-using-south">this other example</a>.</p> <p>Dropping your whole table instead of these 5 steps can be easier, but if you have multiple instance of the app (like a working production server and a develpement machine) you need this kind of tools.<br> With better understanding of South, one could also do this in less than 5 steps, but as migrations can be tricky to undone or reproduce sometimes, I prefer to have distinct steps...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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