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
149
Issues
149
List
Board
Labels
Milestones
Merge Requests
11
Merge Requests
11
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
86de65ad
Commit
86de65ad
authored
Jan 21, 2021
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[UPGRADE] main functions
parent
92d85f76
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
4 deletions
+29
-4
Main.hs
bin/gargantext-upgrade/Main.hs
+9
-1
0.0.2.6.sql
devops/postgres/upgrade/0.0.2.6.sql
+16
-0
NgramsPostag.hs
src/Gargantext/Database/Query/Table/NgramsPostag.hs
+4
-3
No files found.
bin/gargantext-upgrade/Main.hs
View file @
86de65ad
...
...
@@ -25,6 +25,7 @@ import Gargantext.Database.Query.Table.Node.UpdateOpaleye
import
Gargantext.Database.Prelude
(
Cmd
''
,
)
import
Gargantext.Prelude
import
System.Environment
(
getArgs
)
import
Prelude
(
getLine
)
-- | PosTag
import
Gargantext.Database.Action.Flow
(
indexAllDocumentsWithPosTag
)
...
...
@@ -34,10 +35,17 @@ main :: IO ()
main
=
do
[
iniPath
]
<-
getArgs
putStrLn
"Manual method (for now):"
putStrLn
"Use SQL script to upgrade your schema database with the script:"
putStrLn
"psql gargandbV5 < ./devops/postgres/upgrade/0.0.2.6.sql"
putStrLn
"Then press enter key when you are done"
_ok
<-
getLine
let
upgrade
::
Cmd''
DevEnv
GargError
()
upgrade
=
do
_
<-
createTable_NgramsPostag
-- This method does not work for now
-- _ <- createTable_NgramsPostag
_
<-
indexAllDocumentsWithPosTag
pure
()
...
...
devops/postgres/upgrade/0.0.2.6.sql
0 → 100644
View file @
86de65ad
CREATE
TABLE
public
.
ngrams_postag
(
id
SERIAL
,
lang_id
INTEGER
,
algo_id
INTEGER
,
postag
CHARACTER
varying
(
5
),
ngrams_id
INTEGER
NOT
NULL
,
lemm_id
INTEGER
NOT
NULL
,
score
INTEGER
DEFAULT
1
::
integer
NOT
NULL
,
FOREIGN
KEY
(
ngrams_id
)
REFERENCES
public
.
ngrams
(
id
)
ON
DELETE
CASCADE
,
FOREIGN
KEY
(
lemm_id
)
REFERENCES
public
.
ngrams
(
id
)
ON
DELETE
CASCADE
)
;
-- ALTER TABLE public.ngrams_postag OWNER TO gargantua;
CREATE
UNIQUE
INDEX
ON
public
.
ngrams_postag
(
lang_id
,
algo_id
,
postag
,
ngrams_id
,
lemm_id
);
src/Gargantext/Database/Query/Table/NgramsPostag.hs
View file @
86de65ad
...
...
@@ -180,8 +180,9 @@ querySelectLems = [sql|
|]
-- | Insert Table
createTable_NgramsPostag
::
Cmd
err
[(
Form
,
Lem
)]
createTable_NgramsPostag
=
runPGSQuery_
queryCreateTable
createTable_NgramsPostag
::
Cmd
err
[
Int
]
createTable_NgramsPostag
=
map
(
\
(
PGS
.
Only
a
)
->
a
)
<$>
runPGSQuery_
queryCreateTable
where
queryCreateTable
::
PGS
.
Query
queryCreateTable
=
[
sql
|
...
...
@@ -196,7 +197,7 @@ createTable_NgramsPostag = runPGSQuery_ queryCreateTable
score INTEGER DEFAULT 1 ::integer NOT NULL,
FOREIGN KEY (ngrams_id) REFERENCES public.ngrams(id) ON DELETE CASCADE,
FOREIGN KEY (lemm_id) REFERENCES public.ngrams(id) ON DELETE CASCADE
);
)
;
-- ALTER TABLE public.ngrams_postag OWNER TO gargantua;
CREATE UNIQUE INDEX ON public.ngrams_postag (lang_id,algo_id,postag,ngrams_id,lemm_id);
...
...
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