Init.hs 1.38 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
{-|
Module      : Gargantext.Database.Init
Description : Triggers configuration
Copyright   : (c) CNRS, 2017-Present
License     : AGPL + CECILL v3
Maintainer  : team@gargantext.org
Stability   : experimental
Portability : POSIX

Ngrams by node enable contextual metrics.

-}

{-# LANGUAGE QuasiQuotes       #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes        #-}

module Gargantext.Database.Init
  where

-- import Database.PostgreSQL.Simple.Types (Values(..), QualifiedIdentifier(..))
23
import Gargantext.Database.Utils (Cmd)
24
import Gargantext.Prelude
25
import Gargantext.Database.Triggers.Nodes (triggerSearchUpdate)
Alexandre Delanoë's avatar
Alexandre Delanoë committed
26
import Gargantext.Database.Triggers.NodesNodes (triggerDeleteCount, triggerInsertCount, triggerUpdateAdd, triggerUpdateDel, MasterListId) -- , triggerCoocInsert)
Alexandre Delanoë's avatar
Alexandre Delanoë committed
27
import Gargantext.Database.Triggers.NodeNodeNgrams (triggerCountInsert, triggerCountInsert2)
28 29 30 31
------------------------------------------------------------------------

initTriggers :: MasterListId -> Cmd err [Int64]
initTriggers lId = do
32
  t0 <- triggerSearchUpdate
33
  t1 <- triggerCountInsert
34
  t1' <- triggerCountInsert2
Alexandre Delanoë's avatar
Alexandre Delanoë committed
35
  -- t1'' <- triggerCoocInsert lId
36 37 38 39
  t2 <- triggerDeleteCount lId
  t3 <- triggerInsertCount lId
  t4 <- triggerUpdateAdd   lId
  t5 <- triggerUpdateDel   lId
Alexandre Delanoë's avatar
Alexandre Delanoë committed
40 41 42
  pure [t0
       ,t1
       ,t1'
Alexandre Delanoë's avatar
Alexandre Delanoë committed
43
       -- ,t1''
Alexandre Delanoë's avatar
Alexandre Delanoë committed
44 45 46 47
       ,t2
       ,t3
       ,t4
       ,t5]
48 49