Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id AE8639FB7DD for ; Wed, 1 Aug 2007 13:46:17 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 94739-09 for ; Wed, 1 Aug 2007 13:46:13 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from rv-out-0910.google.com (rv-out-0910.google.com [209.85.198.191]) by postgresql.org (Postfix) with ESMTP id A066A9FB5ED for ; Wed, 1 Aug 2007 13:46:13 -0300 (ADT) Received: by rv-out-0910.google.com with SMTP id f1so159271rvb for ; Wed, 01 Aug 2007 09:46:12 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=C3hapKJT+q4ty7/7M1cybUs7zOvzgwO+goOSEye+Gq+hO9DjSgNVImW6Unptpe474LY4R6xGlx0A8x8Hw1GOB3NHVzbfNuHkOQ8y5bIjJIraWbJ7cG0HXq+jndZNWsExis43ggBUMY+euCsVdSFGC/iUVCB4RATysDFYGVqOejw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=unCY9qCoqgmy8+4Sf8GdfcRFPWPkcFATXGlPTM0BrI24yoBta1Z7qwI412uvHJwHLEe0SHAeHG0ZCoBbny0sqxHyL/LJ5Iig5B2CWaKatr/wjbF6KpP4q1ygnHgr2tM6UwYbhL8auQC2NTjJLq1GozqSxZzIg896MBuoH/w5PIc= Received: by 10.141.202.12 with SMTP id e12mr326927rvq.1185986771733; Wed, 01 Aug 2007 09:46:11 -0700 (PDT) Received: by 10.141.162.12 with HTTP; Wed, 1 Aug 2007 09:46:11 -0700 (PDT) Message-ID: Date: Wed, 1 Aug 2007 11:46:11 -0500 From: "Scott Marlowe" To: "John Mitchell" Subject: Re: How do I connect postgres table structures and view structures to an existing svn repository? Cc: "D'Arcy J.M. Cain" , pgsql-sql@postgresql.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20070801113812.6a2d6fac.darcy@druid.net> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/5 X-Sequence-Number: 28943 On 8/1/07, John Mitchell wrote: > I am trying to store schema definitions in version-control which I can do by > saving the definition and then importing into svn, but I would like it > to be automatic , so that when an update occurs to a table or view within > postgres then that table or view is flagged within svn. This would be > similar to what I currently do with source code that I have for a web app > within eclipse. OK, the first decision point is whether you want to store whole schemas and blow away the old one each time, or if you want to store incremental changes. I recommend creating an initial schema of version 1.0, and then creating delta files after that as you change your schema. Your first schema can have a table in it called schemaversion(version text primary key, notes text); with an entry there something like '1.0','initial schema'. Each delta .sql file you create would then have an insert into the schemaversion table with the version number it brings the schema up to and a note of possibly the change ticket or bug number or even a brief overview of the changes it implements. That way you can have a production schema at some stable version, say 1.0.8, while your development schema can move ahead to 2.0.4. then you can simply apply the delta files to take you from 1.0.8 to 2.0.4 when you want to upgrade production. Store each of these files in some directory in svn and you're done. My point being that you need to drive the changes from the svn side, not the database side. I've seen no reliable way to do it otherwise, but would love to be pleasantly surprised.