Project

care_bert

0.0
No commit activity in last 3 years
No release in over 3 years
CareBert analyzes the current items of your database and performs differing validation and integrity tests. Currently it supports following checks: \n - Table Integrity => check each single model-instance of all available tables can be loaded \n - Model Validation => triggers the validation of each single model-instance (which results might have changed due code-modifications) \n - Missing Assocs => tries to load each instance of an assoc, if the foreign_key is set (having a present FK doesn't mean it really has the targeted model available)
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 3
 Project Readme

CareBert

Gem Version Build Status

This project rocks and uses MIT-LICENSE.

Any features missing? write your suggestions as issue or create a pull-request.

Usage

Overview of provided Rake Tasks

rake -T

rake care_bert:missing_assocs      # Checks all belongs_to-associations of all instances and checks presence of model if foreign-key is set
rake care_bert:table_integrity     # Tries to load all instances and tracks failures on load
rake care_bert:validate_models     # Run model validations on all model records in database

care_bert:table_integrity

Tries to load all instances and tracks failures on load. This might occur, if there is invalid data on a serialized field (e.g. Hash) that can't be loaded by ActiveRecord.

It is strongly recommended to perform this rake task before any other one.

rake care_bert:table_integrity

-- records - broken instances - model --
      5182 -                0 - Tweet
       314 -                0 - Photo
       278 -                0 - User

care_bert:missing_assocs

Checks all belongs_to-associations of all instances and checks presence of model if foreign-key is set.

rake care_bert:missing_assocs

Daniel-DL-1307:paij-backend danielloy$ rake care_bert:missing_assocs
-- records - broken instances - model --
      5182 -                0 - Tweet
       314 -                1 - Photo
       278 -                0 - User

Listing ids of missing model-instances of assocs:
-------------------------------------------------------
- Photo --------------
>> affected_instances: [1]
 -  1    >> {:user=>1231234}

care_bert:validate_models

Run model validations on all model records in database. Sums up all ids of failing models by the combined validation-errors.

rake care_bert:validate_models

-- records - broken instances - model --
      5182 -                0 - Tweet
       314 -                0 - Photo
       278 -                7 - User

User:
["Name is missing"] >> [18, 42, 58, 95]
["Name is missing", "E-Mail contains invalid characters"] >> [12, 128, 229]

Agenda

  • Add Tests (with edge cases, securing rails3 and rails4 compat)
  • integrate Travis CI
  • fancy badges..
  • (optional:) create tasks, that delete troubling model-instances
  • apply rubocop via git-hook
  • apply generic primary_key as lookup instead of static "id"
  • refactor each single rake task to standalone class with perform method
  • add care_bert rake task, that triggers all checks (also as non verbose report, so it can be used with capistrano deploys)
  • optional: write reports into log files in temp folder or on given destination

Credits

This gem is also inspired from: http://blog.hasmanythrough.com/2006/8/27/validate-all-your-records https://github.com/joshsusser