dynamodb-versioning

1.1.4 • Public • Published

DynamoDB Versioning

Description

This is a work in progress. It is a way to version your DynamoDB between different evironments. The idea is very much based on Flyway.

How To

Set Up the Necessary Variables

You can pass in the needed variables in three ways. Number 1 is the lowest priority.

  1. Using the defaults
  2. using a .dvrc file in the root of the project
  3. Environment Variables

There are 6 variables that need to be set.

Defualts

Data path, table path, and the name of the version table have defaults.

  • Table path is /db/table
  • Data path is /db/data
  • Version table is `sjs-versioning-migration'

.dvrc

A JSON file with the following structure:

{
  "tablePath": string,
  "datePath": string,
  "environments": {
    [anykey]: {
      "endpoint": string,
      "awsId": string,
      "region": string,
      "secret": string,
      "tagPath": string,
      "tagName": string
    }
  }
}

Environment Variables

You can set these environment variables if you like.

  • TABLE_PATH - string - the path to the json for the tables
  • DATA_PATH - string - the path to the json for the data
  • TAG_PATH - string - the path to the tag folder
  • TAG_NAME - string - the path to the tags
  • AWS_ID - string - the ID for the AWS account
  • AWS_SECRET - string - the secret of the AWS account
  • AWS_ENDPOINT - URL - the URL for the DynamoDB
  • AWS_REGION - string - the region for the DynamoDB

Tables

File name

The files must be a json file. They have 4 parts: version, command, description, and file type.

  • version
    • The version should match the following regex with V[1-9][0-9]* and a number. The first file should be V1 then V2 etc.
  • Command
    • Only two commands are working. It must be create or update. create will create a new table by calling createTable and must follow the json struture needed by AWS - Create Table. update will use the updateTable function and the json will be AWS - Update Table
  • Description
    • This can be anything but best to describe the file
  • File Type
    • Must be json

An example file would be V1_create_new-table.json.

Data

This will only add or update data in the table. It can be any file name but it must be a json file.

Readme

Keywords

Package Sidebar

Install

npm i dynamodb-versioning

Weekly Downloads

2

Version

1.1.4

License

ISC

Unpacked Size

356 kB

Total Files

5

Last publish

Collaborators

  • ssmith323