emmett-framework / emmett

The web framework for inventors
BSD 3-Clause "New" or "Revised" License
1.06k stars 71 forks source link

using mysql database #84

Closed juniverse76 closed 8 years ago

juniverse76 commented 8 years ago

hi, @gi0baro,

I'm already writing another issue in one day. I guess this library is easy for me to use, thanks to you. Well, here is the issue.

When using weppy with mysql, AuthUser and AuthGroup seems to create a problem. Using as is, mysql database raises error 1071. I do not know the exact nature of the problem and the correct method to solve this, since I do not have any knowledge of database. I just know how to select. Anyways, after series of searches, there is an issue with length of field that is UNIQUE in mysql. The error 1071 is about that, and that is the length should not be longer than 767 bytes. And it seems using utf-8, mysql is hardcoded to multiply 3 to the length, so not to exceed the limit, UNIQUE field length need to be less than equal to 255. So, the issue with weppy is that in tools/auth/models.py, AuthUser (AuthUserBasic to be precise) and AuthGroup each has one field that is UNIQUE and has length 512. (AuthUserBasic.email, AuthGroup.role) And these two create error when using mysql. Again, I'm following through bloggy example.

Thank.