-
-
Notifications
You must be signed in to change notification settings - Fork 47
Non Rails projects
Evgeniy Demin edited this page Nov 25, 2022
·
1 revision
For projects that use ActiveRecord, you can copy the following code and create a file database_consistency_runner.rb
.
# First of all, you need to load all models
# The following example is for Rails, but it can be anything
# require_relative 'config/environment'
# Rails.application.eager_load!
# Now start the check
config = ['.database_consistency.yml'] # default configuration, you can have many, just list it here
# Provide single or no option to the runner
options = {
# Set this to true when you want to auto-fix issues instead
# autofix: true,
# Set this to true when you want to generate a TODO file instead
# todo: true
}
require 'database_consistency'
result = DatabaseConsistency.run(config, **options)
exit result
Now, just start the script with:
$ bundle exec ruby database_consistency_runner
If the project helps you or your organization, I would be very grateful if you contribute or donate. Your support is an incredible motivation and the biggest reward for my hard work.
- Home
- Installation
- How to run?
- Configuration
- Auto correction
- Integrations
- Checkers
- ColumnPresenceChecker
- LengthConstraintChecker
- NullConstraintChecker
- UniqueIndexChecker
- ForeignKeyChecker
- MissingUniqueIndexChecker
- MissingIndexChecker
- PrimaryKeyTypeChecker
- ForeignKeyTypeChecker
- RedundantIndexChecker
- RedundantUniqueIndexChecker
- EnumTypeChecker
- ForeignKeyCascadeChecker
- EnumValueChecker
- CaseSensitiveUniqueValidationChecker
- ThreeStateBooleanChecker
- MissingAssociationClassChecker
- MissingTableChecker
- ImplicitOrderingChecker
- FAQ
- Development