Massimo,

Here is an example of one of the tables that got a truncated field:

before...

db.define_table("thing",
    Field("user_id", db.auth_user, notnull=True, readable=False,
writable=False),
    Field("title", "string", length=128, notnull=True, unique=True,
required=True),
    Field("slug", "string", length=128, notnull=True, unique=True,
required=True),
    Field("state", "string", length=10, notnull=True, required=True,
default="created", requires=IS_IN_SET(("created", "started",
"completed"))),
    Field("description", "string", length=2048),
    Field("created", "datetime", notnull=True, readable=False,
writable=False, default=request.now),
    Field("updated", "datetime", readable=False, writable=False,
update=request.now),
    Field("uuid", "string", length=16, notnull=True, unique=True,
readable=False, writable=False),
    format="%(title)s"
)

after...

db.define_table("thing",
    Field("user_id", db.auth_user, notnull=True, readable=False,
writable=False),
    Field("title", "string", length=128, notnull=True, unique=True,
required=True),
    Field("slug", "string", length=128, notnull=True, unique=True,
required=True),
    Field("state", "string", length=10, notnull=True, required=True,
default="created", requires=IS_IN_SET(("created", "started",
"completed"))),
    Field("description", "string", length=2048),
    Field("things", "list:string"), # NEW FIELD
    Field("created", "datetime", notnull=True, readable=False,
writable=False, default=request.now),
    Field("updated", "datetime", readable=False, writable=False,
update=request.now),
    Field("uuid", "string", length=16, notnull=True, unique=True,
readable=False, writable=False),
    format="%(title)s"
)

After this change (addition of a new field) and subsequent DB
migration, the "description" field was truncated from 2048 characters
to 255.  Note that this change didn't alter the field length on
sqlite.  But it did truncate the description field on mysql.

On Jan 22, 10:55 am, Massimo Di Pierro <massimo.dipie...@gmail.com>
wrote:
> Can you tell us what the model was before and after migration?
>
> Massimo
>
> On Jan 22, 10:02 am, "Jonathan Z." <jzem...@gmail.com> wrote:
>
>
>
> > I have a number of fields specifying a length > 255 (some as large as
> > 2K).  On a recent schema migrate, web2py truncated all of these fields
> > to 255, resulting in substantial data loss.
>
> > My database is mysql.  I'm on version 1.91.6 of web2py.  I'm pretty
> > sure this has something to do with the new DAL.

Reply via email to