]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Database/Schema/ContextNodeNgrams.hs
[FIX] Node default names simplified
[gargantext.git] / src / Gargantext / Database / Schema / ContextNodeNgrams.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.ContextNodeNgrams
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
27
28 type ContextNodeNgrams =
29 ContextNodeNgramsPoly ContextId ListId NgramsId NgramsTypeId Double
30
31
32 data ContextNodeNgramsPoly c n ngrams_id ngt w
33 = ContextNodeNgrams { _cnng_context_id :: !c
34 , _cnng_node_id :: !n
35 , _cnng_ngrams_id :: !ngrams_id
36 , _cnng_ngramsType :: !ngt
37 , _cnng_weight :: !w
38 } deriving (Show)
39
40 type ContextNodeNgramsWrite =
41 ContextNodeNgramsPoly (Column SqlInt4 )
42 (Column SqlInt4 )
43 (Column SqlInt4 )
44 (Column SqlInt4 )
45 (Column SqlFloat8)
46
47 type ContextNodeNgramsRead =
48 ContextNodeNgramsPoly (Column SqlInt4 )
49 (Column SqlInt4 )
50 (Column SqlInt4 )
51 (Column SqlInt4 )
52 (Column SqlFloat8)
53
54 type ContextNodeNgramsReadNull =
55 ContextNodeNgramsPoly (Column (Nullable SqlInt4 ))
56 (Column (Nullable SqlInt4 ))
57 (Column (Nullable SqlInt4 ))
58 (Column (Nullable SqlInt4 ))
59 (Column (Nullable SqlFloat8))
60
61 $(makeAdaptorAndInstance "pContextNodeNgrams" ''ContextNodeNgramsPoly)
62 makeLenses ''ContextNodeNgramsPoly
63
64
65 contextNodeNgramsTable :: Table ContextNodeNgramsWrite ContextNodeNgramsRead
66 contextNodeNgramsTable = Table "context_node_ngrams"
67 ( pContextNodeNgrams ContextNodeNgrams
68 { _cnng_context_id = requiredTableField "context_id"
69 , _cnng_node_id = requiredTableField "node_id"
70 , _cnng_ngrams_id = requiredTableField "ngrams_id"
71 , _cnng_ngramsType = requiredTableField "ngrams_type"
72 , _cnng_weight = requiredTableField "weight"
73 }
74 )