On Wednesday, January 22, 2020 at 3:20:33 PM UTC-8, abhijit wrote: > > I'm trying to do a multi_insert in a transaction into a SQLite DB table. > The table is a 'users' table with a hierarchy column of 'parent_id'. > > Certain records have 'id's which are less than their 'parent_id's because > of which multi_insert fails with foreign key constraint violation. > > How do I set the "PRAGMA defer_foreign_keys" for the SQLite DB so that the > constraints get applied only at the end of the transaction? >
Use the :connect_sqls=>['PRAGMA defer_foreign_keys = 1'] option when setting up the Sequel::Database object. Thanks, Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sequel-talk/d685d5a5-f3fe-4835-a8bd-4b35508cda49%40googlegroups.com.
