@Test
public void typeChange() throws Exception {

    try (FDBRecordContext context = openContext()) {
        createOrOpenRecordStore(context, RecordMetaData.build(TestRecords7Proto.getDescriptor()));
        TestRecords7Proto.MyRecord1.Builder rec1Builder = TestRecords7Proto.MyRecord1.newBuilder();
        rec1Builder.setRecNo(1);
        rec1Builder.setStrValue("one");
        recordStore.saveRecord(rec1Builder.build());
        assertEquals(1L, recordStore.scanIndexRecords("MyRecord1$str_value").getCount().get().longValue(), "should have one record in index");
        TestRecords7Proto.MyRecord2.Builder rec2Builder = TestRecords7Proto.MyRecord2.newBuilder();
        rec2Builder.setRecNo(1); // Same primary key
        rec2Builder.setStrValue("two");
        recordStore.saveRecord(rec2Builder.build());
        FDBStoredRecord<Message> rec2 = recordStore.loadRecord(Tuple.from(1L));
        assertNotNull(rec2);
        TestRecords7Proto.MyRecord2.Builder myrec = TestRecords7Proto.MyRecord2.newBuilder();
        myrec.mergeFrom(rec2.getRecord());
        assertEquals("two", myrec.getStrValue(), "should load second record");
        assertEquals(0L, recordStore.scanIndexRecords("MyRecord1$str_value").getCount().get().longValue(), "should have no records in index");
    }
}