From 15bc2c77036596575fc2ecad816befe48839fb0c Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Wed, 2 Aug 2017 22:36:10 +0200 Subject: ChannelRepoUrl: Get rid of the `id` field We're not using it, and originally I didn't even put it in my SELECT query (which actually messed me up for a couple hours, as two columns in the SELECT does not match three columns in the data type). Added it later as a fix for that problem. But since I don't really want or need to select the id, we shouldn't bother, and in order to do so, we need to update the Haskell data type to only include two fields, so sqlite-simple can correctly convert the data. --- src/Plugin/GitHubCommit.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/Plugin/GitHubCommit.hs') diff --git a/src/Plugin/GitHubCommit.hs b/src/Plugin/GitHubCommit.hs index ec6684d..b95cfd2 100644 --- a/src/Plugin/GitHubCommit.hs +++ b/src/Plugin/GitHubCommit.hs @@ -20,7 +20,7 @@ gitHubCommit = Plugin -- gitHubCommitAction :: M.Message -> Connection -> IO String gitHubCommitAction :: PluginAction gitHubCommitAction message dbConn = do - rs <- query_ dbConn "SELECT id, channel, repo_url \ + rs <- query_ dbConn "SELECT channel, repo_url \ \ FROM plugin_github_commit_channel_repo_urls \ \ LIMIT 1" :: IO [ChannelRepoUrl] return $ response rs @@ -37,10 +37,9 @@ type RepoUrl = String -- | A type to match the database table for this plugin. -- data ChannelRepoUrl = ChannelRepoUrl Id M.Channel RepoUrl deriving (Show) data ChannelRepoUrl = ChannelRepoUrl - { id :: Id - , channel :: M.Channel + { channel :: M.Channel , repoUrl :: RepoUrl } deriving (Show) instance FromRow ChannelRepoUrl where - fromRow = ChannelRepoUrl <$> field <*> field <*> field + fromRow = ChannelRepoUrl <$> field <*> field -- cgit v1.2.3