I am trying to use Persistent to access my database. I know that Persistent can generate the code of entity, but there is something I can't generate so easily. Like I got a table which looks like:
CREATE TABLE `user` (
`user_id` bigint(11) NOT NULL,
`user_name` varchar(255) DEFAULT NULL,
`user_password` varchar(255) DEFAULT NULL,
PRIMARY KEY (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
then my haskell code like :
mkPersist sqlSettings [persistLowerCase|
User
name String
password String
deriving Show
|]
These fields are different include the primary key, I want to set their mapping relation. The official page (https://www.yesodweb.com/book/persistent) doesn't say how to do it.
Need I write the code to define it instead of generating it?