Check whether a database column is still referenced in your codebase before you delete it
Project description
colref
Check whether a database column is still referenced in your codebase before you delete it.
Why
You want to remove a column from a long-running system. The column looks unused, but you're not sure. A full-text search returns hits inside comments, test fixtures, and migration history — noise that makes it hard to tell whether the column is actually read or written in live code.
colref scans your codebase with an AST parser, skips comments and string literals, and tells you where the column is referenced. If it finds nothing, you have a concrete starting point for the deletion decision. The final call is yours.
Installation
pip / pipx (Python users)
If you are working on a Django or Python project, the easiest way to install colref is via pip or pipx. No Go installation required.
pipx install colref
Or with pip:
pip install colref
| OS | x86_64 (Intel/AMD) | arm64 |
|---|---|---|
| macOS | ✓ | ✓ (Apple Silicon) |
| Linux | ✓ | ✓ |
| Windows | ✓ | — |
gem (Ruby users)
If you are working on a Rails or Ruby project, install via gem. No Go installation required.
gem install colref
Homebrew (macOS and Linux)
brew install shinagawa-web/tap/colref
If you prefer to tap first:
brew tap shinagawa-web/tap
brew install colref
One-line installer (Linux and macOS)
curl -fsSL https://raw.githubusercontent.com/shinagawa-web/colref/main/install.sh | sh
Manual download
Pre-built binaries are available on the releases page.
For full installation options, see Getting started.
Usage
colref check --orm <orm> --model <Model> --field <field> [path]
path is the project root to scan (default: current directory).
| Flag | Description |
|---|---|
--orm |
ORM type: django, rails (required) |
--model |
Model name to look up (required) |
--field |
Field name to search for (required) |
Example:
$ colref check --orm django --model Page --field seo_title
Scanning 932 files...
References found for Page.seo_title
wagtail/admin/tests/pages/test_create_page.py:1867 page.seo_title
wagtail/admin/tests/pages/test_create_page.py:1892 page.seo_title
For ORM-specific behavior and more examples, see Django and Rails.
Limitations
colref uses static AST analysis and cannot detect every reference pattern. References where the field name is constructed at runtime (e.g. getattr(obj, field_name)) are out of scope by design.
If colref reports no references, treat it as "none found by the scanner" — not as a guarantee the column is unused.
For the full per-pattern breakdown, see Detection patterns and Limitations.
Roadmap
See issue #74.
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file colref-0.7.9-py3-none-win_amd64.whl.
File metadata
- Download URL: colref-0.7.9-py3-none-win_amd64.whl
- Upload date:
- Size: 4.3 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
899c7fb47ad5de2281958af0cbdc38e80d9ca161082304282a83e5db7a0375cf
|
|
| MD5 |
6bd47d9daa3dda48a98fbb188a084ef8
|
|
| BLAKE2b-256 |
bd6d577b52e73f7a3f938f667e2692b58a8b39a6bc27c394a01df42a74f84cb0
|
Provenance
The following attestation bundles were made for colref-0.7.9-py3-none-win_amd64.whl:
Publisher:
release.yml on shinagawa-web/colref
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
colref-0.7.9-py3-none-win_amd64.whl -
Subject digest:
899c7fb47ad5de2281958af0cbdc38e80d9ca161082304282a83e5db7a0375cf - Sigstore transparency entry: 1674276764
- Sigstore integration time:
-
Permalink:
shinagawa-web/colref@3d5ac4ab26c6ff859d3e0298ad62be87af8241ca -
Branch / Tag:
refs/tags/v0.7.9 - Owner: https://github.com/shinagawa-web
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3d5ac4ab26c6ff859d3e0298ad62be87af8241ca -
Trigger Event:
push
-
Statement type:
File details
Details for the file colref-0.7.9-py3-none-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: colref-0.7.9-py3-none-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 4.2 MB
- Tags: Python 3, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67bb3438f693b36880022d7ce2d480e000d48c49b0c5ffdc656a3023c03932cd
|
|
| MD5 |
d5b4de9c0391917f658d0167b9bad3dd
|
|
| BLAKE2b-256 |
c8d9bccbebec4d901d142ee3c097f89964aaac56e2460eccb71bf513762c90ea
|
Provenance
The following attestation bundles were made for colref-0.7.9-py3-none-manylinux_2_34_x86_64.whl:
Publisher:
release.yml on shinagawa-web/colref
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
colref-0.7.9-py3-none-manylinux_2_34_x86_64.whl -
Subject digest:
67bb3438f693b36880022d7ce2d480e000d48c49b0c5ffdc656a3023c03932cd - Sigstore transparency entry: 1674276559
- Sigstore integration time:
-
Permalink:
shinagawa-web/colref@3d5ac4ab26c6ff859d3e0298ad62be87af8241ca -
Branch / Tag:
refs/tags/v0.7.9 - Owner: https://github.com/shinagawa-web
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3d5ac4ab26c6ff859d3e0298ad62be87af8241ca -
Trigger Event:
push
-
Statement type:
File details
Details for the file colref-0.7.9-py3-none-manylinux_2_34_aarch64.whl.
File metadata
- Download URL: colref-0.7.9-py3-none-manylinux_2_34_aarch64.whl
- Upload date:
- Size: 3.9 MB
- Tags: Python 3, manylinux: glibc 2.34+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34ad4293b2f3d0c9a1917e18193623ec4720a7b6d974fbbc29e3e48d39167054
|
|
| MD5 |
32846861dd9297def426758256dedef7
|
|
| BLAKE2b-256 |
5a79316105ffe2ae3277b11d207d41eb7b10d0f9745c928f0b46da162d4834ab
|
Provenance
The following attestation bundles were made for colref-0.7.9-py3-none-manylinux_2_34_aarch64.whl:
Publisher:
release.yml on shinagawa-web/colref
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
colref-0.7.9-py3-none-manylinux_2_34_aarch64.whl -
Subject digest:
34ad4293b2f3d0c9a1917e18193623ec4720a7b6d974fbbc29e3e48d39167054 - Sigstore transparency entry: 1674276612
- Sigstore integration time:
-
Permalink:
shinagawa-web/colref@3d5ac4ab26c6ff859d3e0298ad62be87af8241ca -
Branch / Tag:
refs/tags/v0.7.9 - Owner: https://github.com/shinagawa-web
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3d5ac4ab26c6ff859d3e0298ad62be87af8241ca -
Trigger Event:
push
-
Statement type:
File details
Details for the file colref-0.7.9-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: colref-0.7.9-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 4.2 MB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
30703833481f555156752078cdf4831be92adeef37f814f76d076ab0c7dc384e
|
|
| MD5 |
8768472f0f80f8ec7cf1869e06db9e7a
|
|
| BLAKE2b-256 |
8fcec610a6c06cf0c4491b1c3ff93d271792653163a38174c5dfb014b3cf0312
|
Provenance
The following attestation bundles were made for colref-0.7.9-py3-none-macosx_11_0_arm64.whl:
Publisher:
release.yml on shinagawa-web/colref
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
colref-0.7.9-py3-none-macosx_11_0_arm64.whl -
Subject digest:
30703833481f555156752078cdf4831be92adeef37f814f76d076ab0c7dc384e - Sigstore transparency entry: 1674276706
- Sigstore integration time:
-
Permalink:
shinagawa-web/colref@3d5ac4ab26c6ff859d3e0298ad62be87af8241ca -
Branch / Tag:
refs/tags/v0.7.9 - Owner: https://github.com/shinagawa-web
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3d5ac4ab26c6ff859d3e0298ad62be87af8241ca -
Trigger Event:
push
-
Statement type:
File details
Details for the file colref-0.7.9-py3-none-macosx_10_9_x86_64.whl.
File metadata
- Download URL: colref-0.7.9-py3-none-macosx_10_9_x86_64.whl
- Upload date:
- Size: 4.5 MB
- Tags: Python 3, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
236ebae66d73ee549b7a92097139001b211b547530eb688ef0a117a4a416e78d
|
|
| MD5 |
cae0eeae5a27b5a47fc1a395cd9b1d4b
|
|
| BLAKE2b-256 |
da540f8c34add2e44c8cda4d6d90680211c6693e368735fd0ef626fd10576424
|
Provenance
The following attestation bundles were made for colref-0.7.9-py3-none-macosx_10_9_x86_64.whl:
Publisher:
release.yml on shinagawa-web/colref
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
colref-0.7.9-py3-none-macosx_10_9_x86_64.whl -
Subject digest:
236ebae66d73ee549b7a92097139001b211b547530eb688ef0a117a4a416e78d - Sigstore transparency entry: 1674276654
- Sigstore integration time:
-
Permalink:
shinagawa-web/colref@3d5ac4ab26c6ff859d3e0298ad62be87af8241ca -
Branch / Tag:
refs/tags/v0.7.9 - Owner: https://github.com/shinagawa-web
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3d5ac4ab26c6ff859d3e0298ad62be87af8241ca -
Trigger Event:
push
-
Statement type: