]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Database/Schema/NodeNodeNgrams.hs
Apply ListType replacement on children as well (fixes #217)
[gargantext.git] / src / Gargantext / Database / Schema / NodeNodeNgrams.hs
1 {-|
2 Module : Gargantext.Database.Schema.NodeNodeNgrams
3 Description : TODO: remove this module and table in database
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
8 Portability : POSIX
9
10 -}
11
12 {-# OPTIONS_GHC -fno-warn-orphans #-}
13
14 {-# LANGUAGE Arrows #-}
15 {-# LANGUAGE FunctionalDependencies #-}
16 {-# LANGUAGE TemplateHaskell #-}
17
18 module Gargantext.Database.Schema.NodeNodeNgrams
19 where
20
21 import Prelude
22 import Gargantext.Database.Schema.Prelude
23 import Gargantext.Database.Schema.Ngrams (NgramsTypeId, NgramsId)
24 import Gargantext.Database.Admin.Types.Node
25
26 data NodeNodeNgramsPoly n1 n2 ngrams_id ngt w
27 = NodeNodeNgrams { _nnng_node1_id :: !n1
28 , _nnng_node2_id :: !n2
29 , _nnng_ngrams_id :: !ngrams_id
30 , _nnng_ngramsType :: !ngt
31 , _nnng_weight :: !w
32 } deriving (Show)
33
34 type NodeNodeNgramsWrite =
35 NodeNodeNgramsPoly (Column SqlInt4 )
36 (Column SqlInt4 )
37 (Column SqlInt4 )
38 (Column SqlInt4 )
39 (Column SqlFloat8)
40
41 type NodeNodeNgramsRead =
42 NodeNodeNgramsPoly (Column SqlInt4 )
43 (Column SqlInt4 )
44 (Column SqlInt4 )
45 (Column SqlInt4 )
46 (Column SqlFloat8)
47
48 type NodeNodeNgrams =
49 NodeNodeNgramsPoly CorpusId DocId NgramsId NgramsTypeId Double
50
51 $(makeAdaptorAndInstance "pNodeNodeNgrams" ''NodeNodeNgramsPoly)
52 makeLenses ''NodeNodeNgramsPoly
53
54
55 nodeNodeNgramsTable :: Table NodeNodeNgramsWrite NodeNodeNgramsRead
56 nodeNodeNgramsTable = Table "node_node_ngrams"
57 ( pNodeNodeNgrams NodeNodeNgrams
58 { _nnng_node1_id = requiredTableField "node1_id"
59 , _nnng_node2_id = requiredTableField "node2_id"
60 , _nnng_ngrams_id = requiredTableField "ngrams_id"
61 , _nnng_ngramsType = requiredTableField "ngrams_type"
62 , _nnng_weight = requiredTableField "weight"
63 }
64 )