I did it like this, but it didn't seem to work - DB = Sequel.connect( :adapter => 'sqlite', :database => 'database.sqlite', :connect_sqls=>['PRAGMA defer_foreign_keys = 1'])
Did I make a mistake? On Thursday, January 23, 2020 at 5:01:30 AM UTC+5:30, Jeremy Evans wrote: > > 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/85a6ddd3-f85d-4351-9b63-0462abe9c9c0%40googlegroups.com.
