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