diff options
author | Teddy Wing | 2017-08-02 22:36:10 +0200 |
---|---|---|
committer | Teddy Wing | 2017-08-02 22:36:10 +0200 |
commit | 15bc2c77036596575fc2ecad816befe48839fb0c (patch) | |
tree | e02666fc1c7ddc66b312b74213edd3d367385ce4 /src/Plugin/GitHubCommit.hs | |
parent | ff00355ade021d3e06d55017c5337f488474e5cb (diff) | |
download | sorbot-15bc2c77036596575fc2ecad816befe48839fb0c.tar.bz2 |
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.
Diffstat (limited to 'src/Plugin/GitHubCommit.hs')
-rw-r--r-- | src/Plugin/GitHubCommit.hs | 7 |
1 files changed, 3 insertions, 4 deletions
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 |