From cb2591d0b1276f92e88638d547123b788a6cae64 Mon Sep 17 00:00:00 2001 From: Sanj Date: Tue, 7 Feb 2012 15:32:52 +0530 Subject: [PATCH] db changes for display name, slug, etc. + db migration --- chaloBEST/mumbai/models.py | 10 +++++++++ requirements.txt | 3 ++- sqldiff/sqldiff070212.sql | 43 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 sqldiff/sqldiff070212.sql diff --git a/chaloBEST/mumbai/models.py b/chaloBEST/mumbai/models.py index ca8386b..0e8547e 100644 --- a/chaloBEST/mumbai/models.py +++ b/chaloBEST/mumbai/models.py @@ -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): diff --git a/requirements.txt b/requirements.txt index c5bf053..a239605 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 diff --git a/sqldiff/sqldiff070212.sql b/sqldiff/sqldiff070212.sql new file mode 100644 index 0000000..bf4cb86 --- /dev/null +++ b/sqldiff/sqldiff070212.sql @@ -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;