@@ -23,7 +23,7 @@ export default class DynamoDBStorage implements Storage {
23
23
* @param options
24
24
* @param options.dynamodb - a DynamoDB document client instance
25
25
* @param options.tableName - name of migration table in DynamoDB
26
- * @param options.attributeName - name of the table rangeKey attribute in DynamoDB
26
+ * @param options.attributeName - name of the table primaryKey attribute in DynamoDB
27
27
* @param options.timestamp - option to add timestamps to the DynamoDB table
28
28
*/
29
29
constructor ( { dynamodb, tableName, attributeName, timestamp } : DynamoDBStorageOptions = { } ) {
@@ -42,7 +42,7 @@ export default class DynamoDBStorage implements Storage {
42
42
* @param migrationName - Name of the migration to be logged.
43
43
*/
44
44
async logMigration ( migrationName : string ) {
45
- const item : DocumentClient . PutItemInputAttributeMap = { [ this . attributeName ] : migrationName , executed : 'OK' } ;
45
+ const item : DocumentClient . PutItemInputAttributeMap = { [ this . attributeName ] : migrationName } ;
46
46
47
47
if ( this . timestamp ) {
48
48
item . createdAt = Date . now ( ) ;
@@ -57,7 +57,7 @@ export default class DynamoDBStorage implements Storage {
57
57
* @param migrationName - Name of the migration to be unlogged.
58
58
*/
59
59
async unlogMigration ( migrationName : string ) {
60
- const key : DocumentClient . Key = { [ this . attributeName ] : migrationName , executed : 'OK' } ;
60
+ const key : DocumentClient . Key = { [ this . attributeName ] : migrationName } ;
61
61
62
62
await this . dynamodb . delete ( { TableName : this . tableName , Key : key } ) . promise ( ) ;
63
63
}
@@ -70,10 +70,8 @@ export default class DynamoDBStorage implements Storage {
70
70
let startKey : DocumentClient . Key ;
71
71
72
72
do {
73
- const { Items, LastEvaluatedKey } = await this . dynamodb . query ( {
73
+ const { Items, LastEvaluatedKey } = await this . dynamodb . scan ( {
74
74
TableName : this . tableName ,
75
- KeyConditionExpression : 'executed = :executed' ,
76
- ExpressionAttributeValues : { ':executed' : 'OK' } ,
77
75
ExclusiveStartKey : startKey ,
78
76
} ) . promise ( ) ;
79
77
0 commit comments