production - db migration issue. Works in sqlite but not mysql

48 views
Skip to first unread message

Ron Chatterjee

unread,
May 15, 2019, 7:53:05 AM5/15/19
to web2py-users

Hello all,

In PA I am running this app with an existing mysql database and I am having migration issue.

If I run the db.py with db.migrate, it says

1050, "Table 'auth_user' already exists


If I run the table with migrate=False, and fake_migrate = True I get another error:

mytable.products' doesn't exist"



Products table below is not being generated in the mysql database. I did show tables and its not being populated.


 db.py
-------------

    db = DAL(configuration.get('db.uri'),
             pool_size=configuration.get('db.pool_size'),
             migrate_enabled=configuration.get('db.migrate'),
             check_reserved=['all'])





db.define_table("products",
                Field("product_title", "string", requires=IS_NOT_EMPTY() ,label='Product Title'),
                Field('Product_discription', 'text',requires=IS_NOT_EMPTY(),label='Product Discription'),
                Field("product_image", 'upload', label="Product Image"),
                Field("product_document", "upload", label='Product PDF Document'),
                Field('product_video', requires=IS_EMPTY_OR(IS_URL())),
                auth.signature)

João Matos

unread,
May 22, 2019, 12:04:09 PM5/22/19
to web2py-users
Don't use MySQL but try setting the migrate=False in the DAL creation (usually in models/db.py).
And add migrate=True to all your own tables (eg. products).
Reply all
Reply to author
Forward
0 new messages