{"id":13879457,"url":"https://github.com/umbrellio/sequel-bulk-audit","last_synced_at":"2025-05-06T19:22:49.214Z","repository":{"id":56894996,"uuid":"124838746","full_name":"umbrellio/sequel-bulk-audit","owner":"umbrellio","description":"Sequel plugin for tracking changes in your data.","archived":false,"fork":false,"pushed_at":"2020-03-04T14:05:33.000Z","size":47,"stargazers_count":4,"open_issues_count":3,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-30T13:45:21.442Z","etag":null,"topics":["audit","changes","logging","sequel"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/umbrellio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-12T05:39:20.000Z","updated_at":"2020-06-15T17:51:11.000Z","dependencies_parsed_at":"2022-08-20T17:10:24.741Z","dependency_job_id":null,"html_url":"https://github.com/umbrellio/sequel-bulk-audit","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umbrellio%2Fsequel-bulk-audit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umbrellio%2Fsequel-bulk-audit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umbrellio%2Fsequel-bulk-audit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umbrellio%2Fsequel-bulk-audit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/umbrellio","download_url":"https://codeload.github.com/umbrellio/sequel-bulk-audit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223793107,"owners_count":17203752,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audit","changes","logging","sequel"],"created_at":"2024-08-06T08:02:21.717Z","updated_at":"2024-11-09T06:24:30.771Z","avatar_url":"https://github.com/umbrellio.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# sequel-bulk-audit [![Gem Version](https://badge.fury.io/rb/sequel-bulk-audit.svg)](https://badge.fury.io/rb/sequel-bulk-audit) [![Build Status](https://travis-ci.org/umbrellio/sequel-bulk-audit.svg?branch=master)](https://travis-ci.org/umbrellio/sequel-bulk-audit)\n\nThis gem allows you to track any changes in your tables. This approach is not only suitable for model updates but also enables you to track dataset updates.\n\nMethod #with_current_user expects current_user to be an object (or record) having attributes id and login. It sets user_id as 0 and login as \"unspecified\" by default.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'sequel-bulk-audit'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install sequel-bulk-audit\n\nAfter installation you should run ```rails g audit_migration``` generator.\n\nYou can exdend this migration by attaching the trigger to audited tables.\n\nPlease note, that this gem reqires pg_array and pg_json sequel extensions to work.\n\n## Usage\n\nModels with audited changes should contain:\n\n```ruby\nplugin :bulk_audit\n```\n\nMethod #with_current_user should wrap all the operations on the table. You must use method from the model you are changing for this gem to work correclty. \n\nKeep in mind that everything wraped in #with_current_user will happen in one transaction.\n\nCorrect usage:\n\n```ruby\nModel.with_current_user(current_user) do\n  Model.where(...).update(...)\nend\n```\n\nCorrect usage for several models in one transaction:\n\n```ruby\nDB.transaction do\n  Model.with_current_user(current_user) do # will create temp table for model\n    Model.where(...).update(...)\n  end\n\n  OtherModel.with_current_user(current_user) do # will create temp table for other_model\n    OtherModel.where(...).update(...)\n  end\nend\n```\n\nIncorrect usage:\n\n```ruby\nSomeOtherModel.with_current_user(current_user) do\n  Model.where(...).update(...)\nend\n```\n\n## Migration from 0.2.0 to 1.0.0\n\nRecreate audit_changes() function with new changes.\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/umbrellio/sequel-bulk-audit.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fumbrellio%2Fsequel-bulk-audit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fumbrellio%2Fsequel-bulk-audit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fumbrellio%2Fsequel-bulk-audit/lists"}