GithubHelp home page GithubHelp logo

cambero / lol_dba Goto Github PK

View Code? Open in Web Editor NEW

This project forked from plentz/lol_dba

0.0 2.0 0.0 382 KB

lol_dba is a small package of rake tasks that scan your application models and displays a list of columns that probably should be indexed. Also, it can generate .sql migration scripts.

Ruby 100.00%

lol_dba's Introduction

lol_dba travis Maintainability Test Coverage

lol_dba is a small package of rake tasks that scan your application models and displays a list of columns that probably should be indexed. Also, it can generate .sql migration scripts.

Quick example

To use lol_dba in the easiest way possible you have to do two things:

gem install lol_dba

Then run one of the following commands...

To display a migration for adding/removing all necessary indexes based on associations:

lol_dba db:find_indexes

To generate .sql files for your migrations inside db/migrate_sql folder:

lol_dba db:migrate_sql # defaults to all migrations
lol_dba db:migrate_sql[pending] # only pending migrations
lol_dba db:migrate_sql[20120221205526] # generate sql only for migration 20120221205526

Not-so-quick example

If you want to use lol_dba with rake, you should do a few more steps:

Add lol_dba to your Gemfile

gem "lol_dba"

Run the install command

bundle install

Use it the same way you use other rake commands

rake db:find_indexes
rake db:migrate_sql # defaults to all migrations
rake db:migrate_sql[pending] # only pending migrations
rake db:migrate_sql[20120221205526] # generate sql only for migration 20120221205526

Compatibility

Compatible with Ruby 2.x and Rails 3.x, 4.x, 5.x.

About primary_key

The primary key is always indexed. This is generally true for all storage engines that at all supports indexes.

For this reason, we no longer suggest to add indexes to primary keys.

Tests

To run lol_dba tests, just clone the repo and run:

bundle install && rake

Contributors

Most of the initial code came from rails_indexes and migration_sql_generator. Other people helped as well.

License

Lol DBA is released under the MIT license.

lol_dba's People

Contributors

plentz avatar cmason avatar edavis10 avatar warpc avatar fgrehm avatar olleolleolle avatar pikachuexe avatar amnesia7 avatar sadfuzzy avatar ivanovaleksey avatar alebruck avatar andersoncardoso avatar andrew avatar andyw8 avatar chmurph2 avatar efueger avatar jamesbowles avatar skunkworker avatar tapajos avatar a2ikm avatar rzane avatar

Watchers

Cambero avatar James Cloos avatar

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.