Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 87262 invoked from network); 6 Mar 2009 18:06:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Mar 2009 18:06:05 -0000 Received: (qmail 42199 invoked by uid 500); 6 Mar 2009 18:05:58 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 42158 invoked by uid 500); 6 Mar 2009 18:05:58 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 42147 invoked by uid 99); 6 Mar 2009 18:05:58 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Mar 2009 10:05:58 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [66.220.1.235] (HELO mail.proven-corporation.com) (66.220.1.235) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Mar 2009 18:05:50 +0000 Received: from [192.168.3.11] (ppp-58-8-63-133.revip2.asianet.co.th [58.8.63.133]) by mail.proven-corporation.com (Postfix) with ESMTP id D02B7C5B22 for ; Sat, 7 Mar 2009 01:05:28 +0700 (ICT) Message-ID: <49B165E3.4040801@proven-corporation.com> Date: Sat, 07 Mar 2009 01:05:23 +0700 From: Jason Smith User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: user@couchdb.apache.org Subject: Best way to "migrate" (a la Rails) Couch documents Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hi, list. While I am happy to be learning Couch for a new project, I am still unsure about some tricks that I used with Django and Rails, such as data migration: For example, suppose I change my code and instead of using a string timestamp in my documents, I would prefer a hash with "day", "month", and "year" keys. When I deploy the new code into production, obviously I want the data structures to change for all existing documents. So my question is: What is the preferred or recommended method to do this? So far, the only thing I can think of is to write some client code to do the following: 1. Fetch _all_docs 2. For each document that requires changing, modify it 3. Either PUT the new documents up one by one, or POST them to _bulk_docs, depending on the situation. This solution doesn't strike me as particularly horrible, but I was wondering if there is a better way, perhaps something server-side. I have looked around couchdb-python, couchrest, and couchapp but i don't think see this kind of code. (Maybe it "smells" too Railsy, I don't know.) Anyway, if my approach is reasonable, then I'll be happy to send a patch/GitHub pull request upstream to couchapp if would help others. -- Jason Smith Proven Corporation Bangkok, Thailand http://www.proven-corporation.com