Wednesday, December 8, 2010

Updating my apps database schema in the App Engine's datastore

I had read this article by Mark Ivey:
http://code.google.com/appengine/articles/update_schema.html

So I thought I was ready for this ... but!!

I had added a new field like this:
@Persistent
private int sortorder;

And got this error whatever I did:
This property is mapped to FIELD, which cannot accept null values.

So I changed my field definition to:

@Persistent
private Integer sortorder;

Now I could loop the records in my table and assign default values, because now null is accepted!

Puh ...