[web2py] Re: MySQL - OperationalError: Error on rename (errno: 150)

2014-07-06 Thread José Antonio Salazar Montenegro
I realize this is an ancient topic, but I'm having the very same error 
migrating a MySQL table where I'm only removing a self reference field.

It seems like an index was created to guard the (self) foreign-key 
constraint and DAL doesn't remove it when deleting the field.
There are no manually-created indexes on my database, all were created 
automatically.

Just wondering if this was fixed.

On Monday, July 20, 2009 12:05:44 PM UTC-5, David Zejda wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Hello,

 my db backend is MySQL 5.0.51a-24 on Linux.

 If I try to gently alter already generated table schema, like to rename

 SQLField('relation', 'text', requires = \
IS_NULL_OR(IS_IN_DB(db, 'relation_type.id', 'relation_type.id',
 multiple=True)))

 to

 SQLField('relation_type', 'text', requires = \
IS_NULL_OR(IS_IN_DB(db, 'relation_type.id', 'relation_type.id',
 multiple=True)))

 i get this:

 Traceback (most recent call last):
   File /home/zejdad/!a/jfind/web2py/gluon/restricted.py, line 98, in
 restricted
 exec ccode in environment
   File /home/zejdad/!a/jfind/web2py/applications/jfind/models/db.py,
 line 346, in module
 migrate=person
   File /home/zejdad/!a/jfind/web2py/gluon/sql.py, line 938, in
 define_table
 raise e
 OperationalError: (1025, Error on rename of './jfind/#sql-ac1_5e' to
 './jfind/person' (errno: 150))

 Maybe, it is related to the troubles mentioned there:

 http://forums.mysql.com/read.php?22,95361

 Please, do you have any experiences with a such type of errors?

 I would like to test it with MyISAM instead of InnoDB tables, but it is
 not easy to change it in already generated and interrelated tables:

 ALTER TABLE `person` ENGINE = MYISAM

 #1217 - Cannot delete or update a parent row: a foreign key constraint
 fails

 Or should I try other MySQL version?

 Thank you for advices!

 David
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.9 (GNU/Linux)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

 iEYEARECAAYFAkpko+cACgkQ3oCkkciamVF3nACfdej9+FBUseSRBgMtJyBm0elR
 wKUAnjx/qSTnNzG+Dr47AKmHm40PxJUK
 =HqDy
 -END PGP SIGNATURE-



-- 
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] How to make SQLFORM generate INPUT type as 'date' instead 'text'

2014-05-09 Thread José Antonio Salazar Montenegro
My field is defined in db.py as
Field('mydate', type='date', requires=IS_DATE(format=T('%Y-%m-%d'))),

Using a custom FORM() I only need to do this:
INPUT(_type='date', _name='mydate')

To generate a great YMD INPUT with pop-up calendar and selectable date 
parts:
form
...
input name=ingreso type=date
...
/form

Now I want to use SQLFORM instead of FORM, but it generates the INPUT as 
text:
form
...
input name=ingreso type=text
...
/form


How can I make SQLFORM to generate INPUT type as date instead of text?

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