SQLite.hs (705B)
1 module Core.SQLite where 2 3 import Core.Configuration 4 import Core.Types 5 6 import Data.ByteString as B 7 import Database.SQLite.Simple 8 import Database.SQLite.Simple.FromRow 9 import Prelude hiding (init) 10 11 import qualified Data.Text as T 12 13 -- Set up SQLite database table when Purr starts if it doesn't already exist 14 init :: IO () 15 init = do 16 conn <- open dbPath 17 execute_ conn 18 "CREATE TABLE IF NOT EXISTS pws\ 19 \ (link TEXT PRIMARY KEY,\ 20 \ secret TEXT,\ 21 \ nonce TEXT,\ 22 \ date DATETIME DEFAULT CURRENT_TIMESTAMP,\ 23 \ life INT,\ 24 \ views INT,\ 25 \ maxViews INT)" 26 close conn