Merge remote-tracking branch 'origin/flexible-job-queue' into dev
[gargantext.git] / src / Gargantext / Database / Schema / NodeNode.hs
index 13134a8bfdff7f366610548ba37dbe0e624a4917..dff5f28a1fa3e399d84787c3422dc108d4c9ca1d 100644 (file)
@@ -11,8 +11,6 @@ Here is a longer description of this module, containing some
 commentary with @some markup@.
 -}
 
-{-# OPTIONS_GHC -fno-warn-orphans #-}
-
 {-# LANGUAGE Arrows                 #-}
 {-# LANGUAGE FunctionalDependencies #-}
 {-# LANGUAGE QuasiQuotes            #-}
@@ -20,7 +18,6 @@ commentary with @some markup@.
 
 module Gargantext.Database.Schema.NodeNode where
 
-import Data.Maybe (Maybe)
 import Gargantext.Core.Types
 import Gargantext.Database.Schema.Prelude
 import Gargantext.Prelude
@@ -33,20 +30,20 @@ data NodeNodePoly node1_id node2_id score cat
                               , _nn_category   :: !cat
                               } deriving (Show)
 
-type NodeNodeWrite     = NodeNodePoly (Column (PGInt4))
-                                      (Column (PGInt4))
-                                      (Maybe  (Column (PGFloat8)))
-                                      (Maybe  (Column (PGInt4)))
+type NodeNodeWrite     = NodeNodePoly (Column (SqlInt4))
+                                      (Column (SqlInt4))
+                                      (Maybe  (Column (SqlFloat8)))
+                                      (Maybe  (Column (SqlInt4)))
 
-type NodeNodeRead      = NodeNodePoly (Column (PGInt4))
-                                      (Column (PGInt4))
-                                      (Column (PGFloat8))
-                                      (Column (PGInt4))
+type NodeNodeRead      = NodeNodePoly (Column (SqlInt4))
+                                      (Column (SqlInt4))
+                                      (Column (SqlFloat8))
+                                      (Column (SqlInt4))
 
-type NodeNodeReadNull  = NodeNodePoly (Column (Nullable PGInt4))
-                                      (Column (Nullable PGInt4))
-                                      (Column (Nullable PGFloat8))
-                                      (Column (Nullable PGInt4))
+type NodeNodeReadNull  = NodeNodePoly (Column (Nullable SqlInt4))
+                                      (Column (Nullable SqlInt4))
+                                      (Column (Nullable SqlFloat8))
+                                      (Column (Nullable SqlInt4))
 
 type NodeNode = NodeNodePoly NodeId NodeId (Maybe Double) (Maybe Int)
 
@@ -57,25 +54,10 @@ nodeNodeTable :: Table NodeNodeWrite NodeNodeRead
 nodeNodeTable  =
   Table "nodes_nodes"
          ( pNodeNode
-           NodeNode { _nn_node1_id = required "node1_id"
-                    , _nn_node2_id = required "node2_id"
-                    , _nn_score    = optional "score"
-                    , _nn_category = optional "category"
+           NodeNode { _nn_node1_id = requiredTableField "node1_id"
+                    , _nn_node2_id = requiredTableField "node2_id"
+                    , _nn_score    = optionalTableField "score"
+                    , _nn_category = optionalTableField "category"
                     }
                 )
 
-instance QueryRunnerColumnDefault (Nullable PGInt4)   Int            where
-    queryRunnerColumnDefault = fieldQueryRunnerColumn
-
-instance QueryRunnerColumnDefault (Nullable PGFloat8) Int            where
-    queryRunnerColumnDefault = fieldQueryRunnerColumn
-
-instance QueryRunnerColumnDefault (Nullable PGFloat8) Double         where
-    queryRunnerColumnDefault = fieldQueryRunnerColumn
-
-instance QueryRunnerColumnDefault PGFloat8            (Maybe Double) where
-    queryRunnerColumnDefault = fieldQueryRunnerColumn
-
-instance QueryRunnerColumnDefault PGInt4              (Maybe Int)    where
-    queryRunnerColumnDefault = fieldQueryRunnerColumn
-