diff options
Diffstat (limited to 'src/server/Model/Database.hs')
-rw-r--r-- | src/server/Model/Database.hs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/server/Model/Database.hs b/src/server/Model/Database.hs index e5fd075..7f1777a 100644 --- a/src/server/Model/Database.hs +++ b/src/server/Model/Database.hs @@ -16,6 +16,7 @@ import Control.Monad.Trans.Resource (runResourceT, ResourceT) import Data.Text import Data.Time.Clock (UTCTime) +import Data.Int (Int64) import Database.Persist.Sqlite import Database.Persist.TH @@ -49,3 +50,6 @@ runDb = runNoLoggingT . runResourceT . withSqliteConn "database" . runSqlConn runMigrations :: IO () runMigrations = runDb $ runMigration migrateAll + +textToKey :: (ToBackendKey SqlBackend a) => String -> Key a +textToKey text = toSqlKey (read text :: Int64) |