Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions persistent/Database/Persist/EntityDef.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module Database.Persist.EntityDef
, getEntityKeyFields
, getEntityComments
, getEntityExtra
, getEntitySchema
, isEntitySum
, entityPrimary
, entitiesPrimary
Expand All @@ -27,6 +28,7 @@ module Database.Persist.EntityDef
, setEntityId
, setEntityIdDef
, setEntityDBName
, setEntitySchema
, overEntityFields
-- * Related Types
, EntityIdDef(..)
Expand Down Expand Up @@ -89,6 +91,9 @@ getEntityDBName = entityDB
getEntityExtra :: EntityDef -> Map Text [[Text]]
getEntityExtra = entityExtra

getEntitySchema :: EntityDef -> Maybe SchemaNameDB
getEntitySchema = entitySchema

-- |
--
-- @since 2.13.0.0
Expand Down Expand Up @@ -195,6 +200,9 @@ getEntityKeyFields = entityKeyFields
setEntityFields :: [FieldDef] -> EntityDef -> EntityDef
setEntityFields fd ed = ed { entityFields = fd }

setEntitySchema :: Maybe SchemaNameDB -> EntityDef -> EntityDef
setEntitySchema sn ed = ed { entitySchema = sn }

-- | Perform a mapping function over all of the entity fields, as determined by
-- 'getEntityFieldsDatabase'.
--
Expand Down
6 changes: 6 additions & 0 deletions persistent/Database/Persist/Names.hs
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,9 @@ instance DatabaseName ConstraintNameDB where
-- @since 2.12.0.0
newtype ConstraintNameHS = ConstraintNameHS { unConstraintNameHS :: Text }
deriving (Show, Eq, Read, Ord, Lift)

newtype SchemaNameDB = SchemaNameDB { unSchemaNameDB :: Text }
deriving (Show, Eq, Read, Ord, Lift)

instance DatabaseName SchemaNameDB where
escapeWith f (SchemaNameDB n) = f n
2 changes: 1 addition & 1 deletion persistent/Database/Persist/Types/Base.hs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ data EntityDef = EntityDef
-- ^ Whether or not this entity represents a sum type in the database.
, entityComments :: !(Maybe Text)
-- ^ Optional comments on the entity.
, entitySchema :: !(Maybe Text)
, entitySchema :: !(Maybe SchemaNameDB)
-- ^ The schema the entity belongs to.
--
-- @since 2.10.0
Expand Down