I’m trying to work out if there is a way one can have a have a runtime flag, that is able to dictate the shape of the schema.
Let’s say my runtime flag is Config
, as you can see in my hypothetical code I’m able to adjust the schema using the @
. I’m aware this looks like a feature request but could there be a way to handle this behaviour given the current implementation of Persistent?
<code>data Config = ConfigA | ConfigB
share [mkPersist sqlSettings, mkMigrate "migrateAll"] [persistLowerCase|
User
name String
age Int @ConfigA
email String @ConfigB
department DepartmentId @ConfigA
team TeamId @ConfigB
deriving Show
Department @ConfigA
name String
location String
deriving Show
Team @ConfigB
name String
project String
deriving Show
Post
title String
content String
author UserId
deriving Show
|]
</code>
<code>data Config = ConfigA | ConfigB
share [mkPersist sqlSettings, mkMigrate "migrateAll"] [persistLowerCase|
User
name String
age Int @ConfigA
email String @ConfigB
department DepartmentId @ConfigA
team TeamId @ConfigB
deriving Show
Department @ConfigA
name String
location String
deriving Show
Team @ConfigB
name String
project String
deriving Show
Post
title String
content String
author UserId
deriving Show
|]
</code>
data Config = ConfigA | ConfigB
share [mkPersist sqlSettings, mkMigrate "migrateAll"] [persistLowerCase|
User
name String
age Int @ConfigA
email String @ConfigB
department DepartmentId @ConfigA
team TeamId @ConfigB
deriving Show
Department @ConfigA
name String
location String
deriving Show
Team @ConfigB
name String
project String
deriving Show
Post
title String
content String
author UserId
deriving Show
|]