Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Django1.7 automated migrations like ruby on rails
1.
Django 1.7 - Something About migrations
By Anish Menon
2. About Me
NAME : Anish Menon
Hobby : Coding , Research on niche concepts , Open sourcing
Open source releases :
Django-Realtime
https://pypi.python.org/pypi/django-realtime
iShout.js
https://www.npmjs.com/package/ishout.js
Social :
facebook : https://www.facebook.com/3am.live
github : https://github.com/anishmenon
Stack overflow : http://stackoverflow.com/users/2127464
Quora : http://www.quora.com/Anish-Menon
CEO & Founder at Cognalys ,Inc. CTO Founder Inzane Technologies PVT.LTD
3. Scenario happened before Django 1.6 :
i was using PosgreSQL and PgAdmin III
First time
from django.db import models
class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)
python manage.py syncdb
Command created the tables according to my above models
4. Second Time
I have added additional Character field ‘description‘ to Poll model
Here
python manage.py syncdb
Will not do anything for me ?
from django.db import models
class Poll(models.Model):
question = models.CharField(max_length=200)
description = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)
I’ve gone to PgAdmin III and added new field , So and so . “EXTRA JOB” .
5. Third Time :
I saw an update on djangoproject.com that it has released Django 1.7 with migrations . So no need
of South integration
pip install django==1.7
python manage.py migrate
This one will modify the db without launching the database management tool ( eg : PgAdmin3 )
or querying Schema .
All operations like :
1 . Create columns / tables
2 . Edit /Delete all Fields
python manage.py makemigrations
This one will register all histories which will help to know the version of changes made to my
models