lol_dba

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.

Github星跟踪图

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.

主要指标

概览
名称与所有者plentz/lol_dba
主编程语言Ruby
编程语言Ruby (语言数: 1)
平台
许可证
所有者活动
创建于2012-02-28 12:31:11
推送于2024-03-07 18:47:58
最后一次提交2023-03-11 19:01:07
发布数20
最新版本名称2.4.0 (发布于 2022-08-14 11:03:13)
第一版名称1.6.5 (发布于 2015-03-15 01:18:51)
用户参与
星数1.6k
关注者数13
派生数70
提交数405
已启用问题?
问题数79
打开的问题数14
拉请求数54
打开的拉请求数3
关闭的拉请求数15
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?