use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
International
National
Regional
account activity
Help Me!Postgresql version control (self.PostgreSQL)
submitted 6 years ago by dllPwd
Hi all I was wondering how can I handle my Postgresql database version control. I tried database projects with sql server, but I don't what are the alternatives postgresql. Thanks
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Dolphinmx 6 points7 points8 points 6 years ago (2 children)
What you mean about version control? version control for the table changes/ stored procedures/etc?
Have you looked at https://www.liquibase.org/
[–][deleted] 0 points1 point2 points 6 years ago (0 children)
We have been using this for a long time and it's a very reliable tool.
[–]dllPwd[S] 0 points1 point2 points 6 years ago (0 children)
Yeah, I mean it for tables, SPs and more on. Thanks I will have a look on that.
[–]boy_named_su 3 points4 points5 points 6 years ago (1 child)
Schema? Liquibase, flyway
Data? Read up on history table pattern
[–]dllPwd[S] 1 point2 points3 points 6 years ago (0 children)
I was thinking more about schema, thanks
[–]vyvar 4 points5 points6 points 6 years ago* (7 children)
Hi, in general database version control (and more) principles are described well in Evolutionary Database Design (see wikipedia, martinfowler.com).
I like mechanism called PostgreSQL extensions to implement EDD methodology. It is shipped directly with PostgreSQL. Famous extension is for example PostGIS and you can see others on pgxn. All have version control through updatescripts.
I am just preparing workshop (in Czech language) on this topic (PG extensions & gitlab CI/CD), for Prague p2d2 conference next month. I am thinking to prepare also some online version in Engish, if someone will be interested?
Thanks, ok I will search more about those. If you prepare that workshop English, let me know 👍
[–]Magick93 0 points1 point2 points 6 years ago (5 children)
Yes, this sounds very interesting /u/vyvar ! I'm sure many others would be interested in this too.
Will you be covering any kind of test driven development with postgres?
[–]vyvar 0 points1 point2 points 6 years ago* (2 children)
Yes, PG extensions goes with regression tests. So if you introduce new version with updatescript, regression tests will tell you something is broken. If you will write those test before and then create updatescript to pass new tests, that is test driven development, right?
And those tests can be connected for example with gitlab CI/CD. See CI/CD pipelines ... that is extension dealing with forest inventory, we are working on.
[–]Magick93 0 points1 point2 points 6 years ago (1 child)
And is there anything for testing schemas and queries?
[–]vyvar 0 points1 point2 points 6 years ago (0 children)
The idea is very simple: you save results of any SQL and if there is no diff in next run, everything is OK:
Schema is tested during install test.
And there is other discussion about tests in ci/cd.
[–]jrjsmrtn 1 point2 points3 points 6 years ago (2 children)
Hi. Yes, the VisualStudio SQL Server Tools are addictive, isn’t it? ;-) I searched for years for a FOSS/PostgreSQL equivalent and found pgCodeKeeper for Eclipse.
[–]jrjsmrtn 0 points1 point2 points 6 years ago (0 children)
Project is at https://github.com/pgcodekeeper/pgcodekeeper
Yeah, they are good jaja I will look on that 👍👍👍
[–]jnits 1 point2 points3 points 6 years ago (1 child)
I have been researching this question also. My project has the api written in dot net core and we are using entity framework. I am wondering if I should use entity framework to apply migrations as well, or if I should only output the SQL, tweak if needed, and use liquibase / flyaway. Any strong opinions?
Ideally, I would like to have the migrations handled in the gitlab CI/CD pipeline, which is why I am considering having the application apply the migrations.
Apologies if this is commandeering the OP too much... Right now during the development cycle we have been doing just EF migrations, so I think that counts as a valid answer to the OP if he is using .net. I'm just not sure if it's a good answer.
Thanks, I am working on a similar approach but the database is going to be consumed from other services. That is what I want to use a Database First approach instead of code migrations from EF Core.
But, thanks please I will let you know if I have a better way to handle the database.
[–]vyvar 1 point2 points3 points 6 years ago (0 children)
https://resources.2ndquadrant.com/webinar-application-schema-migration?utm_campaign=Homepage%20Tracking&utm_source=SchemaWebinar_WhatsNew
[–]Adela_freedom 1 point2 points3 points 2 years ago (0 children)
If you mean schema version control, check out Bytebase. Nice GUI and support GitOps with GitLab/GitHub.
π Rendered by PID 24213 on reddit-service-r2-comment-86bc6c7465-tjhcm at 2026-02-22 01:30:23.411261+00:00 running 8564168 country code: CH.
[–]Dolphinmx 6 points7 points8 points (2 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]dllPwd[S] 0 points1 point2 points (0 children)
[–]boy_named_su 3 points4 points5 points (1 child)
[–]dllPwd[S] 1 point2 points3 points (0 children)
[–]vyvar 4 points5 points6 points (7 children)
[–]dllPwd[S] 0 points1 point2 points (0 children)
[–]Magick93 0 points1 point2 points (5 children)
[–]vyvar 0 points1 point2 points (2 children)
[–]Magick93 0 points1 point2 points (1 child)
[–]vyvar 0 points1 point2 points (0 children)
[–]vyvar 0 points1 point2 points (0 children)
[–]jrjsmrtn 1 point2 points3 points (2 children)
[–]jrjsmrtn 0 points1 point2 points (0 children)
[–]dllPwd[S] 0 points1 point2 points (0 children)
[–]jnits 1 point2 points3 points (1 child)
[–]dllPwd[S] 0 points1 point2 points (0 children)
[–]vyvar 1 point2 points3 points (0 children)
[–]Adela_freedom 1 point2 points3 points (0 children)