[web2py] Re: migrate=True not creating table ?

2017-10-31 Thread Dave S


On Tuesday, October 31, 2017 at 3:18:01 AM UTC-7, Oasis Agano wrote:
>
> Hi 
>
> I have the same issue, i have  changed migrate to* 
> migrate='tablename.table'*,
> deleted the *tablename.table* inside the database folder,
> set *fake_migrations to true* but the issue is still appearing.
>
> In the appadmin section of w2p i can see the table but when i open it the 
> error appears"
>
> raise errorclass, errorvalue
> ProgrammingError: (1146, "Table 'database.table' doesn't exist")
> "
>
> and inside the mysql console the table is indeed not there.
>
> Im i missing something?
>
>
I'm not answering directly, sorry.
You've probably read these parts of the user manual already, but in case 
others find this old thread in a search,
I want the links to be here.





/dps

 

>
>
> On Tuesday, August 23, 2011 at 5:17:54 PM UTC+2, TomPliss wrote:
>>
>> Hey (noob here again), 
>>
>>
>> I needed to change the type of a field in my DB (the Date one of a 
>> table was a string, i'm changing its require to IS_DATE). 
>> but the values for existing entries were "wrong" (string has no 
>> attribute year), so went on "oh, only tests are in this table, let's 
>> drop it", and drop it in the sqlite I got, watching the DB. 
>>
>> So I get my DB, with a table not here. 
>> I restart the web2py server, but the table still isn't here. I save 
>> the model.py, restart (with the side sqlite off), still not here. 
>>
>> I checked in the book, chapter 06, "By default, migrate is set to 
>> True". Isn't that what tells web2py to create the table, if it doesn't 
>> exist ? 
>>
>> What am I missing ?
>
>
>

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


[web2py] Re: migrate=True not creating table ?

2011-08-24 Thread TomPliss
Already tried it, did not worked (and just did, still not working).
Isn't it for modifying the table only, and not when creating a new
one ?

I mean, after deleting the table I wanted to change,
I thought it's normal for the migrate=False,fake_migrate=True not to
work, isn't it ?

On Aug 23, 5:22 pm, Richard Vézina ml.richard.vez...@gmail.com
wrote:
 set it :

 migrate=False,fake_migrate=True

 http://www.web2py.com/book/default/chapter/06?search=fake#Fixing-Brok...

 Then it F5 to refresh your page...

 It should correct your database schema... You can potentially lost
 data you have entered so, make sure you backup everything if important
 before doing that.

 Richard







 On Tue, Aug 23, 2011 at 11:17 AM, TomPliss tompl...@gmail.com wrote:
  Hey (noob here again),

  I needed to change the type of a field in my DB (the Date one of a
  table was a string, i'm changing its require to IS_DATE).
  but the values for existing entries were wrong (string has no
  attribute year), so went on oh, only tests are in this table, let's
  drop it, and drop it in the sqlite I got, watching the DB.

  So I get my DB, with a table not here.
  I restart the web2py server, but the table still isn't here. I save
  the model.py, restart (with the side sqlite off), still not here.

  I checked in the book, chapter 06, By default, migrate is set to
  True. Isn't that what tells web2py to create the table, if it doesn't
  exist ?

  What am I missing ?


[web2py] Re: migrate=True not creating table ?

2011-08-24 Thread ron_m
In this situation look in the application/databases directory for a file with 
the table name as part of the file name. Remove or move the file somewhere else 
and then restart the web2py server. The table should now reappear and will be 
empty.


[web2py] Re: migrate=True not creating table ?

2011-08-24 Thread annet
Hi Tom,

Did you remove the table's .table file from the databases folder?

The way I proceed this problem is:

In the database's management tool delete/drop the table;
Trash the table's .table file in the databases folder;
In db.py set migrate to migrate='tablename.table'
Save db.py
Return to admin/default/design/appname
Go to the database administration
Return to db.py to set migrate to migrate=False


Kind regards,

Annet.


[web2py] Re: migrate=True not creating table ?

2011-08-24 Thread TomPliss
It's nearly working !

The table was dropped, I renamed the .table file, got
migrate='tabename.table', saved model.py and restarted the server.
I get this error :

class 'sqlite3.OperationalError'(near IGNORE: syntax error)

at the last field of the missing table line :
Field('FIN_CO1', label='Documentations', writable=False),
migrate='ficheIntervention.table')

with this Function argument list :
(self=gluon.dal.SQLiteAdapter object at 0x019E2EB0, *a=('CREATE
TABLE ficheIntervention(\n id INTEGER P...,\n FIN_VIS CHAR(512),\n
FIN_CO1 CHAR(512)\n);',), **b={})


It seems web2py is trying to create the table (Yay !), but not
succeeding.
The only ignore word I have in the database come from the 
ondelete='ignore'  I have on every reference in my table,
and it didn't prevent web2py from working before (worked for a week
with it, just fine, and with  ondelete='ignore'  active).


Any idea about what is happening ?

On Aug 24, 8:49 am, annet annet.verm...@gmail.com wrote:
 Hi Tom,

 Did you remove the table's .table file from the databases folder?

 The way I proceed this problem is:

 In the database's management tool delete/drop the table;
 Trash the table's .table file in the databases folder;
 In db.py set migrate to migrate='tablename.table'
 Save db.py
 Return to admin/default/design/appname
 Go to the database administration
 Return to db.py to set migrate to migrate=False

 Kind regards,

 Annet.


[web2py] Re: migrate=True not creating table ?

2011-08-24 Thread TomPliss
Getting the  ondelete='ignore'  away from the missing table
declaration let web2py create it.

The problem is I want the  ondelete='ignore' to be here, so I'm
putting it back.


Another problem :
The DATE field seems to cause errors, when trying to read it. I'm
gettign an error :
type 'exceptions.AttributeError'('str' object has no attribute
'year')
when trying to show it in a SQLTable, or when filling a SQLForm with
an existing record.
In the Database, the field has written the date as 2007-06-05.

Err ... are DATE working correctly ?
Am I missing something (again) ?


[web2py] Re: migrate=True not creating table ?

2011-08-24 Thread annet

 The only ignore word I have in the database come from the 
 ondelete='ignore'  I have on every reference in my table,
 and it didn't prevent web2py from working before (worked for a week
 with it, just fine, and with  ondelete='ignore'  active).

 Any idea about what is happening ?

What happens if you set ondelete=IGNORE to ondelete=NO ACTION.?


[web2py] Re: migrate=True not creating table ?

2011-08-24 Thread TomPliss
thanks about the ondelete=NO ACTION, it's working !
actually, even ondelete=ignore works, if it is added after the table
is created (even if it is not in the book).

I still have the DATE error, unfortunatly, and don't know if it is
related to the table creation problem...

On Aug 24, 9:51 am, annet annet.verm...@gmail.com wrote:
  The only ignore word I have in the database come from the 
  ondelete='ignore'  I have on every reference in my table,
  and it didn't prevent web2py from working before (worked for a week
  with it, just fine, and with  ondelete='ignore'  active).

  Any idea about what is happening ?

 What happens if you set ondelete=IGNORE to ondelete=NO ACTION.?


[web2py] Re: migrate=True not creating table ?

2011-08-24 Thread TomPliss
Hum, actually, it's not working as I thought...
I thought there was an value for the ondelete option that would force
web2py to delete the reference when the referenced object is deleted,
but not to delete de referencing object...
from what I just read in the book, there isn't :(

Anyway, the DATE error ...
Where should it come from ?


[web2py] Re: migrate=True not creating table ?

2011-08-24 Thread annet
In your table definition the date field should be defined like this:

Field('some_date',type='date')

... and the validator:

db.table.some_date.requires=IS_DATE(str(T('%Y-%m-%d')))


Hope this helps you solve the problem.


[web2py] Re: migrate=True not creating table ?

2011-08-24 Thread TomPliss
OK ... now, I feel silly ...

On Aug 24, 10:30 am, annet annet.verm...@gmail.com wrote:
 In your table definition the date field should be defined like this:

 Field('some_date',type='date')

 ... and the validator:

 db.table.some_date.requires=IS_DATE(str(T('%Y-%m-%d')))

 Hope this helps you solve the problem.