Drop and substitute a table in Django

March 26, 2011 | By Regaz | Filed in: Uncategorized.

If you need to modify your Django database tables after than you
are already done there are 2 different possibility:

If you are at the beginning of application perhaps best
is directly to DROP your table and to CREATE a new one.

Next three steps show you clearly how to make this change…

1) Delete the lines containing your table’s definition in models.py
2) Run

$ python manage.py syncdb

3) Fire a dbshell and DROP physically your table:

$ python manage.py dbshell

Do Not Forget to Take a Look…

VMWare VMware, Install VMware Tools, Install VMware Tools

The Extra Indications are Contained in this other Guide:
Climb the InfoWall

VMWare Tools, VMware Tools

Sviluppo Siti Web

Next you can insert your new table on models.py and execute syncdb.

But if you have already inserted enough data on that table surely you will mind to drop that, so there is the possibility of reshaping your table by adding a column.
For doing so now there is at your disposal “South”.
With that you can directly manage your migrations by adding and deleting some
columns and keep track of changes.
In the next post I will show you how to getting started to install and use
“South” on your projects.

All bests

Extra Indications are Contained in this other Guide:
Sviluppo Siti Web

Oracle Database, Oracle Database, Oracle Database

Drupal Website Development


QuickChic Theme • Powered by WordPress