serverless-plugin-umzug

1.3.0 • Public • Published

Umzug Plugin for Serverless

Plugin for the serverless framework to run DynamoDB migrations using umzug.

Installation

npm install --save serverless-plugin-umzug

Configuration

Enable the plugin:

plugins:
 - serverless-plugin-additional-stacks

By default, the plugin will create a DynamoDB table called migrations. This can be overidden by providing a custom configuration:

custom:
  umzug:
    tablename: my-migrations-table

Usage

List pending migrations

$ serverless migrations pending
No pending migrations

Create a new migration

Create a new file under migrations/ with a timestamp prefix, e.g.:

migrations/2019-06-05-15-39-04-dummy-migration.js

module.exports = {
  up: function () {
    // Describe how to achieve the task.
    return Promise.resolve();
  },
 
  down: function () {
    // Describe how to revert the task.
    return Promise.resolve();
  },
};
$ serverless migrations pending
Pending migrations
--------------------------------------
2019-06-05-15-39-04-dummy-migration.js

Run pending migrations

$ serverless migrations up
..
Executed 'up' of 1 migrations
--------------------------------------
2019-06-05-15-39-04-dummy-migration.js

Show migration history

$ serverless migrations history
Executed migrations
--------------------------------------
2019-06-05-15-39-04-dummy-migration.js

Migrate one migrations down

$ serverless migrations down
...
Executed 'down' of 1 migrations
--------------------------------------
2019-06-05-15-39-04-dummy-migration.js

Readme

Keywords

none

Package Sidebar

Install

npm i serverless-plugin-umzug

Weekly Downloads

8

Version

1.3.0

License

MIT

Unpacked Size

4.06 kB

Total Files

3

Last publish

Collaborators

  • christoph.gysin