项目介绍

plentz/lol_dba 是一个托管在 GitHub 上的开源项目,主要使用 Ruby 编写,目前获得 1.6k 个 Star、71 次 Fork。

仓库全名
plentz/lol_dba
Star 数
1.6k
Fork 数
71
未关闭 Issue
13

README 摘要

loldba 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 loldba in the easiest way possible you have to do two things: gem install loldba Then run one of the following commands... To display a migration for adding/removing all necessary indexes based on associations…

完整内容见 GitHub 原始 README 或本页 。

常见问题

lol_dba 用什么语言开发?

主要使用 Ruby 编写,目前有 1.6k 个 Star。

如何获取 lol_dba 的源码?

可以直接克隆仓库:git clone https://github.com/plentz/lol_dba.git,默认分支为 master;安装与运行步骤见仓库 README。

lol_dba 最近还在维护吗?

仓库最近一次更新为 3月24日,当前有 13 个未关闭 Issue;Star 数为 1.6k,可作为社区活跃度的参考。

README

lol_dba ci 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, Ruby 3.x and Rails 3.x, 4.x, 5.x, 6.x, 7.x and 8.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.

评论

暂无评论