Permalink
Browse files

Add foreign key support for every new created connection

  • Loading branch information...
1 parent ec4f4af commit 35d588bc0c464c08eab6a4dbcbc2025060d6d218 @acheshkov committed Apr 26, 2011
Showing with 4 additions and 1 deletion.
  1. +4 −1 backends/sqlite/Database/Sqlite.hs
@@ -163,7 +163,10 @@ open :: Text -> IO Connection
open path = do
databaseOrError <- openError path
case databaseOrError of
- Left database -> return database
+ Left database -> do
+ st <- prepare database "PRAGMA foreign_keys = ON"
+ step st
+ return database
Right error -> sqlError Nothing ("open " `mappend` (pack $ show path)) error
foreign import ccall "sqlite3_close"

0 comments on commit 35d588b

Please sign in to comment.