Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
195
Issues
195
List
Board
Labels
Milestones
Merge Requests
12
Merge Requests
12
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
gargantext
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
...
@@ -228,22 +228,18 @@ flowCorpusUser l user corpusName ctype ids = do
insertDocs
::
(
FlowCmdM
env
err
m
insertDocs
::
(
FlowCmdM
env
err
m
,
FlowCorpus
a
,
FlowCorpus
a
)
)
=>
[
a
]
=>
UserId
->
UserId
->
CorpusId
->
CorpusId
->
[
a
]
->
m
([
DocId
],
[
DocumentWithId
a
])
->
m
([
DocId
],
[
DocumentWithId
a
])
insertDocs
hs
uId
cId
=
do
insertDocs
uId
cId
hs
=
do
printDebug
"hs"
(
length
hs
)
let
docs
=
map
addUniqId
hs
let
docs
=
map
addUniqId
hs
printDebug
"docs"
(
length
docs
)
newIds
<-
insertDb
uId
cId
docs
ids
<-
insertDb
uId
cId
docs
printDebug
"ids"
(
length
ids
)
-- printDebug "inserted" (map reUniqId ids)
let
let
ids'
=
map
reId
i
ds
newIds'
=
map
reId
newI
ds
documentsWithId
=
mergeData
(
toInserted
i
ds
)
(
Map
.
fromList
$
map
viewUniqId'
docs
)
documentsWithId
=
mergeData
(
toInserted
newI
ds
)
(
Map
.
fromList
$
map
viewUniqId'
docs
)
_
<-
Doc
.
add
cId
i
ds'
_
<-
Doc
.
add
cId
newI
ds'
pure
(
i
ds'
,
documentsWithId
)
pure
(
newI
ds'
,
documentsWithId
)
insertMasterDocs
::
(
FlowCmdM
env
err
m
insertMasterDocs
::
(
FlowCmdM
env
err
m
...
@@ -256,7 +252,7 @@ insertMasterDocs :: ( FlowCmdM env err m
...
@@ -256,7 +252,7 @@ insertMasterDocs :: ( FlowCmdM env err m
->
m
[
DocId
]
->
m
[
DocId
]
insertMasterDocs
c
lang
hs
=
do
insertMasterDocs
c
lang
hs
=
do
(
masterUserId
,
_
,
masterCorpusId
)
<-
getOrMk_RootWithCorpus
(
UserName
userMaster
)
(
Left
corpusMasterName
)
c
(
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'
_
<-
Doc
.
add
masterCorpusId
ids'
-- TODO
-- TODO
-- create a corpus with database name (CSV or PubMed)
-- 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|
...
@@ -155,8 +155,8 @@ queryInsert = [sql|
, ins AS (
, ins AS (
INSERT INTO nodes (typename,user_id,parent_id,name,date,hyperdata)
INSERT INTO nodes (typename,user_id,parent_id,name,date,hyperdata)
SELECT * FROM input_rows
SELECT * FROM input_rows
--
ON CONFLICT ((hyperdata ->> 'uniqIdBdd')) DO NOTHING -- on unique index -- this does not return the ids
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 UPDATE SET user_id=EXCLUDED.user_id -- on unique index
RETURNING id,hyperdata
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