Apply linter only on migrations after specific version

Open
#191 2 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
38/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
postgresql, rust
Domain
cli, databases, tooling

Research direction

Start at the CLI entry point for squawk ./migrations and trace how migration filenames are discovered and linted. Add support for a version threshold so files numbered below it are skipped, then verify that the example command checks only migrations from version 2 onward. Add or update tests for the filtering behavior.

Written by the indexing model from the issue text.

Description

enhancement

I'd like to exclude old .sql files from the linter check to integrate it in our pipeline. The reason being that I want to fail the build if squawk complains, but I don't want to touch the older migration files since the system is in production atm. Is there any way to do this atm or does it require a new feature implementation?

fwiw, the migrations folder looks like this (which I believe it is pretty standard):

./migrations/
  /0001_main_table.up.sql
  /0001_main_table.down.sql
  /0002_new_table.up.sql
  /0002_new_table.up.sql
  /0003_add_param_new_table.up.sql
  /0003_add_param_new_table.down.sql

And I'd like to have a catch all command that would only check the migrations after a certain version, e.g. $ squawk ./migrations ---from-version 2, which would lint the migration files 0002_* and 0003_* only.

This could also be accomplished by adding a degree of indirection by calling a bash script that calls squawk explicitly for each file in the migrations folder after a certain version. However, I think this would be a neat feature to include natively.

Dominant language
Rust
Stars
1.2k
Forks
70
Avg merge
52m
Merged PRs (30d)
47

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from sbdchd/squawk

All issues in sbdchd/squawk

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.