Probably the code for dropping columns was never updated to handle rnames. Please submit an issue in the pydal repo: https://github.com/web2py/pydal/issues.
Anthony On Wednesday, May 31, 2017 at 11:48:24 AM UTC-4, Doug Taylor wrote: > > Hi I'm a relative noob to web2py and python - but plenty of dev > experience. Must say it has been a smooth learning curve for me and most > stuff just works out the box... thanks Massimo! > > Pretty sure I found a bug here though. Running on ubuntu Xenial, > postgresql 9.6 with psycopg2. I have a table defined thus: > > db.define_table('FileServer', > Field('HostName', rname='host_name', type='string', length=32, > label='Host', comment='The Host Name of the Server on the network'), > Field('Address', rname='file_server_address', type='string', > length=32, label='Address', comment='The Address of the Server'), > Field('CommissioningDate', rname='file_server_comm_date', > type='date', label='Commissioning Date', comment='The date on which the > Server was commissioned (YYYY-MM-DD)'), > Field('OS', rname='file_server_os', type='string', length=32, > label='OS', comment='The Operating System running on the Server'), > audit, > rname='file_server', > format='%(HostName)s', > singular='Server', > plural='Servers', > migrate=True) > > Decided to drop the OS column and create a new relation for it instead. > The migration fails with "relation fileserver does not exist". Went to look > in my sql.log file and found these entries: > > from run previous when table is created > > timestamp: 2017-05-30T13:10:09.134114 > CREATE TABLE file_server( > id SERIAL PRIMARY KEY, > host_name VARCHAR(32), > file_server_address VARCHAR(32), > file_server_comm_date DATE, > file_server_os VARCHAR(32), > created_on TIMESTAMP, > created_by INTEGER REFERENCES auth_user (id) ON DELETE CASCADE , > updated_on TIMESTAMP, > updated_by INTEGER REFERENCES auth_user (id) ON DELETE CASCADE , > is_validated CHAR(1), > is_active CHAR(1) > ); > success! > > > when I kick off the migration > > timestamp: 2017-05-31T15:43:53.289791 > ALTER TABLE FileServer DROP COLUMN os; > > notice that rname is specified in define_table (highlighted above) > > Seems the migration code observes rname for table creation (table and > column name) but not dropping the column where ALTER TABLE uses the Table > and Field names in the SQL?? I find it hard to believe that such a mature > product could suffer such a basic bug. Not sure this is the place to report > it. Somebody direct me to the right forum? > > Having a whale of a time otherwise \m/ > -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.