Closed workgena closed 6 years ago
Hmm... we also do not have a defined schema:dump
as well. The idea here is that as other tasks call out to ActiveRecord's task, we have already enabled SecondBase as being on_base
. I wonder if we should make a _dump
tasks and that would work for both? https://github.com/rails/rails/blob/master/activerecord/lib/active_record/railties/databases.rake#L64-L77
Need to double check this(and write some test, when have some time).
In current protect we prefer to use config.second_base.run_with_db_tasks = false
and use separate command for migrations. And when run this command rake db:second_base:migrate
there was two strange mistakes:
second_base/structure.sql
somehow contained INSERT schema_migration...
from first(main) database, but the actually structure of tables was normal for second_database.When I have some time, I'll do tests fro this cases. And it will be clear what is wrong.
Ah! So yea... I kind of suspect that turning off the task shadowing opens up those issues. In some ways I would like to promote that issues like this can happen and to not use said feature or encourage documented workarounds like yours.
When I have some time, I'll do tests fro this cases. And it will be clear what is wrong.
Very cool, appreciate that. I would be open to docs only (maybe #advanced-usage section) PRs too, whatever you find is best. Our tests are pretty easy to clone and run, TravisCI will also run pull requests too. Lastly, we have a little side/demo app that is fun to play around with for quick integration checks. See here:
Thanks again!
I have database. And want to dump current state to
structure.sql
. And there is no task for this.This task also needed for migrations when set this option:
For this reason I added task:
And it works with
But dump is wrong. because of missing :environment task.
This is my fork with fix (no tests): https://github.com/workgena/secondbase/blob/master/lib/second_base/databases.rake