1.1.4 • Published 3 years ago
dynamodb-versioning v1.1.4
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.
- Using the defaults
- using a
.dvrc
file in the root of the project - 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 beV1
thenV2
etc.
- The version should match the following regex with
- Command
- Only two commands are working. It must be
create
orupdate
.create
will create a new table by callingcreateTable
and must follow thejson
struture needed by AWS - Create Table.update
will use theupdateTable
function and thejson
will be AWS - Update Table
- Only two commands are working. It must be
- Description
- This can be anything but best to describe the file
- File Type
- Must be
json
- Must be
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.