You cannot have it both ways unless you trick web2py. You have to make web2py believe it created the tables.
0) use define_table(s) that correspond to the current table structure 1) replace the define_table migrate=False with migrate='someprefix_tablename.table' 2) replace the define_tables migrate=False with migrate='someprefix' 3) create a new empty MySQL database with no tables 4) connect to the new database instead of the old one 5) run appadmin (web2py will create the tables in the new database and the necessary metadata) 6) now connect to the new database (just change the db uri but leave migrate=... as they are). 7) web2py should be able to connect and believe the metadata belong to this db (since you have not changed the .table files) 8) now if change the tables definitions, web2py should be able to do migrations. On Jul 12, 6:32 am, Mico Siahaan <[email protected]> wrote: > Massimo, if I wrote migrate=False then no alteration do on the table, > right? But I want web2py to alter the table structure automatically. > > Thanks, > Mico > > On 7/9/09, mdipierro <[email protected]> wrote: > > > > > > > 1. implies you need migrate=False in both 6 and 7 > > > On Jul 8, 5:15 pm, "Mico Siahaan" <[email protected]> wrote: > >> Dear all, I and my friend make applications, use a sharing database. I am > >> using web2py and he is using Java. So: > >> 1. We create a database in MySQL > >> 2. Create a user and give access, alter privileges to that user > >> 3. Create tables in that database using phpmyadmin. Tables that will be > >> shared between us: member and member_program tables > >> 4. Launch web2py. > >> 5. Create application in web2py > >> 6. Edit db.py of application. I want to use member tables as table for > >> auth_user. So I add this in db.py: > >> auth.settings.table_user=db.define_table('MEMBER', SQLField('code', > >> 'string'), ..., migrate='happo.member') > >> auth.define_tables(migrate='happo') > >> 7. Accesss index of Appadmin.py. > >> Then web2py complained: 'table member already exists'. > >> Off course it exists and I want to use it. Then, how can I use existing > >> tables in a database? > > >> Regards, > >> Mico > > >> Powered by Telkomsel BlackBerry® > > -- > Sent from my mobile device > > Mico Siahaan > --- > Email: [email protected] --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

