Ticket #337: commandline_history.txt

File commandline_history.txt, 6.3 KB (added by barnaby@…, 4 years ago)

Commandline History of how I discovered bug #337

Line 
1#The following is the output of my commandline history:
2#I show what the database was, I run the migration, I show what happened to the database (e.g. not all the fields it claimed were added, were actually added).
3#Then I show the diff to my model
4
5
6
7
8(gov2virtualenv)hendrixski@hendrixski:~/rubbercan$ psql rubbercan
9Welcome to psql 8.3.8, the PostgreSQL interactive terminal.
10
11rubbercan=# \d rubbercan_profiles_profile
12                                     Table "public.rubbercan_profiles_profile"
13     Column      |          Type          |                                Modifiers                               
14-----------------+------------------------+-------------------------------------------------------------------------
15 status          | integer                | not null default 2
16 city            | character varying(40)  |
17 website         | character varying(200) |
18 name            | character varying(50)  |
19 doesCollision   | boolean                | not null default false
20 zipCode         | integer                |
21 doesOther       | character varying(40)  |
22 doesMaintenance | boolean                | not null default false
23 doesFailure     | boolean                | not null default false
24 street          | character varying(50)  |
25 user_id         | integer                | not null
26 ASECertified    | boolean                | not null default false
27 about           | text                   |
28 id              | integer                | not null default nextval('rubbercan_profiles_profile_id_seq'::regclass)
29Indexes:
30    "rubbercan_profiles_profile_pkey" PRIMARY KEY, btree (id)
31    "rubbercan_profiles_profile_user_id_key" UNIQUE, btree (user_id)
32Foreign-key constraints:
33    "user_id_refs_id_542c4cf" FOREIGN KEY (user_id) REFERENCES auth_user(id) DEFERRABLE INITIALLY DEFERRED
34
35rubbercan=# \q
36(gov2virtualenv)hendrixski@hendrixski:~/rubbercan$ python manage.py migrate rubbercan_profiles 0002
37/home/hendrixski/gov2virtualenv/lib/python2.6/site-packages/pytz/__init__.py:32: UserWarning: Module reviews was already imported from /home/hendrixski/rubbercan/apps/reviews/__init__.pyc, but /home/hendrixski/gov2virtualenv/lib/python2.6/site-packages/django_reviews-0.2.1-py2.6.egg is being added to sys.path
38  from pkg_resources import resource_stream
39 - Soft matched migration 0002 to 0002_extend_Profile.
40Running migrations for rubbercan_profiles:
41 - Migrating forwards to 0002_extend_Profile.
42 > rubbercan_profiles: 0002_extend_Profile
43   = ALTER TABLE "rubbercan_profiles_profile" ADD COLUMN "state" varchar(11) NULL; []
44   = SELECT AddGeometryColumn('rubbercan_profiles_profile', 'point', 4326, 'POINT', 2); []
45   = CREATE INDEX "rubbercan_profiles_profile_point_id" ON "rubbercan_profiles_profile" USING GIST ( "point" GIST_GEOMETRY_OPS ); []
46 - Loading initial data for rubbercan_profiles.
47
48(gov2virtualenv)hendrixski@hendrixski:~/rubbercan$ psql rubbercan
49Welcome to psql 8.3.8, the PostgreSQL interactive terminal.
50
51
52rubbercan=# \d rubbercan_profiles_profile
53                                     Table "public.rubbercan_profiles_profile"
54     Column      |          Type          |                                Modifiers                               
55-----------------+------------------------+-------------------------------------------------------------------------
56 status          | integer                | not null default 2
57 city            | character varying(40)  |
58 website         | character varying(200) |
59 name            | character varying(50)  |
60 doesCollision   | boolean                | not null default false
61 zipCode         | integer                |
62 doesOther       | character varying(40)  |
63 doesMaintenance | boolean                | not null default false
64 doesFailure     | boolean                | not null default false
65 street          | character varying(50)  |
66 user_id         | integer                | not null
67 ASECertified    | boolean                | not null default false
68 about           | text                   |
69 id              | integer                | not null default nextval('rubbercan_profiles_profile_id_seq'::regclass)
70 point           | geometry               |
71Indexes:
72    "rubbercan_profiles_profile_pkey" PRIMARY KEY, btree (id)
73    "rubbercan_profiles_profile_user_id_key" UNIQUE, btree (user_id)
74    "rubbercan_profiles_profile_point_id" gist (point)
75Check constraints:
76    "enforce_dims_point" CHECK (ndims(point) = 2)
77    "enforce_geotype_point" CHECK (geometrytype(point) = 'POINT'::text OR point IS NULL)
78    "enforce_srid_point" CHECK (srid(point) = 4326)
79Foreign-key constraints:
80    "user_id_refs_id_542c4cf" FOREIGN KEY (user_id) REFERENCES auth_user(id) DEFERRABLE INITIALLY DEFERRED
81
82rubbercan=# \q
83
84
85(gov2virtualenv)hendrixski@hendrixski:~/rubbercan$ git diff apps/rubbercan_profiles/models.py
86diff --git a/apps/rubbercan_profiles/models.py b/apps/rubbercan_profiles/models.py
87index a1ad91f..883bd13 100644
88--- a/apps/rubbercan_profiles/models.py
89+++ b/apps/rubbercan_profiles/models.py
90@@ -1,8 +1,11 @@
91-from django.db import models
92+from django.contrib.gis.db import models
93 from django.conf import settings
94 from django.contrib.auth.models import User
95+from django.contrib.gis.geos import Point
96 
97 class Profile(models.Model):
98 #for all users
99@@ -10,15 +13,16 @@ class Profile(models.Model):
100     name = models.CharField(_('Name'), max_length=50, null=True, blank=True, help_text="your name and address as it will appear on billing information")
101     street = models.CharField(_('Street address'), max_length=50, null=True, blank=True)
102     city = models.CharField(_('City'), max_length=40, null=True, blank=True)
103+    state = models.CharField(_('State'), max_length=11, null=True, blank=True)
104     zipCode = models.IntegerField(_('Zip Code'), max_length=5, null=True, blank=False)
105     name = models.CharField(_('Name'), max_length=50, null=True, blank=True, help_text="your name and address as it will appear on billing information")
106     street = models.CharField(_('Street address'), max_length=50, null=True, blank=True)
107     city = models.CharField(_('City'), max_length=40, null=True, blank=True)
108+    state = models.CharField(_('State'), max_length=11, null=True, blank=True)
109     zipCode = models.IntegerField(_('Zip Code'), max_length=5, null=True, blank=False)
110     
111+    point = models.PointField(null=True)
112+    objects = models.GeoManager()
113     
114