Forum for discussing general topics related to Couch.
8 posts Page 1 of 1
Hi,
What is the best way to not lost data if I have to reorganize my backend fields?

BR
Hi,

Could you please expand on what you have in mind by 'reorganization'?
Renaming existing fields? Changing their types?
Hi,
I mean renaming the fields but with the same type and construction.
I see. Well, simply renaming the regions in the template will make Couch create new regions bearing those names and mark the original ones as deleted - not, of course, what you want.

The correct way here would be to rename the fields directly in the database.
I'll assume you have access of phpMyAdmin (or some similar utility) -

IMP: Before you proceed any further, take a backup of your database - NOW!

Next find the fields in question in 'couch_fields' table and rename them by modifying the 'name' field.

Hope this helps (don't forget the database backup).
KK wrote: Next find the fields in question in 'couch_fields' table and rename them by modifying the 'name' field.


Quite often fields have identical names across multiple templates e.g. 'my_image'. Make sure the template_id column in the same table couch_fields has the ID of the target template. All IDs of registered templates can be looked up in table couch_templates.
Hello,

so I cloned the fields and the pages for my reorganized form. I a second step I will delete the old template with the old data.
But now I have all the right pages and fields in my reorganized template but I miss the content of the fields.
I don't really understand how you connect the content with the fields and pages. Also which IDs I have to relate together to connect now the contend with the cloned fields?

Cheers
You have a backup of the database, right?
Please confirm.
Yes of course. I confirm :)
But I have als ocloned the fields so I can delete it without any problems of the existing pages.
8 posts Page 1 of 1