diff --git a/neo4j/import/follows.cql b/neo4j/import/follows.cql new file mode 100644 index 000000000..0dad6a435 --- /dev/null +++ b/neo4j/import/follows.cql @@ -0,0 +1,4 @@ +CALL apoc.load.json('file:/mongo-export/follows.json') YIELD value as follow +MATCH (u1:User {id: follow.userId}), (u2:User {id: follow.foreignId}) +MERGE (u1)-[:FOLLOWS]->(u2) +; diff --git a/neo4j/import/import.sh b/neo4j/import/import.sh index 86224d240..d712dea0a 100755 --- a/neo4j/import/import.sh +++ b/neo4j/import/import.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash SCRIPT_DIRECTORY="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" echo "MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE n,r;" | cypher-shell -for collection in "badges" "categories" "users" "contributions" "comments" +for collection in "badges" "categories" "users" "follows" "contributions" "comments" do echo "Import ${collection}..." && cypher-shell < $SCRIPT_DIRECTORY/$collection.cql done diff --git a/neo4j/import/todo b/neo4j/import/todo index 8ee1bb83a..73eae2396 100644 --- a/neo4j/import/todo +++ b/neo4j/import/todo @@ -1,14 +1,4 @@ -CALL apoc.load.json('file:/mongo-export/badges.json') YIELD value as badge -MERGE(b:Badge {id: badge._id["$oid"]}) -ON CREATE SET b.key = badge.key, - b.type = badge.type, - b.icon = badge.image.path, - b.status = badge.status -CALL apoc.load.json('file:/mongo-export/follows.json') YIELD value as follow -MATCH (u1:User {id: follow.userId}), - (u2:User {id: follow.foreignId}) -MERGE (u1)-[:FOLLOWS]->(u2) CALL apoc.load.json('file:/mongo-export/shouts.json') YIELD value as shout MATCH (u:User {id: shout.userId}),