Thanks pal, it's not my first, probably won't be not my last, and surely 
it's not my best. 
The book 
has 
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Migration-control-summary
 
. 
This is one of the areas that I can't explain better probably because to me 
it's straightforward, but less experienced users have a hard time with it.
Feel free to send a PR on the book if you figure out a better rephrasing: 
from someone that didn't know it and recently grasped it it may come 
something that is more useful to people stuck with it.

On Friday, January 29, 2016 at 8:12:56 PM UTC+1, Dave S wrote:
>
>
>
> On Friday, January 29, 2016 at 2:11:38 AM UTC-8, Niphlod wrote:
>>
>> web2py doesn't do database introspection.
>> it basically works like this.
>>
>> whooo, someone defined a table in the model..... are migrations turned on 
>> ? 
>> if yes
>>      is there a corresponding .table file ?
>>            if yes
>>                inspect the file and see if it matches table definition
>>                if matches table definition ?
>>                    don't do anything
>>                if not mathes table definition alter the table accordingly
>>           if not
>>                 go ahead and create the table
>> if not
>>     don't do anything
>>
>> so..... migrations turned on, tables created on the database.... you drop 
>> .table files --> web2py assumes it has to recreate those.
>> to fix the issue, set fake_migrate_all, which instructs web2py to do 
>> nothing on the backend and just recreate .table files.
>> then set fake_migrate_all=False and continue to play with the database.
>> once in production with no further playing with models, just set 
>> migrate=False. 
>>
>>
>>
>
> I've put a star on this one for my own use, as I think it's the best 
> explanation I've seen yet.
>
>  /dps
>
>
>> On Friday, January 29, 2016 at 9:27:57 AM UTC+1, Tom Campbell wrote:
>>>
>>> App is on pythonanywhere, using Postgres. Connect string is:
>>>
>>>     db = DAL('postgres://
>>> web2pydbadmin:[email protected]:10096/mydatabase
>>> ')
>>>
>>> Existing topics like 
>>> https://groups.google.com/forum/#!topic/web2py/p740UJkR3Ao do not seem 
>>> to have helpful info.
>>>
>>> I admit I lost my temper and deleted everything in /databases out of 
>>> range and frustration (and the same error appears). I figured web2py would 
>>> just rebuild tables if necessary.
>>>
>>> I seem to be an absolutely shit database administrator (gave up on GAE 
>>> altogether) and would be happy to hire someone who has experienced this 
>>> problem using postgresql on pythonanywhere.
>>>
>>

-- 
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