-
Notifications
You must be signed in to change notification settings - Fork 640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Audit to a second database #257
Comments
I think I've sorted this out in an initializer:
I noticed that the master branch and the release branch are quite different from each other, so I don't know if this will continue to work after the master branch is released. |
FYI: We ended up making an 'auditor' app which stored all our audits (we had about 100 GB which is why it had to be stored elsewhere), in our main app we tweaked audited to send the changes this app, if that is something you would be interested in I'm sure we could open source it. But it is currently running against audited for rails 3, so it probably needs a little work getting it compatible with rails 4/5. |
Thank you for offering to open source your solution! That's a much larger undertaking than is probably warranted to just help me along. If you feel that it would be useful to the audited community in general, then that would be nice - please don't go through all of that trouble just to help me out, though. Thanks! |
@JamesChevalier your solution of simply using It must add a huge caveat though, and that the magical joins of ActiveRecord will blow up spectacularly if you try to do something like @mnoack thanks indeed for the offer! Maybe in blog post form would be a great start rather than committing to a new project! Closing for now, please reopen if needed! |
I had an issue with audited v4.3.0 ... I still have a
I upgraded to version 4.3.0, then ran
Based on this commit, it looks like we should just move the call out of the namespace. So, it would go from:
to:
I made that change, and was able to verify that audits are produced when I change data.
|
@JamesChevalier I am trying to follow this approach, and I wonder how the automation of the second database should work, also for |
In my case, I'm using rails 4.2, which does not support multiple db natively, and the our first setup command |
Here to make the def self.up
- create_table :audits, force: true do |t|
+ Audited::Audit.connection.create_table :audits, force: true do |t|
t.column :auditable_id, :integer
t.column :auditable_type, :string
... It's also required to create an entry in the |
@Marinofull is it possible to utilize Rails 6 multi-db setup? I have:
but get the error:
|
I dont know, my application is now on 5.2, which has different dependencies |
I'd like to send all of my audited data to an
audits
table that resides in another database. For regular Rails models, I'm able to addestablish_connection "audit_database_#{Rails.env}".to_sym
to the file & add aaudit_database_production
entry to the database.yml file.Is this possible within audited?
The text was updated successfully, but these errors were encountered: