OK than you want something like: filename = os.path.join(request.folder, 'databases', 'idx_auth_user.index') if not os.path.exist(filename) db.executesql('CREATE INDEX idx_auth_user ON auth_user (id, first_name, last_name, email, username);') open(filename).write(datetime.datetime.isoformat())
On Monday, 11 July 2016 06:30:17 UTC-5, 黄祥 wrote: > > thanks all, that can do, but CREATE INDEX IF NOT EXISTS, it's not work in > mysql (pls correct me if i'm wrong), so i use the universal code that can > cover all of it, of course i think i can create conditional for check for > the database connection base on environment. > in my environment are > - development : SQLite > - testing : MySQL > - staging : PostgreSQL > - production : PostgreSQL > > best regards, > stifan > -- 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.