I'm using hg tip and can't add a column to a table. It figures out
what to do, but doesn't alter the postgresql database. Then any
commands that need to use that column fail.

It was able to create the table in the first place, but cannot add a
column now that the table has been created. How should I debug this?

Here's more detail:

== Step 1 ==

db.py:

      db.define_table('hits_log',
                db.Field('hitid', 'text'),
                db.Field('creation_time', 'datetime'))

.table file:

      {'creation_time': 'TIMESTAMP', 'hitid': 'TEXT', 'id': 'SERIAL
PRIMARY KEY'}

postgresql schema:

   id            | integer                     | not null default
nextval('hits_log_id_seq'::regclass)
   hitid         | text                        |
   creation_time | timestamp without time zone |
  Indexes:
      "hits_log_pkey" PRIMARY KEY, btree (id)


== Step 2 ==
Now I add a column "xmlbody":

      db.define_table('hits_log',
                db.Field('hitid', 'text'),
                db.Field('creation_time', 'datetime'),
                db.Field('xmlbody', 'text'))

I re-run web2py with:
     python web2py.py -a 'foo' -i lovebox.local

I load a controller function. But it hasn't updated my postgresql
schema:

   id            | integer                     | not null default
nextval('hits_log_id_seq'::regclass)
   hitid         | text                        |
   creation_time | timestamp without time zone |
  Indexes:
      "hits_log_pkey" PRIMARY KEY, btree (id)

even though the .table file is updated:

  {'creation_time': 'TIMESTAMP',
   'hitid': 'TEXT',
   'id': 'SERIAL PRIMARY KEY',
   'xmlbody': 'TEXT'}

and sql.log now has:
   ALTER TABLE hits_log ADD xmlbody TEXT;
-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.


Reply via email to