On Tuesday, June 24, 2014 7:12:53 AM UTC-7, Paul Cowan wrote:
>
> I have inherited a project that has some serialized yaml fields that I 
> want to migrate to real database tables.  
>
>
> For example, I have this type of thing:
>
>   class Account < Sequel::Model
>
>     include ModelManager
>
>
>     plugin :serialization
>
>
>     serialize_attributes :yaml, :workflow, :lead_sources, :billing_info
>
>
> What I want to know is, what is the best approach to migrating the data as 
> this data contains billing information that we obviously don't want to lose.
>
> An example of a billing_info field might be something like this:
>
>
> "--- !ruby/object:BillingInfo
>
> subscription: solo
>
> gateway_identifier: xxxx
>
> organisation: XXXX
>
> billing_email: xxx
>
> reference: XX
>
> phone: 
>
> country: USA
> vat: ''
> subscription_ended: false
>
> gateway_set: true
>
> subscription_end_date: "
>
>
> I can't think of a good way apart from crazy regex's to get the data from 
> the serialized yaml fields so my initial thought is to use the model to 
> loop over all the records in the database and then update the fields that 
> way.
>
> Is this the right approach or am I missing something?
>
I believe that is the right approach.

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to