Specify the model as you want it. If that model is consistent with the
current state of the database, run the code once with fake_migrate so
web2py will update the migration metadata. If that model is not consistent
with the database, then delete the relevant *.table file and run the code
with a regular migration so web2py will create any missing fields.
Anthony
On Sunday, February 7, 2016 at 11:56:13 PM UTC-5, Alex Glaros wrote:
>
> same results regardless of table or field. Example below where new field
> is added at bottom:
>
> BEFORE
>
> db.define_table('Reputation',
> Field('reputation_code', 'string'),
> Field('reputation_description', 'string'))
>
> AFTER
>
> db.define_table('Reputation',
> Field('reputation_code', 'string'),
> Field('reputation_description', 'string'),
> Field('reputation_comments', 'string'))
>
> On Sun, Feb 7, 2016 at 8:43 PM, Anthony <[email protected]> wrote:
>
>> We need to see the model code.
>>
>>
>> On Sunday, February 7, 2016 at 10:46:17 PM UTC-5, Alex Glaros wrote:
>>>
>>> For db connection I've used every combination possbile below
>>> (migrate_enabled=True, fake_migrate, etc.) including every combination of
>>> deleting or leaving table w2p databases folder, dropping the table from
>>> Postgres, dropping from web2py, etc.
>>>
>>> db = DAL('postgres://postgres:MyPasswordlocalhost:5432/postgres',
>>> pool_size=1,check_reserved=['all'], migrate_enabled=True,
>>> lazy_tables=False, fake_migrate_all = False) #migrate=False #
>>> fake_migrate_all = True #fake_migrate=True,
>>>
>>> It doesn't matter which table I use, if I add a column in db.py (with
>>> migrate_enabled=True, which is what always worked with sqLite), it doesn't
>>> get added in either w2p or the Postgres table. No errors, just doesn't
>>> appear as a new field.
>>>
>>> If I use fake_migrate = True, error is: <class
>>> 'psycopg2.ProgrammingError'> column "reputation_comments" of relation
>>> "reputation" does not exist
>>>
>>> sql.log below shows new column added, then inexplicably deleted without
>>> any action on my part.
>>>
>>> timestamp: 2016-02-07T18:48:25.390000
>>> ALTER TABLE Reputation ADD reputation_comments VARCHAR(512);
>>> faked!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> success!
>>> timestamp: 2016-02-07T18:48:29.605000
>>> ALTER TABLE Reputation DROP COLUMN reputation_comments;
>>>
>>> thanks,
>>>
>>> Alex Glaros
>>>
>> --
>> 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 a topic in the
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/web2py/YfeaAMef33c/unsubscribe.
>> To unsubscribe from this group and all its topics, 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.