Registry / database / prisma-rays

prisma-rays

JSON →
library4.0.3jsnpmunverified

Alternative schema migration client for Prisma ORM, built as a drop-in replacement for prisma migrate CLI. Current stable version is 4.0.3, with frequent releases. It uses prisma migrate under the hood for schema parsing but provides a more intuitive API, better control over migrations, and Django-like workflow. Supports PostgreSQL, MySQL, and SQLite. Requires Node >=14.17 and peer dependencies @prisma/client and prisma ^4.x.

npm install prisma-rays
INSTALL
IMPORT
SIG · PRISMA-RAYS
P
prisma-rays
databasejavascriptv4.0.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default import
import rays from 'prisma-rays'
const rays = require('prisma-rays')
ESM-only package; CommonJS require not supported.
RaysConfig
import { RaysConfig } from 'prisma-rays'
const { RaysConfig } = require('prisma-rays')
Type import: import type { RaysConfig } from 'prisma-rays' for type-only usage.
MigrationFile
import { MigrationFile } from 'prisma-rays'
const MigrationFile = require('prisma-rays').MigrationFile
Named export; destructure correctly for ESM.

Shows initializing prisma-rays with config, pushing schema, creating a migration, and applying it.

import rays from 'prisma-rays'; import { PrismaClient } from '@prisma/client'; async function main() { const prisma = new PrismaClient(); // Initialize rays config const config = { prismaSchemaPath: './prisma/schema.prisma', migrationOutput: './prisma/migrations', shadowDatabaseUrl: process.env.SHADOW_DATABASE_URL ?? '', }; // Push schema to initialize database await rays.push(config); // Create and apply a new migration await rays.makeMigration(config, { name: 'add_users' }); await rays.migrate(config); await prisma.$disconnect(); } main().catch(console.error);
Debug
Known issues
breakingPrisma Rays 4.0+ requires @prisma/client and prisma ^4.x. Older versions are incompatible.
fix
Upgrade peer dependencies to ^4.x.
affects: >=4.0.0
gotchaShadow database URL must be provided explicitly; auto-generation may fail without proper permissions.
fix
Set SHADOW_DATABASE_URL in environment or config.
affects: >=0.0.0
breakingUpgrading from 1.x requires full re-initialization: run 'npx rays init' again.
fix
Delete old raysconfig.js and re-run init.
affects: >=2.0.0 <4.0.0
deprecatedThe 'prepare' command is deprecated in 4.x; use 'push' instead.
fix
Replace 'npx rays prepare' with 'npx rays push'.
affects: >=4.0.0
gotchaMixing prisma migrate and prisma-rays migrations in the same project is not supported.
fix
Stick to one migration tool; remove pre-existing migrations before switching.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'prisma-rays'
CommonJS require used instead of ESM import.
fix
Use `import rays from 'prisma-rays'` in an ESM context.
Error: rays is not a function
Default import may be mistaken for named import; the package exports a function directly.
fix
Use `import rays from 'prisma-rays'` (default import), not `import { rays } from 'prisma-rays'`.
Error: prisma is required as a peer dependency but not found
Prisma CLI not installed in project.
fix
Run `npm install prisma --save-dev`.
Error: Shadow database URL not provided
Missing SHADOW_DATABASE_URL in environment or config.
fix
Set `shadowDatabaseUrl` in raysconfig.js or provide via .env.
Upgrade
Version history
4.0.3latest on npm
Audit
Dependencies
@prisma/clientrequiredPeer dependency for accessing Prisma client during migrations
prismarequiredPeer dependency used for generating migrations under the hood
Agent activity
11 hits · last 30 days
node
10
Amazon
1
Resources
prisma-rays — npm install prisma-rays · libregistry