Registry / database / dynamo-migrate

dynamo-migrate

JSON →
library1.0.7jsnpmunverified

Migration tool for AWS DynamoDB, version 1.0.7. It provides a simple CLI to create, apply, and revert database schema or data migrations stored as JavaScript files. Designed for Node.js >= 5.5.0 and uses environment variables for AWS credentials, table prefix, and DynamoDB endpoint. Differentiates from other DynamoDB migration tools by offering a lightweight, file-based approach with support for custom migration folders and table names, and optional babel-register for ES6 syntax. Release cadence appears low; package has not been updated recently.

npm install dynamo-migrate
INSTALL
IMPORT
SIG · DYNAMO-MIGRATE
D
dynamo-migrate
databasejavascriptv1.0.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.

migrate CLI
✓ ./node_modules/.bin/migrate create "name"
✗ npx migrate create "name"
The package exposes a CLI binary, not a library. Use the installed binary directly or via npm scripts.

Install and run a migration: create, edit, apply up, and revert down.

npm install dynamo-migrate export DYNAMO_PREFIX=myapp_ export AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} export AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} export AWS_REGION=us-west-2 ./node_modules/.bin/migrate create "add users table" # then edit migrations/001-add-users-table.js export const up = async (DynamoDB) => { const params = { TableName: `${process.env.DYNAMO_PREFIX}users`, KeySchema: [{ AttributeName: 'id', KeyType: 'HASH' }], AttributeDefinitions: [{ AttributeName: 'id', AttributeType: 'S' }], ProvisionedThroughput: { ReadCapacityUnits: 5, WriteCapacityUnits: 5 } }; await DynamoDB.createTable(params).promise(); }; export const down = async (DynamoDB) => { await DynamoDB.deleteTable({ TableName: `${process.env.DYNAMO_PREFIX}users` }).promise(); }; ./node_modules/.bin/migrate up ./node_modules/.bin/migrate down 001-add-users-table
Debug
Known issues
gotchaRequires AWS credentials via environment variables; not suitable for IAM roles or Lambda environments without additional setup.
fix
Set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY, or use a credential chain if available.
affects: *
breakingTable prefix is mandatory via DYNAMO_PREFIX; migrations table name is prefixed as well.
fix
Always set DYNAMO_PREFIX environment variable, e.g., 'myapp_'.
affects: *
Errors
Common errors & fixes
Missing required environment variable: DYNAMO_PREFIX
The DYNAMO_PREFIX env var is not set.
fix
export DYNAMO_PREFIX=your_prefix_
AccessDeniedException: User: arn:aws:iam::... is not authorized to perform: dynamodb:CreateTable
AWS credentials lack permissions for DynamoDB operations.
fix
Ensure IAM policy includes dynamodb:CreateTable, dynamodb:DeleteTable, etc.
Upgrade
Version history
1.0.7latest on npm
Audit
Dependencies
aws-sdkrequiredRequired to interact with DynamoDB.
Agent activity
15 hits · last 30 days
node
14
Resources
dynamo-migrate — npm install dynamo-migrate · libregistry