def upgrade(): graph = get_graph() if graph is None: return # graph.delete_all() for node_type in NodeType.all(): node_type.ensure_indices(graph)
def upgrade_graph(): graph = get_graph() if graph is None: return # graph.delete_all() cur = graph.run("MATCH (n) WHERE NOT (n)--() DELETE n;") log.debug("Deleted %(nodes_deleted)s orphan nodes.", cur.stats()) for node_type in NodeType.all(): node_type.ensure_indices(graph)
def upgrade_graph(): graph = get_graph() if graph is None: return # graph.delete_all() cur = graph.run("MATCH (n) WHERE NOT (n)--() DELETE n;") log.debug("Deleted %(nodes_deleted)s orphan nodes.", cur.stats()) # Common base type indexes if 'fingerprint' not in graph.schema.get_indexes(BASE_NODE): graph.schema.create_index(BASE_NODE, 'fingerprint') # if 'id' not in graph.schema.get_uniqueness_constraints(BASE_NODE): # graph.schema.create_uniqueness_constraint(BASE_NODE, 'id') if 'id' not in graph.schema.get_indexes(BASE_NODE): graph.schema.create_index(BASE_NODE, 'id') for node_type in NodeType.all(): node_type.ensure_indices(graph)