Hello,

In ActiveRecord migrations I often need to move data due to schema 
refactoring. Using ActiveRecord for that is ugly, because I have to 
redefine subset of models inside of migration files, and shit gets really 
crazy when you have STI or polymorphic associations. I realized Sequel 
would be perfect for this task.

There is just one problem: all ActiveRecord migrations are run inside a 
transaction, which means that a Sequel::Postgres::Database instance, which 
holds a separate database connection, can't execute queries. Sequel is 
waiting for the transaction to finish, while ActiveRecord will finish the 
transaction only when the migration finishes, resulting in a deadlock.

I was thinking that it would be great if I could somehow pass the same 
connection to Sequel. I was looking in the source code, and I saw 
Sequel::Postgres::Adapter is inheriting from PG::Connection. Could it maybe 
be implemented in a way that it uses composition, delegating everything to 
a PG::Connection instance? I would like to be able to write something like:

connection = ActiveRecord::Base.connection.raw_connection 
#=> #<PG::Connection:0x007fc77aae5f08 ...>
DB = Sequel::Postgres::Adapter.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