Aalexbit-codemod

prisma-to-drizzle-planner

Assist coding agents with the migration process of Prisma to Drizzle by detecting all Prisma related code.

prismadrizzlemigrationdetectionmining
PRO
2 executions
0 stars
How to Use
Run this codemod on your codebase using one of the following commands
Codemod PRO

This codemod is only available to PRO users.

Documentation

Prisma to Drizzle Planner

A mining codemod designed to assist with the migration process from Prisma to Drizzle by detecting and cataloging all Prisma-related code patterns across your codebase.

Overview

This codemod scans your TypeScript and TSX files to identify all Prisma usage patterns, including imports, client instantiations, query methods, transactions, raw queries, type annotations, and more. It outputs structured detection results that can be aggregated into a comprehensive markdown report, making it easy for coding agents and developers to understand the full scope of the migration.

Key Features

📊 Comprehensive Code Mining

This codemod detects and catalogs all Prisma-related code patterns, including:

  • Imports: @prisma/client, @prisma/adapter
  • Client Instantiation: new PrismaClient(), $connect, $disconnect
  • Query Methods: findMany, findFirst, findUnique, create, update, upsert, delete, count, aggregate, groupBy, and more
  • Transactions: $transaction calls
  • Raw Queries: $queryRaw, $executeRaw, $queryRawUnsafe, $executeRawUnsafe
  • SQL Helpers: Prisma.sql, Prisma.join, Prisma.raw, Prisma.empty
  • Extensions: $extends usage
  • Type Usage: Prisma type annotations, type aliases, PrismaClient type references
  • Relations: connect, disconnect, connectOrCreate, set operations
  • JSON Values: Prisma.JsonNull, Prisma.JsonValue, Prisma.DbNull, Prisma.AnyNull

📝 Markdown Report Generation

The codemod outputs detection results as JSON lines, which can be aggregated into a markdown file containing:
This markdown format makes it:

  • Easy and fast for coding agents to consume - Structured format that agents can parse and understand
  • Comprehensive coverage - Ensures no Prisma code patterns are missed during migration planning
  • Human-readable - Developers can quickly review and understand the migration scope

📈 Migration Planning & Tracking

The detection results enable:

  • Codemod Insights: Analyze patterns across your codebase to understand migration complexity
  • Customizable Dashboards: Track migration progress, identify high-impact files, and prioritize work
  • Reliable Automation: Plan and execute code maintenance projects at any scale with confidence

Usage

Contact us to access this pro codemod.

Output Format

The codemod outputs JSON lines (one per detection) with the following structure:

plaintext

The aggregated markdown report organizes these detections by file, making it easy to see all Prisma usage in a single location.

Benefits for Coding Agents

This mining codemod is specifically designed to support AI-powered migration assistance:

  1. Complete Coverage: Ensures coding agents have visibility into all Prisma patterns, preventing missed migrations
  2. Structured Data: Markdown formats are easily parseable by AI tools
  3. Precise Locations: Line numbers enable agents to make targeted changes

Codemod Platform Integration

This codemod is part of the Codemod Platform, which provides specialized skills and tools for planning, tracking, and reliably automating code maintenance projects at any scale.

Get a Demo

Reach out to the Codemod team to see a live demo of how you can use the Codemod platform and specialized skills like this Prisma to Drizzle planner to:

  • Plan your migration with comprehensive code analysis
  • Track progress with customizable dashboards and insights
  • Automate the migration process reliably at scale

The Codemod platform enables teams to tackle large-scale migrations with confidence, providing visibility, automation, and tracking capabilities that make complex code maintenance projects manageable.

Ready to contribute?

Build your own codemod and share it with the community.