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
0bb02fc9
Commit
0bb02fc9
authored
Sep 04, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CLEAN] before refactoring and database schema change
parent
feb86a9a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
15 deletions
+11
-15
Flow.hs
src/Gargantext/Database/Action/Flow.hs
+9
-13
Insert.hs
src/Gargantext/Database/Query/Table/Node/Document/Insert.hs
+2
-2
No files found.
src/Gargantext/Database/Action/Flow.hs
View file @
0bb02fc9
...
...
@@ -228,22 +228,18 @@ flowCorpusUser l user corpusName ctype ids = do
insertDocs
::
(
FlowCmdM
env
err
m
,
FlowCorpus
a
)
=>
[
a
]
->
UserId
=>
UserId
->
CorpusId
->
[
a
]
->
m
([
DocId
],
[
DocumentWithId
a
])
insertDocs
hs
uId
cId
=
do
printDebug
"hs"
(
length
hs
)
insertDocs
uId
cId
hs
=
do
let
docs
=
map
addUniqId
hs
printDebug
"docs"
(
length
docs
)
ids
<-
insertDb
uId
cId
docs
printDebug
"ids"
(
length
ids
)
-- printDebug "inserted" (map reUniqId ids)
newIds
<-
insertDb
uId
cId
docs
let
ids'
=
map
reId
i
ds
documentsWithId
=
mergeData
(
toInserted
i
ds
)
(
Map
.
fromList
$
map
viewUniqId'
docs
)
_
<-
Doc
.
add
cId
i
ds'
pure
(
i
ds'
,
documentsWithId
)
newIds'
=
map
reId
newI
ds
documentsWithId
=
mergeData
(
toInserted
newI
ds
)
(
Map
.
fromList
$
map
viewUniqId'
docs
)
_
<-
Doc
.
add
cId
newI
ds'
pure
(
newI
ds'
,
documentsWithId
)
insertMasterDocs
::
(
FlowCmdM
env
err
m
...
...
@@ -256,7 +252,7 @@ insertMasterDocs :: ( FlowCmdM env err m
->
m
[
DocId
]
insertMasterDocs
c
lang
hs
=
do
(
masterUserId
,
_
,
masterCorpusId
)
<-
getOrMk_RootWithCorpus
(
UserName
userMaster
)
(
Left
corpusMasterName
)
c
(
ids'
,
documentsWithId
)
<-
insertDocs
hs
masterUserId
masterCorpusId
(
ids'
,
documentsWithId
)
<-
insertDocs
masterUserId
masterCorpusId
hs
_
<-
Doc
.
add
masterCorpusId
ids'
-- TODO
-- create a corpus with database name (CSV or PubMed)
...
...
src/Gargantext/Database/Query/Table/Node/Document/Insert.hs
View file @
0bb02fc9
...
...
@@ -155,8 +155,8 @@ queryInsert = [sql|
, ins AS (
INSERT INTO nodes (typename,user_id,parent_id,name,date,hyperdata)
SELECT * FROM input_rows
--
ON CONFLICT ((hyperdata ->> 'uniqIdBdd')) DO NOTHING -- on unique index -- this does not return the ids
ON CONFLICT ((hyperdata ->> 'uniqIdBdd')) DO UPDATE SET user_id=EXCLUDED.user_id -- on unique index
ON CONFLICT ((hyperdata ->> 'uniqIdBdd')) DO NOTHING -- on unique index -- this does not return the ids
--
ON CONFLICT ((hyperdata ->> 'uniqIdBdd')) DO UPDATE SET user_id=EXCLUDED.user_id -- on unique index
RETURNING id,hyperdata
)
...
...
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