Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Przemyslaw Kaminski
haskell-gargantext
Commits
328cb395
Commit
328cb395
authored
Oct 05, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] upgrading without checking Hyperdatas
parent
0a3a029f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
7 deletions
+29
-7
Main.hs
bin/gargantext-upgrade/Main.hs
+2
-3
Node.hs
src/Gargantext/Database/Query/Table/Node.hs
+15
-4
UpdateOpaleye.hs
src/Gargantext/Database/Query/Table/Node/UpdateOpaleye.hs
+12
-0
No files found.
bin/gargantext-upgrade/Main.hs
View file @
328cb395
...
...
@@ -33,10 +33,9 @@ main = do
let
updateNodes
::
Cmd
GargError
[
Int64
]
updateNodes
=
updateNodesWithType
updateNodes
=
updateNodesWithType
_
NodeList
(
Proxy
::
Proxy
HyperdataList
)
(
\
_
->
defaultHyperdataList
)
defaultHyperdataList
withDevEnv
iniPath
$
\
env
->
do
x
<-
runCmdDev
env
updateNodes
...
...
src/Gargantext/Database/Query/Table/Node.hs
View file @
328cb395
...
...
@@ -160,13 +160,24 @@ selectNodesWithParentID n = proc () -> do
-- runCmdReplEasy (getNodesWithType NodeList (Proxy :: Proxy HyperdataList))
getNodesWithType
::
(
HasNodeError
err
,
JSONB
a
)
=>
NodeType
->
proxy
a
->
Cmd
err
[
Node
a
]
getNodesWithType
nt
_
=
runOpaQuery
$
selectNodesWithType
nt
selectNodesWithType
::
NodeType
->
Query
NodeRead
selectNodesWithType
nt
=
proc
()
->
do
where
selectNodesWithType
::
NodeType
->
Query
NodeRead
selectNodesWithType
nt
=
proc
()
->
do
row
@
(
Node
_
_
tn
_
_
_
_
_
)
<-
queryNodeTable
-<
()
restrict
-<
tn
.==
(
pgInt4
$
nodeTypeId
nt
)
returnA
-<
row
getNodesIdWithType
::
HasNodeError
err
=>
NodeType
->
Cmd
err
[
NodeId
]
getNodesIdWithType
nt
=
do
ns
<-
runOpaQuery
$
selectNodesIdWithType
nt
pure
(
map
NodeId
ns
)
selectNodesIdWithType
::
NodeType
->
Query
(
Column
PGInt4
)
selectNodesIdWithType
nt
=
proc
()
->
do
row
@
(
Node
_
_
tn
_
_
_
_
_
)
<-
queryNodeTable
-<
()
restrict
-<
tn
.==
(
pgInt4
$
nodeTypeId
nt
)
returnA
-<
_node_id
row
------------------------------------------------------------------------
...
...
src/Gargantext/Database/Query/Table/Node/UpdateOpaleye.hs
View file @
328cb395
...
...
@@ -48,3 +48,15 @@ updateNodesWithType nt p f = do
mapM
(
\
n
->
updateHyperdata
(
_node_id
n
)
(
f
$
_node_hyperdata
n
))
ns
-- | In case the Hyperdata Types are not compatible
updateNodesWithType_
::
(
HasNodeError
err
,
JSONB
a
,
ToJSON
a
)
=>
NodeType
->
a
->
Cmd
err
[
Int64
]
updateNodesWithType_
nt
h
=
do
ns
<-
getNodesIdWithType
nt
mapM
(
\
n
->
updateHyperdata
n
h
)
ns
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment