Andrew Blaney
07/01/2021, 1:49 PMsst.Table
that already exists, with 1 existing secondary index. I've tried adding it to TableProps.secondaryIndexes
property of the table, and also tried using table.dynamodbTable.addGlobalSecondaryIndex()
but when I deploy, no changes are found for the stack.. any ideas? thanks!Frank
sst.Table
and adding the index?Andrew Blaney
07/01/2021, 5:23 PMtable.dynamodbTable.addGlobalSecondaryIndex
as adding it to secondaryIndexes.gsi2
property of the below sst.Table
call didnt make any changes
const table = new sst.Table(this, 'theTable', {
fields: {
pk: sst.TableFieldType.STRING,
sk: sst.TableFieldType.STRING,
gsi1pk: sst.TableFieldType.STRING,
gsi1sk: sst.TableFieldType.STRING,
gsi2pk: sst.TableFieldType.STRING,
gsi2sk: sst.TableFieldType.STRING,
},
primaryIndex: {
partitionKey: 'pk',
sortKey: 'sk',
},
secondaryIndexes: {
gsi1: {
partitionKey: 'gsi1pk',
sortKey: 'gsi1sk',
indexProps: {
projectionType: ProjectionType.ALL,
},
},
},
dynamodbTable: {
removalPolicy: env.database.removalPolicy,
pointInTimeRecovery: true,
timeToLiveAttribute: 'expiresAt',
},
stream: true,
});
table.dynamodbTable.addGlobalSecondaryIndex({
projectionType: ProjectionType.KEYS_ONLY,
indexName: 'gsi2',
partitionKey: { name: 'gsi2pk', type: AttributeType.STRING },
sortKey: { name: 'gsi2sk', type: AttributeType.STRING },
});
Andrew Blaney
07/02/2021, 3:28 PMFrank
Frank
Frank
sst deploy
, that created the table with gsi1
.Frank
sst deploy
again.Frank
Frank
addGlobalSecondaryIndex
instead of configuring both GSIs in TableProps.secondaryIndexes
?Andrew Blaney
07/05/2021, 9:45 AMFrank