Hi
Maybe you could dump it to a phone numbers to a csv file or a python dict
with dump_data = { phone_number : contact.id,....}
Then when you created the second table, just run a for loop to populate
that table with the dumped data with contact_id as a reference to the old
table.
Thats what I would do....
// web2py rookie
cheers
Den söndagen den 24:e mars 2013 kl. 19:29:19 UTC+8 skrev Loïc:
>
> Hello all,
>
> let's imagine I have an app with the following model :
>
> db.define_table('contact',
> Field('name'),
> Field('phone_number')
> )
>
> I have already deployed my app, and I have several contacts with a name
> and a phone number.
>
> Then I realise that a contact can have multiple phone numbers. So I add a
> table :
>
> db.define_table('phone number',
> Field('type'), #mobile phone number, home phone number, business
> phone number ,...
> Field('phone_number'),
> Field('contact', 'reference contact'),
> )
>
> The first time I launch my app with the new model, I want to move existing
> phone numbers from *contact *table to *phone_number *table.
> Then I want to remove 'phone_number' field from contact table to avoid
> using it in the future
>
> What is the best way to do this automatically, and without breaking
> backward compatibility?
>
> Thank you
>
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.