Registry / database / migrei

migrei

JSON →
library1.1.0jsnpmunverified

Migrei is a lightweight SQL migration library for PostgreSQL databases, currently at version 1.1.0. It provides a simple CLI to apply and rollback SQL migration scripts stored in a local folder. Unlike other migration tools, Migrei does not require a global installation and can be executed via npx. It automatically generates rollback statements, eliminating the need to write reverse queries. The library reads database connection details from a .env file and supports batch processing of migration files. Its release cadence is currently unknown as it's a newer project with limited releases.

npm install migrei
INSTALL
IMPORT
SIG · MIGREI
M
migrei
databasejavascriptv1.1.0
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.

migrei CLI
npx migrei up
npm install -g migrei && migrei up
Recommended usage via npx to avoid global install

Shows how to create a migration file, configure the database URL, and run the up command.

# Create migrations folder mkdir -p migrations # Add migration file cat > migrations/001_create_table_users.sql <<EOF CREATE TABLE users ( id SERIAL PRIMARY KEY, name VARCHAR(255) NOT NULL ); EOF # Set up .env with your database URL echo 'DATABASE_URL=postgres://user:pass@localhost:5432/mydb' > .env # Apply migrations npx migrei up
Debug
Known issues
gotchaMigrei reads database configuration from .env file in the execution folder only.
fix
Ensure .env file exists in the current working directory with correct DATABASE_URL variable.
affects: >=1.0.0
gotchaMigration files must be named in alphabetical order, typically with numeric prefixes like 001.sql.
fix
Rename migration files to follow the pattern: 001_*.sql, 002_*.sql, etc.
affects: >=1.0.0
gotchaMigrei does not support custom migration folder paths; it always looks in ./migrations.
fix
Place all migration SQL files in a folder named 'migrations' at the project root.
affects: >=1.0.0
Errors
Common errors & fixes
DATABASE_URL is not defined
Missing .env file or DATABASE_URL variable not set.
fix
Create a .env file with DATABASE_URL=postgres://user:pass@host:port/db
ENOENT: no such file or directory, open './migrations'
The migrations folder does not exist or is named differently.
fix
Create a folder named 'migrations' in the current working directory.
Error: Migration files not found in ./migrations
Migrations folder is empty or contains files with unsupported extensions (only .sql).
fix
Add .sql files to the ./migrations folder.
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
Resources
packagemigrei
migrei — npm install migrei · libregistry