Just some thought not solution... Maybe you could try to decouple your data
from your table, by doing so you then will be able to flush the entire
model instead of just modify it (ALTER), that way you will avoid the issue
with rname.

You can use this trick to decouple your basic required data :

 if db(db.phone_number).count() == 0:
    db.phone_number.insert(phone_number='123-456-7890',
                                            extension='0')
    db.phone_number.insert(phone_number='987-654-3210',
                                            extension='0')

To drop and recreate your model you can comment it, hit a page, it gonna
make a request and since models file are all executed at eache request you
db schema should be dropped. Then un comment after fix the field name at
your convenience. It should work, it is not work you may consider dropping
your table in the database directly.

If you have already input your data set into your database I am sure you
can easily extract them and generate a bunch of web2py insert
programmatically.

This could be the besting move you ever done, I mean decouple your data
from you model and keep it out of the way of your database modeling.

You must remove those if and insert statement once you push into production
as it generates a count request for each table on which you set this
fixture, which represent a major slow down.

Richard

On Tue, Jun 6, 2017 at 2:36 AM, Doug Taylor <[email protected]> wrote:

> This is becoming a show-stopper for me now as I cannot ADD fields to an
> exiting table either. I'm pretty sure adding fields worked before when I
> was running on Windows. Made the transition to Linux on my office desktop
> recently and that was when I first encountered the problem. Adding the
> field LocalMountPoint (rname='storage_local_mount'):
>
> self.db.define_table('StorageVolume',
>             Field('VolumeName', rname='storage_volume_name',
> type='string', length=32, label='Volume', comment='The name of the Storage
> Volume'),
>             Field('FileServerId', rname='storage_volume_server_id',
> type='reference FileServer', ondelete='CASCADE', label='Server',
> comment='The Server on which the Storage Volume resides'),
>             Field('StorageUri', rname='storage_uri', type='string',
> length=256, label='Storage URI', comment='The URI of the Storage Volume'),
>             Field('LocalMountPoint', rname='storage_local_mount',
> type='string', length=256, label='Local Mount Point', comment='The local
> mount point of the Storage Volume'),
>             audit,
>             rname='storage_volume',
>             format='%(VolumeName)s',
>             singular='Volume',
>             plural='Volumes',
>             migrate=True)
>         self.db.commit()
>
> results in:
>
> ALTER TABLE storage_volume ADD localmountpoint VARCHAR(256);
> success!
>
> Aaaargh! Can anyone give feedback on how long this may take to fix? Can
> someone give me some pointers so I can fix it myself? As I said, bit of a
> noob to python and web2py... but how hard can it be? :)
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to