Hello,

In ActiveRecord migrations I often need to migrate data after a schema 
refactoring. With ActiveRecord this is ugly, because I have to redefine a 
subset of models inside of migrations in order to write proper migrations, 
and shit gets really crazy when using STI or polymorphic associations. I 
figured Sequel would be perfect for this task.

There is just one problem. ActiveRecord migrations are run inside 
transactions, which means that a separate Sequel connection can't make 
queries until the transaction is finished. So, Sequel waits for 
ActiveRecord to finish the transaction, which will only be finished when 
the migration is done, resulting in a deadlock.

It would be great if I could somehow instantiate a Sequel connection using 
ActiveRecord's connection. I saw in the source code that 
Sequel::Postgres::Adapter is inheriting from PG::Connection. Would it be 
possible to use composition instead, and that Sequel::Postgres::Adapter 
instead *delegates* methods to a PG::Connection? I would like to be able to 
write something like this:

connection = ActiveRecord::Base.connection.raw_connection 
#=> #<PG::Connection:0x007fc77aae5f08 ...>
DB = Sequel::Postgres::Database.new(connection)

Thanks,
Janko

-- 
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to