relational-schemas: rename modules of SQLServer.

This commit is contained in:
Kei Hibino 2019-05-12 00:10:05 +09:00
parent 147e0194d5
commit bec0e43c25
10 changed files with 177 additions and 152 deletions

View File

@ -44,6 +44,8 @@ library
Database.Relational.Schema.SQLServerSyscat.Columns
Database.Relational.Schema.SQLServerSyscat.Types
Database.Relational.Schema.SQLServer.Columns
Database.Relational.Schema.SQLServer.Types
Database.Relational.Schema.SQLServer
Database.Relational.Schema.SQLite3Syscat.IndexInfo
@ -74,8 +76,9 @@ library
Database.Relational.Schema.PostgreSQL.PgNamespace
Database.Relational.Schema.PostgreSQL.PgClass
Database.Relational.Schema.SQLServerSyscat.IndexColumns
Database.Relational.Schema.SQLServerSyscat.Indexes
Database.Relational.Schema.SQLServer.Config
Database.Relational.Schema.SQLServer.IndexColumns
Database.Relational.Schema.SQLServer.Indexes
Database.Relational.Schema.OracleDataDictionary.ConsColumns
Database.Relational.Schema.OracleDataDictionary.Constraints

View File

@ -1,15 +1,17 @@
{-# LANGUAGE TemplateHaskell #-}
module Database.Relational.Schema.SQLServer (
module Database.Relational.Schema.SQLServer.Config,
getType, normalizeColumn, notNull,
columnTypeQuerySQL, primaryKeyQuerySQL
) where
import qualified Data.Map as Map
import qualified Database.Relational.Schema.SQLServerSyscat.Columns as Columns
import qualified Database.Relational.Schema.SQLServerSyscat.Indexes as Indexes
import qualified Database.Relational.Schema.SQLServerSyscat.IndexColumns as IndexColumns
import qualified Database.Relational.Schema.SQLServerSyscat.Types as Types
import qualified Database.Relational.Schema.SQLServer.Columns as Columns
import qualified Database.Relational.Schema.SQLServer.Indexes as Indexes
import qualified Database.Relational.Schema.SQLServer.IndexColumns as IndexColumns
import qualified Database.Relational.Schema.SQLServer.Types as Types
import Control.Applicative ((<|>))
import Data.ByteString (ByteString)
@ -21,10 +23,12 @@ import Database.Relational (Query, Relation, PlaceHolders, Record, Flat,
(!), (.=.), (><), asc, relationalQuery, just, placeholder',
query, relation', unsafeShowSql,
unsafeProjectSql, wheres)
import Database.Relational.Schema.SQLServerSyscat.Columns
import Database.Relational.Schema.SQLServerSyscat.Indexes
import Database.Relational.Schema.SQLServerSyscat.IndexColumns
import Database.Relational.Schema.SQLServerSyscat.Types
import Database.Relational.Schema.SQLServer.Config
import Database.Relational.Schema.SQLServer.Columns
import Database.Relational.Schema.SQLServer.Indexes
import Database.Relational.Schema.SQLServer.IndexColumns
import Database.Relational.Schema.SQLServer.Types
import Language.Haskell.TH (TypeQ)
--{-# ANN module "HLint: ignore Redundant $" #-}

View File

@ -0,0 +1,72 @@
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
module Database.Relational.Schema.SQLServer.Columns where
import GHC.Generics (Generic)
import Data.Int (Int32)
import Database.Relational.TH (defineTableTypesAndRecord)
import Database.Relational.Schema.SQLServer.Config (config)
$(defineTableTypesAndRecord config
"sys" "columns"
[
-- column schema type length NULL
-- --------------------- ------- ------------------- -------- ------
-- object_id sys int 4 No
("object_id", [t|Int32|]),
-- name sys sysname(nvarchar) 128 Yes
("name", [t|Maybe String|]),
-- column_id sys int 4 No
("column_id", [t|Int32|]),
-- system_type_id sys tinyint 1 No
--("system_type_id", [t|Int32|]),
-- user_type_id sys int 4 No
("user_type_id", [t|Int32|]),
-- max_length sys smallint 2 No
--("max_length", [t|Int32|]),
-- precision sys tinyint 1 No
--("precision", [t|Int32|]),
-- scale sys tinyint 1 No
--("scale", [t|Int32|]),
-- collation_name sys sysname(nvarchar) 128 Yes
--("collation_name", [t|Maybe String|]),
-- is_nullable sys bit 1 Yes
("is_nullable", [t|Maybe Bool|])--,
-- is_ansi_padded sys bit 1 No
--("is_ansi_padded", [t|Bool|]),
-- is_rowguidcol sys bit 1 No
--("is_rowguidcol", [t|Bool|]),
-- is_identity sys bit 1 No
--("is_identity", [t|Bool|]),
-- is_computed sys bit 1 No
--("is_computed", [t|Bool|]),
-- is_filestream sys bit 1 No
--("is_filestream", [t|Bool|]),
-- is_replicated sys bit 1 Yes
--("is_replicated", [t|Maybe Bool|]),
-- is_non_sql_subscribed sys bit 1 Yes
--("is_non_sql_subscribed", [t|Maybe Bool|]),
-- is_merge_published sys bit 1 Yes
--("is_merge_published", [t|Maybe Bool|]),
-- is_dts_repllicated sys bit 1 Yes
--("is_dts_replicated", [t|Maybe Bool|]),
-- is_xml_document sys bit 1 No
--("is_xml_document", [t|Bool|]),
-- xml_collection_id sys int 4 No
--("xml_collection_id", [t|Int32|]),
-- default_object_id sys int 4 No
--("default_object_id", [t|Int32|]),
-- rule_object_id sys int 4 No
--("rule_object_id", [t|Int32|]),
-- is_sparse sys bit 1 Yes
--("is_sparse", [t|Maybe Bool|]),
-- is_column_set sys bit 1 Yes
--("is_column_set", [t|Maybe Bool|])
]
[''Show, ''Generic])

View File

@ -0,0 +1,16 @@
-- |
-- Module : Database.Relational.Schema.PgCatalog.Config
-- Copyright : 2014 Kei Hibino
-- License : BSD3
--
-- Maintainer : ex8k.hibino@gmail.com
-- Stability : experimental
-- Portability : unknown
module Database.Relational.Schema.SQLServer.Config (config) where
import Database.Relational (Config, defaultConfig)
-- | Configuration parameter against SQLServer.
config :: Config
config = defaultConfig

View File

@ -4,13 +4,13 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
module Database.Relational.Schema.SQLServerSyscat.IndexColumns where
module Database.Relational.Schema.SQLServer.IndexColumns where
import GHC.Generics (Generic)
import Data.Int (Int32)
import Database.Relational.TH (defineTableTypesAndRecord)
import Database.Relational.Schema.SQLServerSyscat.Config (config)
import Database.Relational.Schema.SQLServer.Config (config)
$(defineTableTypesAndRecord config

View File

@ -4,13 +4,13 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
module Database.Relational.Schema.SQLServerSyscat.Indexes where
module Database.Relational.Schema.SQLServer.Indexes where
import GHC.Generics (Generic)
import Data.Int (Int32)
import Database.Relational.TH (defineTableTypesAndRecord)
import Database.Relational.Schema.SQLServerSyscat.Config (config)
import Database.Relational.Schema.SQLServer.Config (config)
$(defineTableTypesAndRecord config

View File

@ -0,0 +1,53 @@
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
module Database.Relational.Schema.SQLServer.Types where
import GHC.Generics (Generic)
import Data.Int (Int32)
import Database.Relational.TH (defineTableTypesAndRecord)
import Database.Relational.Schema.SQLServer.Config (config)
$(defineTableTypesAndRecord config
"sys" "types"
[
-- View "sys.types"
-- column schema type length NULL
-- --------------------- ------- ------------------- -------- ------
-- name sys sysname(nvarchar) 128 No
("name", [t|String|]),
-- system_type_id sys tinyint 1 No
--("system_type_id", [t|Int32|]),
-- user_type_id sys int 4 No
("user_type_id", [t|Int32|]),
-- schema_id sys int 4 No
("schema_id", [t|Int32|])--,
-- principal_id sys int 4 Yes
--("principal_id", [t|Maybe Int32|]),
-- max_length sys int 4 No
--("max_length", [t|Int32|]),
-- precision sys tinyint 1 No
--("precision", [t|Int32|]),
-- scale sys tinyint 1 No
--("scale", [t|Int32|]),
-- collation_name sys sysname(nvarchar) 128 Yes
--("collation_name", [t|Maybe String|]),
-- is_nullable sys bit 1 Yes
--("is_nullable", [t|Maybe Bool|]),
-- is_user_defined sys bit 1 No
--("is_user_defined", [t|Bool|]),
-- is_assembly_type sys bit 1 No
--("is_assembly_type", [t|Bool|]),
-- default_object_id sys int 4 No
--("default_object_id", [t|Int32|]),
-- rule_object_id sys int 4 No
--("rule_object_id", [t|Int32|]),
-- is_table_type sys bit 1 No
--("is_table_type", [t|Bool|])
]
[''Show, ''Generic])

View File

@ -1,72 +1,6 @@
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
module Database.Relational.Schema.SQLServerSyscat.Columns
{-# DEPRECATED "import Database.Relational.Schema.SQLServer.Columns instead of this module." #-} (
module Database.Relational.Schema.SQLServer.Columns,
) where
module Database.Relational.Schema.SQLServerSyscat.Columns where
import GHC.Generics (Generic)
import Data.Int (Int32)
import Database.Relational.TH (defineTableTypesAndRecord)
import Database.Relational.Schema.SQLServerSyscat.Config (config)
$(defineTableTypesAndRecord config
"sys" "columns"
[
-- column schema type length NULL
-- --------------------- ------- ------------------- -------- ------
-- object_id sys int 4 No
("object_id", [t|Int32|]),
-- name sys sysname(nvarchar) 128 Yes
("name", [t|Maybe String|]),
-- column_id sys int 4 No
("column_id", [t|Int32|]),
-- system_type_id sys tinyint 1 No
--("system_type_id", [t|Int32|]),
-- user_type_id sys int 4 No
("user_type_id", [t|Int32|]),
-- max_length sys smallint 2 No
--("max_length", [t|Int32|]),
-- precision sys tinyint 1 No
--("precision", [t|Int32|]),
-- scale sys tinyint 1 No
--("scale", [t|Int32|]),
-- collation_name sys sysname(nvarchar) 128 Yes
--("collation_name", [t|Maybe String|]),
-- is_nullable sys bit 1 Yes
("is_nullable", [t|Maybe Bool|])--,
-- is_ansi_padded sys bit 1 No
--("is_ansi_padded", [t|Bool|]),
-- is_rowguidcol sys bit 1 No
--("is_rowguidcol", [t|Bool|]),
-- is_identity sys bit 1 No
--("is_identity", [t|Bool|]),
-- is_computed sys bit 1 No
--("is_computed", [t|Bool|]),
-- is_filestream sys bit 1 No
--("is_filestream", [t|Bool|]),
-- is_replicated sys bit 1 Yes
--("is_replicated", [t|Maybe Bool|]),
-- is_non_sql_subscribed sys bit 1 Yes
--("is_non_sql_subscribed", [t|Maybe Bool|]),
-- is_merge_published sys bit 1 Yes
--("is_merge_published", [t|Maybe Bool|]),
-- is_dts_repllicated sys bit 1 Yes
--("is_dts_replicated", [t|Maybe Bool|]),
-- is_xml_document sys bit 1 No
--("is_xml_document", [t|Bool|]),
-- xml_collection_id sys int 4 No
--("xml_collection_id", [t|Int32|]),
-- default_object_id sys int 4 No
--("default_object_id", [t|Int32|]),
-- rule_object_id sys int 4 No
--("rule_object_id", [t|Int32|]),
-- is_sparse sys bit 1 Yes
--("is_sparse", [t|Maybe Bool|]),
-- is_column_set sys bit 1 Yes
--("is_column_set", [t|Maybe Bool|])
]
[''Show, ''Generic])
import Database.Relational.Schema.SQLServer.Columns

View File

@ -1,16 +1,6 @@
-- |
-- Module : Database.Relational.Schema.PgCatalog.Config
-- Copyright : 2014 Kei Hibino
-- License : BSD3
--
-- Maintainer : ex8k.hibino@gmail.com
-- Stability : experimental
-- Portability : unknown
module Database.Relational.Schema.SQLServerSyscat.Config (config) where
module Database.Relational.Schema.SQLServerSyscat.Config
{-# DEPRECATED "import config from Database.Relational.Schema.SQLServer instead of this module." #-} (
module Database.Relational.Schema.SQLServer.Config,
) where
import Database.Relational (Config, defaultConfig)
-- | Configuration parameter against SQLServer.
config :: Config
config = defaultConfig
import Database.Relational.Schema.SQLServer.Config

View File

@ -1,53 +1,6 @@
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
module Database.Relational.Schema.SQLServerSyscat.Types
{-# DEPRECATED "import Database.Relational.Schema.SQLServer.Types instead of this module." #-} (
module Database.Relational.Schema.SQLServer.Types,
) where
module Database.Relational.Schema.SQLServerSyscat.Types where
import GHC.Generics (Generic)
import Data.Int (Int32)
import Database.Relational.TH (defineTableTypesAndRecord)
import Database.Relational.Schema.SQLServerSyscat.Config (config)
$(defineTableTypesAndRecord config
"sys" "types"
[
-- View "sys.types"
-- column schema type length NULL
-- --------------------- ------- ------------------- -------- ------
-- name sys sysname(nvarchar) 128 No
("name", [t|String|]),
-- system_type_id sys tinyint 1 No
--("system_type_id", [t|Int32|]),
-- user_type_id sys int 4 No
("user_type_id", [t|Int32|]),
-- schema_id sys int 4 No
("schema_id", [t|Int32|])--,
-- principal_id sys int 4 Yes
--("principal_id", [t|Maybe Int32|]),
-- max_length sys int 4 No
--("max_length", [t|Int32|]),
-- precision sys tinyint 1 No
--("precision", [t|Int32|]),
-- scale sys tinyint 1 No
--("scale", [t|Int32|]),
-- collation_name sys sysname(nvarchar) 128 Yes
--("collation_name", [t|Maybe String|]),
-- is_nullable sys bit 1 Yes
--("is_nullable", [t|Maybe Bool|]),
-- is_user_defined sys bit 1 No
--("is_user_defined", [t|Bool|]),
-- is_assembly_type sys bit 1 No
--("is_assembly_type", [t|Bool|]),
-- default_object_id sys int 4 No
--("default_object_id", [t|Int32|]),
-- rule_object_id sys int 4 No
--("rule_object_id", [t|Int32|]),
-- is_table_type sys bit 1 No
--("is_table_type", [t|Bool|])
]
[''Show, ''Generic])
import Database.Relational.Schema.SQLServer.Types