How to automatically create missing indexes?

Viewed 28
[Alias("MyTable")]
// [References(typeof(MyModelGlobalIndex))]
public class MyModel
{
    [HashKey]
    public new long Id { get; set; }

    public new long EventId { get; set; }

    public MeetModel(long id, long eventId)
    {
        Id = id;
        EventId = eventId;
    }
}

// internal class MyModelGlobalIndex : IGlobalIndex<MyModel>
// {
//     [HashKey]
//     public long EventId { get; set; }
//
//     [Index]
//     public long Id { get; set; }
// }

If I will call db.InitSchema() then table without global index will be created. Then if I will uncomment global index in example above and call db.InitSchema() again then it won't create missing global index. It seems that PocoDynamo InitSchema() does not create missing global indexes - how I can create one with PocoDynamo?

1 Answers

The indexes are created along with the table, so you could drop the table and have PocoDynamo recreate it.

Related