Code Monkey home page Code Monkey logo

db_documenter's Introduction

DatabaseDocumenter

Welcome to Database Documenter gem! We created this gem to generate database documentation for rails applications.

Features

  1. Generate database documentation as a Word document or Markdown file.
  2. Generate Description for columns based on it is type and name, Also handle Enums and STI and AASM.
  3. Easy to change the generated description by adding a comment on your database.
  4. Hide sample values of desired columns using configuration.
  5. You can Ignore models inside certain namespaces.
  6. 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
end

Usage

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 --install before working to run RuboCop before push.
  • Create Pull Request.

TODO

  • Generate the ERD with the file.
  • Add test cases.
  • Update DatabaseDocumenter::TableData to return the sql_code as a String.

db_documenter's People

Contributors

ahmedyehia avatar asmaa-hassaan avatar ma7dy avatar morxander avatar oabubakr avatar yasmine-gaber avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

db_documenter's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.