Hi there,
Disclaimer: at the beginning it looks like this message should be on
rubyonrails-talk, but please, keep reading.
I have a Rails 3 project in which I'd like to migrate my databases with
a different database user than the one used for querying, inserting and
deleting records.
I have defined in my config/database.yml my new connections. The
situation is: test, development, test_migrations, development_migrations
are sqlite3 databases. production and production_migrations are mysql
databases.
Now, in my migrations I have the following:
def connection
ActiveRecord::Base.establish_connection("migrations_#{Rails.env}").connection
end
When running "rake db:migrate" I get using the sqlite3 adapter (test and
development) the following error:
ArgumentError: prepare called on a closed database: rollback transaction
with the following rake trace:
http://pastebin.com/2NvqzEtP
Is important to see that what actually is reporting is that it tries to
do a rollback and that is failing, but the rollback comes because a
previous operation failed.
As far as I've seen it looks like the problem is related with DDL
transactions. If I modify
activerecord-3.2.2/lib/active_record/migration.rb ddl_transaction method
with the next method:
def ddl_transaction(&block)
block.call
end
instead of
def ddl_transaction(&block)
if Base.connection.supports_ddl_transactions?
Base.transaction { block.call }
else
block.call
end
end
it seems to work fine. So the whole problem seems to be related with DDL
transactions. Any ideas ? I am willing to help if it's needed.
Best regards,
Rafael Fernández López.
--
You received this message because you are subscribed to the Google Groups "Ruby on
Rails: Core" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en.