DatabaseDocumenter
Welcome to Database Documenter gem! We created this gem to generate database documentation for rails applications.
Features
- Generate database documentation as a 
Word documentorMarkdown file. - Generate Description for columns based on it is type and name, Also handle Enums and STI and AASM.
 - Easy to change the generated description by adding a comment on your database.
 - Hide sample values of desired columns using configuration.
 - You can Ignore models inside certain namespaces.
 - Works on MySQL and PostgreSQL database.
 
Installation
gem 'database_documenter'And then execute:
$ bundle install
Configuration
To generate the gem configuration file run this rake task in the application directory
$ bundle exec rake generate_dd_initializer
or create the configuration file manually in this path config/initializers/database_documenter.rb :
DatabaseDocumenter.configure do |config|
  config.skipped_modules = %w(NAMESPACE)
  config.hidden_values_columns = %w(col1 col2)
  config.footer = "Generated by Company" # Footer beside the pagination
endUsage
To Generate the Word document
In the application directory run this rake task and then you will find a word document named database.docx in your application directory:
$ bundle exec rake generate_db_document
To Generate the Markdown file
Run the following rake task and then you will find a markdown file named database.md in your application directory:
$ bundle exec rake generate_db_md_document
Override generated description
You can override it by adding comment to your schema using one of the following options:
Rails 4
use migration comments gem or pg_comment
Rails 5.2 / Rails 6.0
use change_column_comment and change_table_comment methods in rails 5 / rails 6
Contribution
- Fork & create a branch
 - bundle install
 - Make sure to run 
overcommit --installbefore working to run RuboCop before push. - Create Pull Request.
 
TODO
- Generate the ERD with the file.
 - Add test cases.
 - Update 
DatabaseDocumenter::TableData to return thesql_codeas aString.