Migrations broken in hg tip?

4 views
Skip to first unread message

Michael Toomim

unread,
Jan 6, 2010, 4:00:45 AM1/6/10
to web2py-users
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;

mdipierro

unread,
Jan 6, 2010, 10:30:16 AM1/6/10
to web2py-users
Did you get any operational error at all?

Michael Toomim

unread,
Jan 6, 2010, 4:46:01 PM1/6/10
to web2py-users
Nope. On step 2, when I run "python web2py ...", I get no errors at
all. It updates the .table file and sql.log, does not change the DB,
and gives me no errors.
Reply all
Reply to author
Forward
0 new messages