silverstripe/silverstripe-framework — pull request #2163 by benrwhite (2013-06-27 16:41:48+00:00)
Title: Versioned not ignoring obsolete fields

Useful to prevent weird errors in development where fields have been renamed and in production where old databases have been updated and old fields made obsolete, and the Versioned extension has later been applied to the dataobject. In both these cases the obsolete fields present in the core table cause an error when writing Versioned records.

### To Reproduce:

1. Create a DataObject with at least one database field
2. Perform a build
3. Remove or rename a field from the dataobject, and apply the Versioned extension to the dataobject
4. Perform another build
5. Write a new or old but changed DataObject of this type
6. A database exception is thrown

### Resolution

The branch to pull fixes the problem by filtering the list of fields returned from the core table by those known to be present in the code via a call to _DataObject::database_fields()_