db changes for display name, slug, etc. + db migration

This commit is contained in:
Sanj 2012-02-07 15:32:52 +05:30
parent 0640f84a4f
commit cb2591d0b1
3 changed files with 55 additions and 1 deletions

View File

@ -40,8 +40,10 @@ SCHED = {
class Area(models.Model):
code = models.IntegerField() #primary_key=True)
slug = models.SlugField(null=True)
name = models.TextField(blank=True, max_length=255)
name_mr= models.TextField(null=True, blank=True, max_length=512) #null=True,
display_name = models.TextField(blank=True, max_length=255)
geometry = models.PolygonField(blank=True, null=True)
def __unicode__(self):
@ -50,8 +52,10 @@ class Area(models.Model):
class Road(models.Model):
code = models.IntegerField()#primary_key=True)
slug = models.SlugField(null=True)
name = models.TextField(blank=True, max_length=255)
name_mr= models.TextField(null=True, blank=True, max_length=512)
display_name = models.TextField(blank=True, max_length=255)
geometry = models.LineStringField(blank=True, null=True)
def __unicode__(self):
return self.name
@ -70,13 +74,16 @@ class Fare(models.Model):
class Stop(models.Model):
code = models.IntegerField()
slug = models.SlugField(null=True)
name = models.TextField(blank=True, max_length=255)
display_name = models.TextField(blank=True, max_length=255)
dbdirection = models.CharField(null=True, blank=True, max_length=5, choices=STOP_CHOICES) #stopfl - > direction
chowki = models.NullBooleanField(null=True, blank=True) # this is nullable since in the next datafeed , they might have blank to represent a 0.
road = models.ForeignKey(Road, default=None, null=True, blank=True)
area = models.ForeignKey(Area, default=None, null=True, blank=True)
depot = models.ForeignKey("Depot", default=None, null=True, blank=True, related_name="is_depot_for") #models.CharField(null=True, blank=True, max_length=5)
name_mr= models.TextField(null=True, blank=True, max_length=512)#null=True,
point = models.PointField(null=True)
def __unicode__(self):
return self.name
@ -84,6 +91,7 @@ class Stop(models.Model):
class Route(models.Model):
code = models.TextField(max_length=255, unique=True)
slug = models.SlugField(null=True)
alias = models.TextField(max_length=255)
from_stop_txt = models.TextField(max_length=500)
to_stop_txt = models.TextField(max_length=500)
@ -176,9 +184,11 @@ class HardCodedRoute(models.Model):
class Landmark(models.Model):
slug = models.SlugField(null=True)
name = models.TextField(max_length=500, blank=True, null=True)
stops = models.ManyToManyField(Stop, related_name='is_near_to')
name_mr = models.TextField(max_length=512, blank=True, null=True)
display_name = models.TextField(blank=True, max_length=255)
point = models.PointField(blank=True, null=True)
def __unicode__(self):

View File

@ -2,5 +2,6 @@
#-e svn+http://code.djangoproject.com/svn/django/trunk/#egg=django
-e bzr+http://code.0x2620.org/python-ox/#egg=python-ox
-e git+git://github.com/seatgeek/fuzzywuzzy.git#egg=fuzzywuzzy
django_extensions
-e git+git://github.com/bit/django-extensions.git#egg=django_extensions
#django_extensions
django-grappelli

43
sqldiff/sqldiff070212.sql Normal file
View File

@ -0,0 +1,43 @@
BEGIN;
ALTER TABLE "mumbai_area"
ADD "display_name" text;
ALTER TABLE "mumbai_area"
ADD "slug" varchar(50);
CREATE INDEX "mumbai_area_slug_idx"
ON "mumbai_area" ("slug");
-- Comment: Unknown database type for field 'geometry' (16394)
-- Model: Road
ALTER TABLE "mumbai_road"
ADD "display_name" text;
ALTER TABLE "mumbai_road"
ADD "slug" varchar(50);
CREATE INDEX "mumbai_road_slug_idx"
ON "mumbai_road" ("slug");
-- Comment: Unknown database type for field 'geometry' (16394)
-- Model: Stop
ALTER TABLE "mumbai_stop"
ADD "display_name" text;
ALTER TABLE "mumbai_stop"
ADD "slug" varchar(50);
CREATE INDEX "mumbai_stop_slug_idx"
ON "mumbai_stop" ("slug");
-- Comment: Unknown database type for field 'point' (16394)
-- Model: Route
ALTER TABLE "mumbai_route"
ADD "slug" varchar(50);
CREATE INDEX "mumbai_route_slug_idx"
ON "mumbai_route" ("slug");
-- Model: RouteDetail
ALTER TABLE "mumbai_routedetail"
ADD "route_code" text;
-- Model: Landmark
ALTER TABLE "mumbai_landmark"
ADD "display_name" text;
ALTER TABLE "mumbai_landmark"
ADD "slug" varchar(50);
CREATE INDEX "mumbai_landmark_slug_idx"
ON "mumbai_landmark" ("slug");
-- Comment: Unknown database type for field 'point' (16394)
-- Model: StopLocation
-- Comment: Unknown database type for field 'point' (16394)
COMMIT;