This repository has been archived by the owner on May 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #127 from Human-Connection/100_2_download_uploads_…
…and_more Follow up on data import
- Loading branch information
Showing
43 changed files
with
155 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,6 @@ dist/ | |
|
||
db-migration-worker/ | ||
neo4j/ | ||
|
||
public/uploads/* | ||
!.gitkeep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,5 @@ yarn-error.log | |
dist/* | ||
coverage.lcov | ||
.nyc_output/ | ||
public/uploads/* | ||
!.gitkeep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
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, | ||
b.createdAt = badge.createdAt.`$date`, | ||
b.updatedAt = badge.updatedAt.`$date` | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
CALL apoc.load.json('file:/mongo-export/categories.json') YIELD value as category | ||
MERGE(c:Category {id: category._id["$oid"]}) | ||
ON CREATE SET | ||
c.name = category.title, | ||
c.slug = category.slug, | ||
c.icon = category.icon, | ||
c.createdAt = category.createdAt.`$date`, | ||
c.updatedAt = category.updatedAt.`$date` | ||
; | ||
|
||
MATCH (c:Category) | ||
WHERE (c.icon = "categories-justforfun") | ||
SET c.icon = 'smile' | ||
; | ||
|
||
MATCH (c:Category) | ||
WHERE (c.icon = "categories-luck") | ||
SET c.icon = 'heart-o' | ||
; | ||
|
||
MATCH (c:Category) | ||
WHERE (c.icon = "categories-health") | ||
SET c.icon = 'medkit' | ||
; | ||
|
||
MATCH (c:Category) | ||
WHERE (c.icon = "categories-environment") | ||
SET c.icon = 'tree' | ||
; | ||
|
||
MATCH (c:Category) | ||
WHERE (c.icon = "categories-animal-justice") | ||
SET c.icon = 'paw' | ||
; | ||
|
||
MATCH (c:Category) | ||
WHERE (c.icon = "categories-human-rights") | ||
SET c.icon = 'balance-scale' | ||
; | ||
|
||
MATCH (c:Category) | ||
WHERE (c.icon = "categories-education") | ||
SET c.icon = 'graduation-cap' | ||
; | ||
|
||
MATCH (c:Category) | ||
WHERE (c.icon = "categories-cooperation") | ||
SET c.icon = 'users' | ||
; | ||
|
||
MATCH (c:Category) | ||
WHERE (c.icon = "categories-politics") | ||
SET c.icon = 'university' | ||
; | ||
|
||
MATCH (c:Category) | ||
WHERE (c.icon = "categories-economy") | ||
SET c.icon = 'money' | ||
; | ||
|
||
MATCH (c:Category) | ||
WHERE (c.icon = "categories-technology") | ||
SET c.icon = 'flash' | ||
; | ||
|
||
MATCH (c:Category) | ||
WHERE (c.icon = "categories-internet") | ||
SET c.icon = 'mouse-pointer' | ||
; | ||
|
||
MATCH (c:Category) | ||
WHERE (c.icon = "categories-art") | ||
SET c.icon = 'paint-brush' | ||
; | ||
|
||
MATCH (c:Category) | ||
WHERE (c.icon = "categories-freedom-of-speech") | ||
SET c.icon = 'bullhorn' | ||
; | ||
|
||
MATCH (c:Category) | ||
WHERE (c.icon = "categories-sustainability") | ||
SET c.icon = 'shopping-cart' | ||
; | ||
|
||
MATCH (c:Category) | ||
WHERE (c.icon = "categories-peace") | ||
SET c.icon = 'angellist' | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 "users" "contributions" "comments" | ||
for collection in "badges" "categories" "users" "follows" "contributions" "shouts" "comments" | ||
do | ||
echo "Import ${collection}..." && cypher-shell < $SCRIPT_DIRECTORY/$collection.cql | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
CALL apoc.load.json('file:/mongo-export/shouts.json') YIELD value as shout | ||
MATCH (u:User {id: shout.userId}), (p:Post {id: shout.foreignId}) | ||
MERGE (u)-[:SHOUTED]->(p) | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,2 @@ | ||
CALL apoc.load.json('file:/mongo-export/categories.json') YIELD value as category | ||
MERGE(c:Category {id: category._id["$oid"]}) | ||
ON CREATE SET c.name = category.title, | ||
c.slug = category.slug, | ||
c.icon = category.icon | ||
|
||
|
||
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}), | ||
(p:Post {id: shout.foreignId}) | ||
MERGE (u)-[:SHOUTED]->(p) |
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.