Hi All!
Thanks for the replies. I am looking for a solution, possibly 3rd party, where I write changes to the schema and it keeps track of the changes I made. I am used to doing stuff in pgadmin4 but I don't mind something else.
This isn't really ad-hoc. This is more like, I have a v1.0 release coming out soon and I have made dozens or hundreds of changes to the schema from the alpha. Right now, I can destroy the databases and recreate them without data loss because it is in active development. When this gets released, we need some way to make sure that we can easily migrate between release versions and that means schema change tracking. Basically, to Steve's concern, I don't have to go back and figure out changes (thankfully, I have done that and it sucks) but we need something from an initial release moving forward.
I don't have time to write my own and this problem is complex enough to either buy a solution or go with a 3rd party application.
So far, SQITCH is looking like a winner. Yoyo can work as I have access to python. We are not using SQLAlchemy but I don't see a reason why we can't.
Thanks all for the suggestions. This is great.
~Ben
On Thu, May 16, 2019 at 1:06 PM Mark Fletcher <markf@xxxxxxxxxxxxxx> wrote:
On Thu, May 16, 2019 at 9:41 AM Benedict Holland <benedict.m.holland@xxxxxxxxx> wrote: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?We ended up rolling our own. We do schema dumps and then use https://www.apgdiff.com/ to diff them. For our relatively simple schemas, it's worked fine. One thing to note, apgdiff doesn't support `ALTER TABLE ONLY [a-z\.]+ REPLICA IDENTITY FULL;` lines, which we just remove before diffing.Cheers,Mark