]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Database/Admin/Trigger/Init.hs
[DOC] typo
[gargantext.git] / src / Gargantext / Database / Admin / Trigger / Init.hs
1 {-|
2 Module : Gargantext.Database.Init
3 Description : Triggers configuration
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
8 Portability : POSIX
9
10 Ngrams by node enable contextual metrics.
11
12 -}
13
14 {-# LANGUAGE QuasiQuotes #-}
15
16 module Gargantext.Database.Admin.Trigger.Init
17 where
18
19 import Data.Text (Text)
20 import Gargantext.Database.Admin.Trigger.NodeNodeNgrams (triggerCountInsert, triggerCountInsert2)
21 import Gargantext.Database.Admin.Trigger.Nodes (triggerSearchUpdate, triggerUpdateHash)
22 import Gargantext.Database.Admin.Trigger.NodesNodes (triggerDeleteCount, triggerInsertCount, triggerUpdateAdd, triggerUpdateDel, MasterListId) -- , triggerCoocInsert)
23 import Gargantext.Database.Prelude (Cmd)
24 import Gargantext.Prelude
25
26 ------------------------------------------------------------------------
27 initFirstTriggers :: Text -> Cmd err [Int64]
28 initFirstTriggers secret = do
29 t0 <- triggerUpdateHash secret
30 pure [t0]
31
32 initLastTriggers :: MasterListId -> Cmd err [Int64]
33 initLastTriggers lId = do
34 t0 <- triggerSearchUpdate
35 t1 <- triggerCountInsert
36 t1' <- triggerCountInsert2
37 -- t1'' <- triggerCoocInsert lId
38 t2 <- triggerDeleteCount lId
39 t3 <- triggerInsertCount lId
40 t4 <- triggerUpdateAdd lId
41 t5 <- triggerUpdateDel lId
42 pure [t0
43 ,t1
44 ,t1'
45 -- ,t1''
46 ,t2
47 ,t3
48 ,t4
49 ,t5]
50
51