dynamodb-migrations-tool

The dynamodb-migrations-tool is a DynamoDB storage based migrator implemented on top of the relyable and well tested framework agnostic migration tool umzug.

Usage no npm install needed!

<script type="module">
  import dynamodbMigrationsTool from 'https://cdn.skypack.dev/dynamodb-migrations-tool';
</script>

README

dynamodb-migrations-tool Build Status Coverage Status npm version

The dynamodb-migrations-tool is a DynamoDB storage based migrator implemented on top of the relyable and well tested framework agnostic migration tool umzug.

Installation

npm install dynamodb-migrations-tool --save

Usage

The following example demonstrate a minimal usage of the migrator:

const {defaultMigrator} = require('dynamodb-migrations-tool');

(async () => {
  // checks migrations and run them if they are not already applied
  await defaultMigrator.up();
  console.log('All migrations performed successfully');
})();

Using example bellow you can create a migrator instance with a couple migratorOptions:

const {migratorFactory} = require('dynamodb-migrations-tool');

const migrator = migratorFactory({
  migrationTable: 'migrations' // default
});

(async () => {
  await migrator.up();
})();

Migrator Options

The possible migratorOptions are:

{
  // The configured DynamoDB DocumentClient instance from aws-sdk.
  // Optional. If omited it will be created with default aws-sdk config.
  dynamodb: DynamoDB.DocumentClient,

  // Custom DynamoDB migration table name, can be populated with stage and stuff.
  // Optional. Default value is `migrations`.
  migrationTable: String,
}