fix migration setting version too soon

neo4j-4
Josha von Gizycki 5 years ago
parent 73a8e5f2b9
commit 84a8c076a2

@ -16,15 +16,17 @@
:pw (hashers/derive pw)
:uuid (neo4j/uuid)}))
(neo4j/defquery merge-config
(neo4j/defquery init-config
"MERGE (c:dbconfig)
ON CREATE SET
c.installed_at = {now},
c.db_version = 0,
c.last_migration = ''
ON MATCH SET
c.last_migration = {now},
c.db_version = {version}")
c.last_migration = ''")
(neo4j/defquery merge-config
"UPDATE (c:dbconfig)
SET c.last_migration = {now},
c.db_version = {version}")
(neo4j/defquery config
"MATCH (c:dbconfig) RETURN c")
@ -74,7 +76,7 @@
(neo4j/exec-query! ver-1-tag-uuid {}))
(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)
MERGE (i1)-[newl:link]->(i2)
ON CREATE SET
@ -92,8 +94,7 @@
init-version-2])
(defn run-migrations! []
(neo4j/exec-query! merge-config {:now (neo4j/now-str)
:version (count migrations)})
(neo4j/exec-query! init-config {:now (neo4j/now-str)})
(let [version (-> (neo4j/exec-query! config {})
first
:c

Loading…
Cancel
Save