Lint Prisma migrations is a github action that can lint the names of your Prisma Migrations based on a set of rules. The action was originally developed for SIDESTREAM.
This action currently supports the following rules:
format
: The name of the migration folder matchesYYYYMMDDHHMMSS_YOUR_MIGRATION_NAME
date
: The date specified inside the migration name is not in the futuremissing
: The migration folder contains amigration.sql
filelink
: The migration begins with a link to the PR it was added it:-- https://github.com/ORG/REPO/pull/NUMBER
transaction
: The migration is wrapped with aBEGIN;
andCOMMIT;
transaction block
jobs:
check-migrations-folder:
runs-on:
group: ubuntu-large-4CPU-16RAM
steps:
- uses: actions/checkout@v4
- name: Validate prisma migration folder names
uses: sidestream-tech/lint-prisma-migrations@1.1.0
with:
path: ./prisma/migrations/
rules: |
format
date
missing
link
transaction
ignore: |
20260101000000_ignore_me
20270101000000_ignore_me_too
The path to the Prisma migrations folder.
A multiline input of migration names to ignore. Helpful if these were already applied and their naming cannot be fixed.
A multiline input of the rules you would like to run again your migrations. If not set all rules with be enabled by default.
# Install dependencies
pnpm install
# Run unit tests
pnpm test
# Build the project
pnpm build
# Package the build (run after `pnpm build`)
pnpm package
This action was inspired by https://github.com/batista/lint-filenames