Not sure about that -- check out
http://web2py.com/book/default/chapter/06#Fixing-Broken-Migrations.
On Friday, July 15, 2011 3:09:37 PM UTC-4, Jim S wrote:
> Ok, I updated my table def here to be
>
> Field('itemType', length=50, required=True, label='Item Type'),
>
> , ran with migrate=False, fake_migrate=True and everything works. When I
> remove migrate=False, fake_migrate=True, then I get the following traceback:
>
> Traceback (most recent call last):
> File "gluon/restricted.py", line 184, in restricted
> File "C:/dev/web2py/applications/InfoCenter/models/db.py"
> <http://127.0.0.1:8000/admin/default/edit/InfoCenter/models/db.py>, line 372,
> in <module>
> File "gluon/dal.py", line 4213, in define_table
> File "gluon/dal.py", line 641, in create_table
> File "gluon/dal.py", line 696, in migrate_table
> File "gluon/dal.py", line 4570, in __getitem__
> KeyError: 'itemtype'
>
>
> Thoughts?
>
> -Jim
>
>
> On 7/15/2011 1:05 PM, Jim Steil wrote:
>
> Found this one myself. Don't use 'list:string'. This is just a regular
> string field.
>
> On 7/15/2011 12:55 PM, Jim Steil wrote:
>
> Hi
>
> Having another problem today with the following:
>
> table defined as:
>
> priceBackerItem = db.define_table('priceBackerItem',
> Field('priceBackerItemId', 'id'),
> Field('priceBackerId', db.priceBacker, required=True,
> label='Price Backer'),
> Field('itemType', 'list:string', required=True, label='Item
> Type'),
> Field('sequence', 'integer'),
> Field('description', 'text'),
> Field('price', 'decimal(9,2)', label='15-Day Price'),
> Field('subscript', 'text'))
>
> priceBackerItem.priceBackerItemId.requires = IS_NOT_EMPTY()
> priceBackerItem.itemType.requires = IS_IN_SET(['Special Formulation Price
> Adjustment',
> 'Medication Price Adjustment'],
> zero='choose one',multiple=False)
>
> Using CRUD, when the update form displays, it never displays the current
> value of item type. The reason is (my best guess) that when I look in the
> database (mysql), I see the values as:
>
> |Medication Price Adjustment| or
> |Special Formulation Price Adjustment|
>
> ...including the vertical lines in the text.
>
> Any advice?
>
> -Jim
>
>