Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hRJa9-0000nW-2F for pgsql-general@arkaria.postgresql.org; Thu, 16 May 2019 16:50:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hRJa7-00049P-U3 for pgsql-general@arkaria.postgresql.org; Thu, 16 May 2019 16:50:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hRJa7-00049H-A6 for pgsql-general@lists.postgresql.org; Thu, 16 May 2019 16:50:11 +0000 Received: from mail.wordtothewise.com ([104.225.223.158]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hRJa3-0001Y1-ED for pgsql-general@postgresql.org; Thu, 16 May 2019 16:50:10 +0000 Received: from [192.168.0.88] (unknown [37.228.250.230]) by mail.wordtothewise.com (Postfix) with ESMTPSA id 5F2EF9F146 for ; Thu, 16 May 2019 09:50:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wordtothewise.com; s=aardvark; t=1558025403; bh=XQI/eSXiqXllVygnitXUjOW8/HlrlUMNa670rjPgKy0=; h=From:Subject:Date:References:To:In-Reply-To:From; b=ACgPlfSAPEIRpLwamqRcp+mp+dpi5uobB0QVgZZDhOT22+soMMU6r6MkjdofHIiOE 9nYzYYBPSQAQ97n00Fqbj3aRIBqRuJ0iWf+yoAop13L/xAvHoKkdAT6PdaWMRPb24y RHyMBCGmHSiQ/jb73dwV8UuudvF1ZWvdtHexZ2LY= From: Steve Atkins Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.8\)) Subject: Re: schema change tracking Date: Thu, 16 May 2019 17:50:01 +0100 References: To: PG-General Mailing List In-Reply-To: Message-Id: <5743A1A5-A8DF-4463-9B00-0D87B32C622D@blighty.com> X-Mailer: Apple Mail (2.3445.104.8) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > On May 16, 2019, at 5:41 PM, Benedict Holland = wrote: >=20 > Hi All, >=20 > I am fairly this question has many answers but here it goes: >=20 > I need a tool that can track schema changes in a postgesql database, = write scripts to alter the tables, and store those changes in git. Are = there tools that exist that can do this? If you're looking for something that'll reverse engineer schema change = scripts from a database someone has made ad-hoc changes to ... try and = avoid doing that if at all possible. Use the change scripts in git as = the source of truth. If you do that there are many answers, starting at "it's fairly easy to = do yourself, with a simple schema version and upgrade / downgrade = scripts". Depending on what language you're writing your app in there = may be libraries that can help. But if you're looking for something standalone, look at = https://sqitch.org Cheers, Steve