]> Git — Sourcephile - gargantext.git/blob - bin/gargantext-upgrade/Main.hs
Merge branch 'dev-distributional' of ssh://gitlab.iscpif.fr:20022/gargantext/haskell...
[gargantext.git] / bin / gargantext-upgrade / Main.hs
1 {-|
2 Module : Main.hs
3 Description : Gargantext Import Corpus
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
8 Portability : POSIX
9
10 Import a corpus binary.
11
12 -}
13
14 {-# LANGUAGE Strict #-}
15
16 module Main where
17
18 import Gargantext.API.Admin.EnvTypes (DevEnv)
19 import Gargantext.API.Dev (withDevEnv, runCmdDev)
20 import Gargantext.API.Prelude (GargError)
21 import Gargantext.API.Node () -- instances only
22 import Gargantext.Database.Admin.Types.Node
23 import Gargantext.Database.Admin.Types.Hyperdata
24 import Gargantext.Database.Query.Table.Node.UpdateOpaleye
25 import Gargantext.Database.Prelude (Cmd'', )
26 import Gargantext.Prelude
27 import System.Environment (getArgs)
28 import Prelude (getLine)
29
30 -- | PosTag
31 import Gargantext.Database.Action.Flow (indexAllDocumentsWithPosTag)
32 import Gargantext.Database.Query.Table.NgramsPostag (createTable_NgramsPostag)
33
34 main :: IO ()
35 main = do
36 [iniPath] <- getArgs
37
38 putStrLn "Manual method (for now):"
39 putStrLn "Upgrade your schema database with the script:"
40 putStrLn "psql gargandbV5 < ./devops/postgres/upgrade/0.0.2.6.sql"
41 putStrLn "Then press enter key when you are done"
42 _ok <- getLine
43
44 let
45 upgrade :: Cmd'' DevEnv GargError ()
46 upgrade = do
47 -- This method does not work for now
48 -- _ <- createTable_NgramsPostag
49 _ <- indexAllDocumentsWithPosTag
50 pure ()
51
52 withDevEnv iniPath $ \env -> do
53 _ <- runCmdDev env upgrade
54 putStrLn "Uprade"
55 pure ()