Registry / database / generator-realm-migration

generator-realm-migration

JSON →
library1.1.7jsnpmunverified

A Yeoman generator for creating linear migration objects for Realm JS projects. Current version 1.1.7. It scaffolds migration directories with previous object schemas, migration functions, and schema version tracking. Key differentiator: automates the boilerplate for Realm migrations, reducing manual error. Release cadence is low; appears to be in maintenance mode. Integrates with Yeoman and requires a React Native setup with Realm.

npm install generator-realm-migration
INSTALL
IMPORT
SIG · GENERATOR-REALM-MI
G
generator-realm-migration
databasejavascriptv1.1.7
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.

generateMigration
import { generateMigration } from 'generator-realm-migration/generators/app'
const generateMigration = require('generator-realm-migration')
The package exposes a Yeoman generator, not a direct function. Use the CLI via 'yo realm-migration'.
initMigration
import { initMigration } from 'generator-realm-migration/generators/init'
const initMigration = require('generator-realm-migration/init')
Corresponding import for the init subgenerator.

Install and use the generator to set up Realm linear migrations in a React Native project.

// Ensure Yeoman is installed globally first: npm i -g yo // Install generator-realm-migration as a dev dependency npm i --save generator-realm-migration // Initialize migrations directory yo realm-migration:init // After adding models, run the default generator yo realm-migration --schemaDesc="updated_dog_schema"
Debug
Known issues
gotchaRequires a 'models' directory with Realm Object classes that have named exports matching file names.
fix
Ensure each model file exports the Object class with the same name as the file (without extension).
affects: *
gotchaThe default command will prompt to delete a temp directory used for transpilation. This is normal but may confuse users.
fix
Accept the prompt; it is a side effect of the generator's process.
affects: *
gotchaThe generator overwrites 'migrations/index.js' each time, which may cause loss of custom modifications.
fix
Do not manually edit migrations/index.js; treat it as auto-generated.
affects: *
gotchaYeoman must be installed globally; otherwise 'yo' command will not be found.
fix
Run 'npm i -g yo' before using the generator.
affects: *
Errors
Common errors & fixes
Error: Could not find model file: Dog.js
Missing model file in models directory or wrong directory path.
fix
Check that models directory exists and contains the expected file, or specify correct --modelDir option.
Error: Temp directory deletion failed
Permissions issue or file lock preventing deletion of temp directory.
fix
Run the generator again with admin privileges or manually delete the temp directory.
Error: Cannot find module 'generator-realm-migration'
Generator not installed or not found by Yeoman.
fix
Ensure generator-realm-migration is installed in the project: npm i --save generator-realm-migration
Upgrade
Version history
1.1.7latest on npm
Audit
Dependencies
yeoman-generatorrequiredRequired to run the generator commands (yo realm-migration)
realmoptionalRealm database dependency for migrations
Agent activity
6 hits · last 30 days
node
4
Resources
generator-realm-migration — npm install generator-realm-migration · libregistry