Thanks to all of you How do I add migrate to the auth tables ? I use auth.settings.extra_fields for extra fields but entering migrate='db1_auth_user.table' does not fits in this structure I also tried: db.auth_user._migrate='db1_auth_user' just after the auth.settings.extra_fields but get an error 'DAL' object has no attribute 'auth_user'
On Sunday, January 6, 2019 at 2:57:15 PM UTC+1, Anthony wrote: > > I also attempted to use the fake_migrate_all=True ,migrate=False but none >> of the auth files was created. Only my own tables files >> 1. deleted all the databases folder files and set DAL's >> fake_migrate_all=True ,migrate=False >> 2. Only my tables files (in databases folder), and scheduler files (with >> the new hex prefix) was created. >> > > With migrate=False, fake_migrate and fake_migrate_all will do nothing -- > the above process would not create the *.table files for *any* of your > tables. Probably you already had the *.table files for your other tables at > that point, so it only *appeared* that the Auth files were skipped. If > you set fake_migrate_all=True, all tables defined during the subsequent > request (including Auth tables) will have their *.table files created, > unless migrate or fake_migrate is explicitly set to False for an individual > table. Note, auth.define_tables() itself takes migrate and fake_migrate > arguments -- if you have either of those arguments set to False, then the > Auth tables will not be fake migrated with fake_migrate_all=True. > > I suggest you read > http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#markmin_table_migrations, > > as it explains how everything works. In particular, look at the "Migration > Control Summary" section. > > >> Why the auth tables migration file names need a hex prefix and why it >> is different for each web2py installation ? >> If the hex prefix can be changed and everything is working ? why need it >> in the first place ? >> > > The prefix is simply a default generated by the DAL, and it is a hash of > the database URI (as noted in the documentation linked above). This allows > you to have multiple DAL instances linked to different databases without > worrying about clashes among the *.table file names. Alternatively, you can > specify your own prefix via the "migrate" argument, which the book actually > recommends: > > db.define_table('mytable', ..., migrate='db1_mytable.table') > > >> Shouldn't a complete copy of application and database just work out of >> the box ? >> > > It does if you (a) keep the database URI the same or (b) explicitly set > the *.table file names via each table's "migrate" argument. Otherwise, as > noted above, the URI hash is needed to allow multiple DAL instances within > a single app. > > Anthony > -- 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.