Skip to content

Commit 4492ba4

Browse files
Merge pull request #82 from romanesko/feature/v12-support
feat: add PostgreSQL 12 support
2 parents 77aaabe + 3a5ac4b commit 4492ba4

File tree

12 files changed

+27
-16
lines changed

12 files changed

+27
-16
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,15 @@ ENV APP_VERSION=$APP_VERSION
7777
# Set production mode for Docker containers
7878
ENV ENV_MODE=production
7979

80-
# Install PostgreSQL server and client tools (versions 13-17)
80+
# Install PostgreSQL server and client tools (versions 12-18)
8181
RUN apt-get update && apt-get install -y --no-install-recommends \
8282
wget ca-certificates gnupg lsb-release sudo gosu && \
8383
wget -qO- https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \
8484
echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" \
8585
> /etc/apt/sources.list.d/pgdg.list && \
8686
apt-get update && \
8787
apt-get install -y --no-install-recommends \
88-
postgresql-17 postgresql-18 postgresql-client-13 postgresql-client-14 postgresql-client-15 \
88+
postgresql-17 postgresql-18 postgresql-client-12 postgresql-client-13 postgresql-client-14 postgresql-client-15 \
8989
postgresql-client-16 postgresql-client-17 postgresql-client-18 && \
9090
rm -rf /var/lib/apt/lists/*
9191

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
[![Docker Pulls](https://img.shields.io/docker/pulls/rostislavdugin/postgresus?color=brightgreen)](https://hub.docker.com/r/rostislavdugin/postgresus)
1010
[![Platform](https://img.shields.io/badge/platform-linux%20%7C%20macos%20%7C%20windows-lightgrey)](https://github.com/RostislavDugin/postgresus)
1111

12-
[![PostgreSQL](https://img.shields.io/badge/PostgreSQL-13%20%7C%2014%20%7C%2015%20%7C%2016%20%7C%2017%20%7C%2018-336791?logo=postgresql&logoColor=white)](https://www.postgresql.org/)
12+
[![PostgreSQL](https://img.shields.io/badge/PostgreSQL-12%20%7C%2013%20%7C%2014%20%7C%2015%20%7C%2016%20%7C%2017%20%7C%2018-336791?logo=postgresql&logoColor=white)](https://www.postgresql.org/)
1313
[![Self Hosted](https://img.shields.io/badge/self--hosted-yes-brightgreen)](https://github.com/RostislavDugin/postgresus)
1414
[![Open Source](https://img.shields.io/badge/open%20source-❤️-red)](https://github.com/RostislavDugin/postgresus)
1515

@@ -54,7 +54,7 @@
5454

5555
### 🐘 **PostgreSQL Support**
5656

57-
- **Multiple versions**: PostgreSQL 13, 14, 15, 16, 17 and 18
57+
- **Multiple versions**: PostgreSQL 12, 13, 14, 15, 16, 17 and 18
5858
- **SSL support**: Secure connections available
5959
- **Easy restoration**: One-click restore from any backup
6060

backend/internal/features/backups/backups/usecases/postgresql/create_backup_uc.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ func (uc *CreatePostgresqlBackupUsecase) Execute(
7070
"--verbose", // Add verbose output to help with debugging
7171
}
7272

73-
// Use zstd compression level 5 for PostgreSQL 15+ (better compression and speed)
74-
// Fall back to gzip compression level 5 for older versions
75-
if pg.Version == tools.PostgresqlVersion13 || pg.Version == tools.PostgresqlVersion14 ||
76-
pg.Version == tools.PostgresqlVersion15 {
73+
// Use zstd compression level 5 for PostgreSQL 16+ (better compression and speed)
74+
// Fall back to gzip compression level 5 for older versions (12-15)
75+
if pg.Version == tools.PostgresqlVersion12 || pg.Version == tools.PostgresqlVersion13 ||
76+
pg.Version == tools.PostgresqlVersion14 || pg.Version == tools.PostgresqlVersion15 {
7777
args = append(args, "-Z", "5")
7878
uc.logger.Info("Using gzip compression level 5 (zstd not available)", "version", pg.Version)
7979
} else {

backend/internal/util/tools/enums.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const (
1515
type PostgresqlVersion string
1616

1717
const (
18+
PostgresqlVersion12 PostgresqlVersion = "12"
1819
PostgresqlVersion13 PostgresqlVersion = "13"
1920
PostgresqlVersion14 PostgresqlVersion = "14"
2021
PostgresqlVersion15 PostgresqlVersion = "15"
@@ -32,6 +33,8 @@ const (
3233

3334
func GetPostgresqlVersionEnum(version string) PostgresqlVersion {
3435
switch version {
36+
case "12":
37+
return PostgresqlVersion12
3538
case "13":
3639
return PostgresqlVersion13
3740
case "14":

backend/internal/util/tools/postgresql.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func GetPostgresqlExecutable(
3030
return filepath.Join(basePath, executableName)
3131
}
3232

33-
// VerifyPostgresesInstallation verifies that PostgreSQL versions 13-17 are installed
33+
// VerifyPostgresesInstallation verifies that PostgreSQL versions 12-18 are installed
3434
// in the current environment. Each version should be installed with the required
3535
// client tools (pg_dump, psql) available.
3636
// In development: ./tools/postgresql/postgresql-{VERSION}/bin
@@ -41,6 +41,7 @@ func VerifyPostgresesInstallation(
4141
postgresesInstallDir string,
4242
) {
4343
versions := []PostgresqlVersion{
44+
PostgresqlVersion12,
4445
PostgresqlVersion13,
4546
PostgresqlVersion14,
4647
PostgresqlVersion15,

backend/tools/download_linux.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set -e # Exit on any error
55
# Ensure non-interactive mode for apt
66
export DEBIAN_FRONTEND=noninteractive
77

8-
echo "Installing PostgreSQL client tools versions 13-18 for Linux (Debian/Ubuntu)..."
8+
echo "Installing PostgreSQL client tools versions 12-18 for Linux (Debian/Ubuntu)..."
99
echo
1010

1111
# Check if running on supported system
@@ -47,7 +47,7 @@ echo "Updating package list..."
4747
$SUDO apt-get update -qq -y
4848

4949
# Install client tools for each version
50-
versions="13 14 15 16 17 18"
50+
versions="12 13 14 15 16 17 18"
5151

5252
for version in $versions; do
5353
echo "Installing PostgreSQL $version client tools..."

backend/tools/download_macos.sh

100644100755
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -e # Exit on any error
44

5-
echo "Installing PostgreSQL client tools versions 13-18 for MacOS..."
5+
echo "Installing PostgreSQL client tools versions 12-18 for MacOS..."
66
echo
77

88
# Check if Homebrew is installed
@@ -31,6 +31,7 @@ brew install wget openssl readline zlib
3131

3232
# PostgreSQL source URLs
3333
declare -A PG_URLS=(
34+
["12"]="https://ftp.postgresql.org/pub/source/v12.20/postgresql-12.20.tar.gz"
3435
["13"]="https://ftp.postgresql.org/pub/source/v13.16/postgresql-13.16.tar.gz"
3536
["14"]="https://ftp.postgresql.org/pub/source/v14.13/postgresql-14.13.tar.gz"
3637
["15"]="https://ftp.postgresql.org/pub/source/v15.8/postgresql-15.8.tar.gz"
@@ -107,7 +108,7 @@ build_postgresql_client() {
107108
}
108109

109110
# Build each version
110-
versions="13 14 15 16 17 18"
111+
versions="12 13 14 15 16 17 18"
111112

112113
for version in $versions; do
113114
url=${PG_URLS[$version]}

backend/tools/download_windows.bat

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@echo off
22
setlocal enabledelayedexpansion
33

4-
echo Downloading and installing PostgreSQL versions 13-18 for Windows...
4+
echo Downloading and installing PostgreSQL versions 12-18 for Windows...
55
echo.
66

77
:: Create downloads and postgresql directories if they don't exist
@@ -17,6 +17,7 @@ cd downloads
1717
set "BASE_URL=https://get.enterprisedb.com/postgresql"
1818

1919
:: Define versions and their corresponding download URLs
20+
set "PG12_URL=%BASE_URL%/postgresql-12.20-1-windows-x64.exe"
2021
set "PG13_URL=%BASE_URL%/postgresql-13.16-1-windows-x64.exe"
2122
set "PG14_URL=%BASE_URL%/postgresql-14.13-1-windows-x64.exe"
2223
set "PG15_URL=%BASE_URL%/postgresql-15.8-1-windows-x64.exe"
@@ -25,7 +26,7 @@ set "PG17_URL=%BASE_URL%/postgresql-17.0-1-windows-x64.exe"
2526
set "PG18_URL=%BASE_URL%/postgresql-18.0-1-windows-x64.exe"
2627

2728
:: Array of versions
28-
set "versions=13 14 15 16 17 18"
29+
set "versions=12 13 14 15 16 17 18"
2930

3031
:: Download and install each version
3132
for %%v in (%versions%) do (

backend/tools/readme.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
This directory is needed only for development and CI\CD.
22

3-
We have to download and install all the PostgreSQL versions from 13 to 18 locally.
3+
We have to download and install all the PostgreSQL versions from 12 to 18 locally.
44
This is needed so we can call pg_dump, pg_dumpall, etc. on each version of the PostgreSQL database.
55

66
You do not need to install PostgreSQL fully with all the components.
77
We only need the client tools (pg_dump, pg_dumpall, psql, etc.) for each version.
88

99
We have to install the following:
1010

11+
- PostgreSQL 12
1112
- PostgreSQL 13
1213
- PostgreSQL 14
1314
- PostgreSQL 15
@@ -72,6 +73,7 @@ The final directory structure should match:
7273

7374
For example:
7475

76+
- `./tools/postgresql/postgresql-12/bin/pg_dump`
7577
- `./tools/postgresql/postgresql-13/bin/pg_dump`
7678
- `./tools/postgresql/postgresql-14/bin/pg_dump`
7779
- `./tools/postgresql/postgresql-15/bin/pg_dump`

frontend/src/entity/databases/model/postgresql/PostgresqlVersion.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export enum PostgresqlVersion {
2+
PostgresqlVersion12 = '12',
23
PostgresqlVersion13 = '13',
34
PostgresqlVersion14 = '14',
45
PostgresqlVersion15 = '15',

0 commit comments

Comments
 (0)