I trying this<div><br></div><div><div><i>helperSqliteForeignON :: MonadIO m =&gt; SqlPersist m ()</i></div><div><i>helperSqliteForeignON = execute &quot;PRAGMA foreign_keys = ON&quot; []</i></div><div><i><br></i></div><div>

<i>-- How to run database actions.</i></div><div><i>instance YesodPersist Pomoguy where</i></div><div><i>    type YesodDB Pomoguy = SqlPersist</i></div><div><i>    runDB db = liftIOHandler</i></div><div><i>             $ fmap connPool getYesod &gt;&gt;= Settings.runConnectionPool (helperSqliteForeignON &gt;&gt; db)</i></div>

<div><i><br></i></div><div>But it does not work. I do not understand why</div><div>What is the second argument for <i>&#39;execute&#39;</i> function ?</div><div><br></div><div>Thanks. </div><br><div class="gmail_quote">2011/4/27 Michael Snoyman <span dir="ltr">&lt;<a href="mailto:michael@snoyman.com">michael@snoyman.com</a>&gt;</span><br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Looks like the docs just got generated, at least for persistent.<br>
You&#39;ll likely want the execute function from<br>
Data.Persist.GenericSql.Raw:<br>
<a href="http://hackage.haskell.org/packages/archive/persistent/0.5.0/doc/html/Database-Persist-GenericSql-Raw.html" target="_blank">http://hackage.haskell.org/packages/archive/persistent/0.5.0/doc/html/Database-Persist-GenericSql-Raw.html</a><br>


.<br>
<font color="#888888"><br>
Michael<br>
</font><div><div></div><div class="h5"><br>
On Wed, Apr 27, 2011 at 9:12 AM, Anton Cheshkov &lt;<a href="mailto:acheshkov@gmail.com">acheshkov@gmail.com</a>&gt; wrote:<br>
&gt; I think helper function is good variant. I wanted to make it on yesod level<br>
&gt; but i do not see hackage documentation for newly packages.<br>
&gt; When documentation will  refreshed  i can try to make &#39;foreign enabling&#39; on<br>
&gt; framework level ;)<br>
&gt; Thanks.<br>
&gt;<br>
&gt; 2011/4/27 Michael Snoyman &lt;<a href="mailto:michael@snoyman.com">michael@snoyman.com</a>&gt;<br>
&gt;&gt;<br>
&gt;&gt; I&#39;m not sure we want to enable this by default. What about just<br>
&gt;&gt; providing a helper function that enables the pragma? There&#39;s already<br>
&gt;&gt; enough available from the public API to execute arbitrary SQL<br>
&gt;&gt; statements. I don&#39;t use SQLite for production deployments personally,<br>
&gt;&gt; so if others have an opinion on this, I&#39;d like to hear it.<br>
&gt;&gt;<br>
&gt;&gt; Michael<br>
&gt;&gt;<br>
&gt;&gt; On Tue, Apr 26, 2011 at 1:31 PM, Anton Cheshkov &lt;<a href="mailto:acheshkov@gmail.com">acheshkov@gmail.com</a>&gt;<br>
&gt;&gt; wrote:<br>
&gt;&gt; &gt; Hi Michael.<br>
&gt;&gt; &gt; Please show the way to enable foreign key support from sqlite<br>
&gt;&gt; &gt; connection.<br>
&gt;&gt; &gt; Now foreign key constrints does not work for sqlite from Yesod.<br>
&gt;&gt; &gt; Thanks.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; <a href="http://www.sqlite.org/foreignkeys.html" target="_blank">http://www.sqlite.org/foreignkeys.html</a><br>
&gt;&gt; &gt; --<br>
&gt;&gt; &gt; Best regards,<br>
&gt;&gt; &gt; Cheshkov Anton<br>
&gt;&gt; &gt; Phone: +7 909 005 18 82<br>
&gt;&gt; &gt; Skype: cheshkov_anton<br>
&gt;&gt; &gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Best regards,<br>
&gt; Cheshkov Anton<br>
&gt; Phone: +7 909 005 18 82<br>
&gt; Skype: cheshkov_anton<br>
&gt;<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Best regards,<br>Cheshkov Anton <br>Phone: +7 909 005 18 82<br>Skype: cheshkov_anton<br>
</div>