|
|
@ -16,14 +16,16 @@
|
|
|
|
:pw (hashers/derive pw)
|
|
|
|
:pw (hashers/derive pw)
|
|
|
|
:uuid (neo4j/uuid)}))
|
|
|
|
:uuid (neo4j/uuid)}))
|
|
|
|
|
|
|
|
|
|
|
|
(neo4j/defquery merge-config
|
|
|
|
(neo4j/defquery init-config
|
|
|
|
"MERGE (c:dbconfig)
|
|
|
|
"MERGE (c:dbconfig)
|
|
|
|
ON CREATE SET
|
|
|
|
ON CREATE SET
|
|
|
|
c.installed_at = {now},
|
|
|
|
c.installed_at = {now},
|
|
|
|
c.db_version = 0,
|
|
|
|
c.db_version = 0,
|
|
|
|
c.last_migration = ''
|
|
|
|
c.last_migration = ''")
|
|
|
|
ON MATCH SET
|
|
|
|
|
|
|
|
c.last_migration = {now},
|
|
|
|
(neo4j/defquery merge-config
|
|
|
|
|
|
|
|
"UPDATE (c:dbconfig)
|
|
|
|
|
|
|
|
SET c.last_migration = {now},
|
|
|
|
c.db_version = {version}")
|
|
|
|
c.db_version = {version}")
|
|
|
|
|
|
|
|
|
|
|
|
(neo4j/defquery config
|
|
|
|
(neo4j/defquery config
|
|
|
@ -74,7 +76,7 @@
|
|
|
|
(neo4j/exec-query! ver-1-tag-uuid {}))
|
|
|
|
(neo4j/exec-query! ver-1-tag-uuid {}))
|
|
|
|
|
|
|
|
|
|
|
|
(neo4j/defquery migrate-links
|
|
|
|
(neo4j/defquery migrate-links
|
|
|
|
"MATCH (i1:instance)-[:link_from]-(l:link)-[:link_to]-(i2:instance),
|
|
|
|
"MATCH (i1:instance)-[lf:link_from]-(l:link)-[lt:link_to]-(i2:instance),
|
|
|
|
(l)-[cb:created_by]->(:user)
|
|
|
|
(l)-[cb:created_by]->(:user)
|
|
|
|
MERGE (i1)-[newl:link]->(i2)
|
|
|
|
MERGE (i1)-[newl:link]->(i2)
|
|
|
|
ON CREATE SET
|
|
|
|
ON CREATE SET
|
|
|
@ -92,8 +94,7 @@
|
|
|
|
init-version-2])
|
|
|
|
init-version-2])
|
|
|
|
|
|
|
|
|
|
|
|
(defn run-migrations! []
|
|
|
|
(defn run-migrations! []
|
|
|
|
(neo4j/exec-query! merge-config {:now (neo4j/now-str)
|
|
|
|
(neo4j/exec-query! init-config {:now (neo4j/now-str)})
|
|
|
|
:version (count migrations)})
|
|
|
|
|
|
|
|
(let [version (-> (neo4j/exec-query! config {})
|
|
|
|
(let [version (-> (neo4j/exec-query! config {})
|
|
|
|
first
|
|
|
|
first
|
|
|
|
:c
|
|
|
|
:c
|
|
|
|