]> Git — Sourcephile - gargantext.git/blob - bin/gargantext-upgrade/Main.hs
client functions for garg backend
[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.API.Ngrams.Tools (getRepo)
23 import Gargantext.Database.Prelude (Cmd'', )
24 import Gargantext.Core.NodeStory
25 import Gargantext.Prelude
26 import Gargantext.Prelude.Config (GargConfig(..), readConfig)
27 import System.Environment (getArgs)
28 import Prelude (getLine)
29 import GHC.IO.Exception (IOException)
30
31 main :: IO ()
32 main = do
33
34 putStrLn "Manual method:"
35 putStrLn "Upgrade your GarganText instance with the script:"
36 putStrLn "Then press enter key to launch upgrade."
37 _ok <- getLine
38
39 [iniPath] <- getArgs
40 cfg <- readConfig iniPath
41
42 let
43 -- upgrade :: Cmd'' DevEnv GargError ()
44 upgrade :: Cmd'' DevEnv IOException ()
45 upgrade = do
46 let repo_filepath = _gc_repofilepath cfg
47 repo <- getRepo
48 _ <- liftBase $ repoMigration repo_filepath repo
49 pure ()
50
51
52 withDevEnv iniPath $ \env -> do
53 _ <- runCmdDev env upgrade
54 putStrLn "Uprade done with success"
55 pure ()