Project

columnlens

0.0
The project is in a healthy, maintained state
ColumnLens analyzes your Ruby on Rails codebase and database schema to identify actively used, write-only, read-only, and orphaned columns. Designed for CI, GitHub Actions, and continuous schema hygiene.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme

ColumnLens

Gem Version

columnlens is a CLI tool to analyze your Ruby on Rails database schema. It helps detect unused, read-only, and orphaned columns, providing insight into schema hygiene and technical debt.


✨ Features

  • Scan your full Rails database schema
  • Detect actively used, write-only, read-only, and orphaned columns
  • Respect system tables and configurable ignore rules

🧰 Installation

Add this line to your application's Gemfile:

gem 'columnlens'

Then execute:

$ bundle install

Or install it globally:

$ gem install columnlens

🚀 Usage

From any Rails project:

$ bundle exec columnlens scan

Output example:

🔍 ColumnLens Scan Mode
Scanning full schema...

posts.title          read_write
users.email          read_write
users.last_seen_at   orphaned
...

⚙️ Configuration

ColumnLens uses a .columnlens.yml in your project root:

system_tables:
  - "^active_storage_"
  - "^schema_migrations$"
  - "^ar_internal_metadata$"

ignore:
  scan:
    orphaned:
      - "posts"
      - "users.created_at"
      - "users.updated_at"
  deep:
    orphaned: []

Defaults are provided in lib/config/default.yml and merged with the project config.


🔧 Development

To set up the project locally:

$ git clone https://github.com/BestBitsLab/columnlens.git
$ cd columnlens
$ bin/setup

You can experiment with the code via:

$ bin/console

To build and install the gem locally:

$ bundle exec rake install

To release a new version:

  1. Update the version in lib/columnlens/version.rb
  2. Run:
$ bundle exec rake release

This will tag, push, and publish to RubyGems.org.


🤝 Contributing

Bug reports and pull requests are welcome on GitHub. This project is intended to be a safe, welcoming space for collaboration. Please read and follow the code of conduct.


🪪 License

This gem is available as open source under the terms of the MIT License.


📜 Code of Conduct

Everyone interacting in the ColumnLens project's codebase, issue trackers, and other community spaces is expected to follow the Code of Conduct.