diff --git a/relational-schemas/relational-schemas.cabal b/relational-schemas/relational-schemas.cabal index 5731834e..4ae20933 100644 --- a/relational-schemas/relational-schemas.cabal +++ b/relational-schemas/relational-schemas.cabal @@ -37,11 +37,15 @@ library Database.Relational.Schema.OracleDataDictionary.TabColumns Database.Relational.Schema.Oracle + Database.Relational.Schema.MySQLInfo.Columns + Database.Relational.Schema.MySQL + Database.Relational.Schema.DB2Syscat.Config Database.Relational.Schema.PgCatalog.Config Database.Relational.Schema.SQLServerSyscat.Config Database.Relational.Schema.SQLite3Syscat.Config Database.Relational.Schema.OracleDataDictionary.Config + Database.Relational.Schema.MySQLInfo.Config other-modules: Database.Relational.Schema.DB2Syscat.Tabconst @@ -57,6 +61,9 @@ library Database.Relational.Schema.OracleDataDictionary.ConsColumns Database.Relational.Schema.OracleDataDictionary.Constraints + Database.Relational.Schema.MySQLInfo.KeyColumnUsage + Database.Relational.Schema.MySQLInfo.TableConstraints + build-depends: base <5 , template-haskell , containers diff --git a/relational-schemas/src/Database/Relational/Schema/MySQLInfo/Columns.hs b/relational-schemas/src/Database/Relational/Schema/MySQLInfo/Columns.hs index d4daf296..287338bf 100644 --- a/relational-schemas/src/Database/Relational/Schema/MySQLInfo/Columns.hs +++ b/relational-schemas/src/Database/Relational/Schema/MySQLInfo/Columns.hs @@ -7,7 +7,10 @@ import Data.Int (Int16) import Database.Record.TH (derivingShow) import Database.Relational.Query.TH (defineTableTypesAndRecordDefault) -$(defineTableTypesAndRecordDefault +import Database.Relational.Schema.MySQLInfo.Config (config) + + +$(defineTableTypesAndRecordDefault config "INFORMATION_SCHEMA" "columns" [ ("table_schema", [t|String|]) , ("table_name", [t|String|]) diff --git a/relational-schemas/src/Database/Relational/Schema/MySQLInfo/Config.hs b/relational-schemas/src/Database/Relational/Schema/MySQLInfo/Config.hs new file mode 100644 index 00000000..307020f9 --- /dev/null +++ b/relational-schemas/src/Database/Relational/Schema/MySQLInfo/Config.hs @@ -0,0 +1,16 @@ +-- | +-- Module : Database.Relational.Schema.MySQLInfo.Config +-- Copyright : 2013 Kei Hibino +-- License : BSD3 +-- +-- Maintainer : ex8k.hibino@gmail.com +-- Stability : experimental +-- Portability : unknown +module Database.Relational.Schema.MySQLInfo.Config (config) where + +import Database.Relational.Query (Config (..), defaultConfig) + + +-- | Configuration parameter against MySQL. +config :: Config +config = defaultConfig { normalizedTableName = False } diff --git a/relational-schemas/src/Database/Relational/Schema/MySQLInfo/KeyColumnUsage.hs b/relational-schemas/src/Database/Relational/Schema/MySQLInfo/KeyColumnUsage.hs index 8889ee2c..2500f10a 100644 --- a/relational-schemas/src/Database/Relational/Schema/MySQLInfo/KeyColumnUsage.hs +++ b/relational-schemas/src/Database/Relational/Schema/MySQLInfo/KeyColumnUsage.hs @@ -7,7 +7,10 @@ import Data.Int (Int16) import Database.Record.TH (derivingShow) import Database.Relational.Query.TH (defineTableTypesAndRecordDefault) -$(defineTableTypesAndRecordDefault +import Database.Relational.Schema.MySQLInfo.Config (config) + + +$(defineTableTypesAndRecordDefault config "INFORMATION_SCHEMA" "key_column_usage" [ ("constraint_name" , [t| String |]) , ("table_schema" , [t| String |]) diff --git a/relational-schemas/src/Database/Relational/Schema/MySQLInfo/TableConstraints.hs b/relational-schemas/src/Database/Relational/Schema/MySQLInfo/TableConstraints.hs index 47887845..67356f30 100644 --- a/relational-schemas/src/Database/Relational/Schema/MySQLInfo/TableConstraints.hs +++ b/relational-schemas/src/Database/Relational/Schema/MySQLInfo/TableConstraints.hs @@ -6,7 +6,10 @@ module Database.Relational.Schema.MySQLInfo.TableConstraints where import Database.Record.TH (derivingShow) import Database.Relational.Query.TH (defineTableTypesAndRecordDefault) -$(defineTableTypesAndRecordDefault +import Database.Relational.Schema.MySQLInfo.Config (config) + + +$(defineTableTypesAndRecordDefault config "INFORMATION_SCHEMA" "table_constraints" [ ("table_schema" , [t| String |]) , ("table_name" , [t| String |])