docs: def execute_migration(plugin, filename, script, dryrun=False):
      '''Execute and record a migration'''
      db = get_db()
      js = SCRIPT_WRAPPER.format(script)
      lines = script.splitlines()
      success = True
      if not dryrun:
          try:
              lines = db.eval(js, plugin, filename, script)
          except OperationFailure as e:
              log.error(e.details['errmsg'].replace('\n', '\\n'))
              success = False
          except PyMongoError as e:
              log.error('Unable to apply migration: %s', str(e))
              success = False
      echo('│'.encode('utf8'))
      for line in lines:
          echo('│ {0}'.format(line).encode('utf8'))
      echo('│'.encode('utf8'))
      echo('└──[{0}]'.format(green('OK') if success else red('KO')).encode('utf8'))
      echo('')
      return success