docs: function pg_declare_index(self, ObjType, type, field, typefield, is_unique) {
  	var colname = _parse_predicate_key(ObjType, {'epoch':false}, field);
  	var datakey = colname.getMeta('datakey');
  	var field_name = (datakey ? datakey + '.' : '' ) + colname.getMeta('key');
  	var name = pg_create_index_name(self, ObjType, type, field, typefield, is_unique);
  	return pg_relation_exists(self, name).then(function(exists) {
  		if(!exists) {
  			return pg_create_index(self, ObjType, type, field, typefield, is_unique);
  		}
  
  		return pg_get_indexdef(self, name).then(function(old_indexdef) {
  			var new_indexdef_v1 = pg_create_index_query_v1(self, ObjType, type, field, typefield, is_unique);
  			var new_indexdef_v2 = pg_create_index_query_v2(self, ObjType, type, field, typefield, is_unique);
  
  			if (new_indexdef_v1 === old_indexdef) return self;
  			if (new_indexdef_v2 === old_indexdef) return self;
  
  			if (NoPg.debug) {
  				debug.info('Rebuilding index...');
  				debug.log('old index is: ', old_indexdef);
  				debug.log('new index is: ', new_indexdef_v1);
  			}
  
  			return pg_drop_index(self, ObjType, type, field, typefield).then(function() {
  				return pg_create_index(self, ObjType, type, field, typefield, is_unique);
  			});
  		});
  	});
  }