Skip to content

Commit

Permalink
fix: recreating thread table with proper lsi (#261)
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonNotJson authored Mar 17, 2023
1 parent 9179913 commit a79f43b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 34 deletions.
56 changes: 28 additions & 28 deletions lib/constructs/persistence/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,36 +82,36 @@ export class DynamoDatabase extends Construct {
},
);

// this.tables[Collection.THREAD] = new dynamodb.Table(
// this,
// 'dynamodb-thread-table',
// {
// partitionKey: {
// name: 'board_id',
// type: dynamodb.AttributeType.STRING,
// },
// billingMode: dynamodb.BillingMode.PROVISIONED,
// encryption: dynamodb.TableEncryption.DEFAULT,
// removalPolicy: RemovalPolicy.DESTROY,
// sortKey: { name: 'created_at', type: dynamodb.AttributeType.STRING },
// tableName: 'forum-threads',
// readCapacity: 15,
// writeCapacity: 15,
// pointInTimeRecovery: true,
// },
// );
this.tables[Collection.THREAD] = new dynamodb.Table(
this,
'dynamodb-thread-table',
{
partitionKey: {
name: 'board_id',
type: dynamodb.AttributeType.STRING,
},
billingMode: dynamodb.BillingMode.PROVISIONED,
encryption: dynamodb.TableEncryption.DEFAULT,
removalPolicy: RemovalPolicy.DESTROY,
sortKey: { name: 'created_at', type: dynamodb.AttributeType.STRING },
tableName: 'forum-threads',
readCapacity: 15,
writeCapacity: 15,
pointInTimeRecovery: true,
},
);

// this.tables[Collection.THREAD].addLocalSecondaryIndex({
// indexName: 'GroupIndex',
// sortKey: { name: 'group_id', type: dynamodb.AttributeType.NUMBER },
// projectionType: dynamodb.ProjectionType.ALL,
// });
this.tables[Collection.THREAD].addLocalSecondaryIndex({
indexName: 'GroupIndex',
sortKey: { name: 'group_id', type: dynamodb.AttributeType.STRING },
projectionType: dynamodb.ProjectionType.ALL,
});

// this.tables[Collection.THREAD].addLocalSecondaryIndex({
// indexName: "TagIndex",
// sortKey: { name: "tag_id", type: dynamodb.AttributeType.NUMBER },
// projectionType: dynamodb.ProjectionType.ALL,
// });
this.tables[Collection.THREAD].addLocalSecondaryIndex({
indexName: 'TagIndex',
sortKey: { name: 'tag_id', type: dynamodb.AttributeType.STRING },
projectionType: dynamodb.ProjectionType.ALL,
});

// this.tables[Collection.THREAD].addGlobalSecondaryIndex({
// indexName: "UidbyCreated_at",
Expand Down
10 changes: 4 additions & 6 deletions lib/stacks/persistence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,10 @@ export class WasedaTimePersistenceLayer extends PersistenceLayer {
syllabusDataPipeline.dataWarehouse.bucketName,
);

// this.dataInterface.setEndpoint(
// DataEndpoint.THREAD,
// dynamoDatabase.tables[Collection.THREAD].tableName,
// );
// this.exportValue(dynamoDatabase.tables[Collection.THREAD].tableName);
// this.exportValue(dynamoDatabase.tables[Collection.THREAD].tableArn);
this.dataInterface.setEndpoint(
DataEndpoint.THREAD,
dynamoDatabase.tables[Collection.THREAD].tableName,
);

this.dataInterface.setEndpoint(
DataEndpoint.COMMENT,
Expand Down

0 comments on commit a79f43b

Please sign in to comment.