What may cause an ErrorConstraint SqliteException error with Yesod + sqlite3?
This is the best solution I've found. And what looks like will be the "official" solution.
So in my project i've done this way.
So this is my wipeDB function now:
wipeDB :: App -> IO ()wipeDB app = do let settings = appSettings app logFunc = messageLoggerSource app (appLogger app) sqliteConn <- rawConnection (sqlDatabase $ appDatabaseConf settings) let infoNoFK = set fkEnabled False $ mkSqliteConnectionInfo "" wrapper = wrapConnectionInfo infoNoFK sqliteConn pool <- runLoggingT (createSqlPool wrapper 1) logFunc flip runSqlPersistMPool pool $ do tables <- getTables sqlBackend <- ask let queries = map (\t -> "DELETE FROM " ++ (connEscapeName sqlBackend $ DBName t)) tables forM_ queries (\q -> rawExecute q [])