]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Database/Init.hs
working on
[gargantext.git] / src / Gargantext / Database / 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 {-# LANGUAGE NoImplicitPrelude #-}
16 {-# LANGUAGE OverloadedStrings #-}
17 {-# LANGUAGE RankNTypes #-}
18
19 module Gargantext.Database.Init
20 where
21
22 -- import Database.PostgreSQL.Simple.Types (Values(..), QualifiedIdentifier(..))
23 import Gargantext.Database.Utils (Cmd)
24 import Gargantext.Prelude
25 import Gargantext.Database.Triggers.Nodes (triggerSearchUpdate)
26 import Gargantext.Database.Triggers.NodesNodes (triggerDeleteCount, triggerInsertCount, triggerUpdateAdd, triggerUpdateDel, MasterListId) -- , triggerCoocInsert)
27 import Gargantext.Database.Triggers.NodeNodeNgrams (triggerCountInsert, triggerCountInsert2)
28 ------------------------------------------------------------------------
29
30 initTriggers :: MasterListId -> Cmd err [Int64]
31 initTriggers lId = do
32 t0 <- triggerSearchUpdate
33 t1 <- triggerCountInsert
34 t1' <- triggerCountInsert2
35 -- t1'' <- triggerCoocInsert lId
36 t2 <- triggerDeleteCount lId
37 t3 <- triggerInsertCount lId
38 t4 <- triggerUpdateAdd lId
39 t5 <- triggerUpdateDel lId
40 pure [t0
41 ,t1
42 ,t1'
43 -- ,t1''
44 ,t2
45 ,t3
46 ,t4
47 ,t5]
48
49