Removing properties in Ripple

Adam Hunter adamhunter at me.com
Tue Feb 8 20:21:16 EST 2011


I am really glad you brought this up because this has bitten me many
times. I don't know the original intent but it would be nice to have
some sort of deprecated_property declaration that allows using the
data attributes and can possibly have options for migration, like
keep, delete, log or a proc that could transition it to a new
attribute. This sort if thing had been on my to do list for a while
but now that I have more free time I may just scratch it. I'd love to
get migration ideas from the community at large beforehand though.

Thanks,

Adam Hunter

Sent from my iPhone

On Feb 8, 2011, at 6:29 PM, Duff OMelia <duff at omelia.org> wrote:

> Hi all,
> 
> There's a test in ripple:
> 
> describe Ripple::Document::Finders do
>    it "should raise an exception when finding an existing document
> that has properties we don't know about" do
>      @plain.raw_data = '{"non_existent_property":"whatever"}'
>      lambda { Box.find("square") }.should raise_error
>    end
> end
> 
> 
> I'd like to understand the motivation for that behavior.
> Specifically, if we have data stored in Riak and we want to eliminate
> one of the Ripple properties, what's the best way to do that?  So for
> example, if we had:
> 
> class Account
>  include Ripple::Document
> 
>  property :email, String, :presence => true
>  property :feature_level, String
> 
> end
> 
> 
> And then we wanted to change the Account to look like this:
> 
> 
> class Account
>  include Ripple::Document
> 
>  property :email, String, :presence => true
> 
> end
> 
> such that it no longer has the feature_level property, then we can't
> find existing Accounts using Ripple because it'll raise an exception.
> 
> I was thinking I'd be able to find one of those old accounts,
> potentially access the feature_level using the attributes from
> ActiveModel, potentially remove that feature level from the Riak
> storage, etc.  The fact that there's a test there verifying that
> finding a document with unknown properties raises an exception makes
> me think there's something I'm missing as far as renaming properties
> or deleting old data goes.
> 
> Anyone have any insight to share?
> 
> 
> Thanks!
> 
> 
> ------------------------------------------------------------
> Duff OMelia
> 
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20110208/5ce6bb8c/attachment.html>


More information about the riak-users mailing list