Skip to content

PostgreSQL backup tool with Point-In-Time-Recovery and restore verification

REFACTOR (tooling): Simplify downloading all DBs to keeping persistent binaries in assets

Rostislav Dugin343dcaeeab2c
diff --git a/.dockerignore b/.dockerignore
index 975fa610..8b2966bd 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -8,7 +8,6 @@ node_modules
**/node_modules
# Backend - exclude everything except what's needed for build
-backend/tools
backend/mysqldata
backend/pgdata
backend/mariadbdata
@@ -63,7 +62,6 @@ CITATION.cff
# Assets - exclude SVGs but keep tools
assets/*.svg
-assets/tools/download_postgresql.sh
# Python cache
**/__pycache__
diff --git a/.github/workflows/ci-release.yml b/.github/workflows/ci-release.yml
index a335af8b..20c75edf 100644
--- a/.github/workflows/ci-release.yml
+++ b/.github/workflows/ci-release.yml
@@ -355,88 +355,6 @@ jobs:
ln -sf /usr/lib/x86_64-linux-gnu/libncurses.so.6 /usr/lib/x86_64-linux-gnu/libncurses.so.5 || true
ln -sf /usr/lib/x86_64-linux-gnu/libtinfo.so.6 /usr/lib/x86_64-linux-gnu/libtinfo.so.5 || true
- - name: Setup PostgreSQL, MySQL and MariaDB client tools from pre-built assets
- run: |
- cd backend/tools
-
- # Create directory structure
- mkdir -p postgresql mysql mariadb mongodb/bin
-
- # Copy PostgreSQL client tools (12-18) from pre-built assets
- for version in 12 13 14 15 16 17 18; do
- mkdir -p postgresql/postgresql-$version
- cp -r ../../assets/tools/x64/postgresql/postgresql-$version/bin postgresql/postgresql-$version/
- done
-
- # Copy MySQL client tools (5.7, 8.0, 8.4, 9) from pre-built assets
- for version in 5.7 8.0 8.4 9; do
- mkdir -p mysql/mysql-$version
- cp -r ../../assets/tools/x64/mysql/mysql-$version/bin mysql/mysql-$version/
- done
-
- # Copy MariaDB client tools (10.6, 12.1) from pre-built assets
- for version in 10.6 12.1; do
- mkdir -p mariadb/mariadb-$version
- cp -r ../../assets/tools/x64/mariadb/mariadb-$version/bin mariadb/mariadb-$version/
- done
-
- # Make all binaries executable
- chmod +x postgresql/*/bin/*
- chmod +x mysql/*/bin/*
- chmod +x mariadb/*/bin/*
-
- echo "Pre-built client tools setup complete"
-
- - name: Install MongoDB Database Tools
- run: |
- cd backend/tools
-
- # MongoDB Database Tools must be downloaded (not in pre-built assets)
- # They are backward compatible - single version supports all servers (4.0-8.0)
- MONGODB_TOOLS_URL="https://fastdl.mongodb.org/tools/db/mongodb-database-tools-debian12-x86_64-100.10.0.deb"
-
- echo "Downloading MongoDB Database Tools..."
- wget -q "$MONGODB_TOOLS_URL" -O /tmp/mongodb-database-tools.deb
-
- echo "Installing MongoDB Database Tools..."
- dpkg -i /tmp/mongodb-database-tools.deb || apt-get install -f -y --no-install-recommends
-
- # Create symlinks to tools directory
- ln -sf /usr/bin/mongodump mongodb/bin/mongodump
- ln -sf /usr/bin/mongorestore mongodb/bin/mongorestore
-
- rm -f /tmp/mongodb-database-tools.deb
- echo "MongoDB Database Tools installed successfully"
-
- - name: Verify MariaDB client tools exist
- run: |
- cd backend/tools
- echo "Checking MariaDB client tools..."
- if [ -f "mariadb/mariadb-10.6/bin/mariadb-dump" ]; then
- echo "MariaDB 10.6 client tools found"
- ls -la mariadb/mariadb-10.6/bin/
- else
- echo "MariaDB 10.6 client tools NOT found"
- fi
- if [ -f "mariadb/mariadb-12.1/bin/mariadb-dump" ]; then
- echo "MariaDB 12.1 client tools found"
- ls -la mariadb/mariadb-12.1/bin/
- else
- echo "MariaDB 12.1 client tools NOT found"
- fi
-
- - name: Verify MongoDB Database Tools exist
- run: |
- cd backend/tools
- echo "Checking MongoDB Database Tools..."
- if [ -f "mongodb/bin/mongodump" ]; then
- echo "MongoDB Database Tools found"
- ls -la mongodb/bin/
- mongodb/bin/mongodump --version || true
- else
- echo "MongoDB Database Tools NOT found"
- fi
-
- name: Run database migrations
run: |
cd backend
diff --git a/Dockerfile b/Dockerfile
index 1ed0ca5c..d144f6f8 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -122,39 +122,26 @@ RUN apt-get install -y --no-install-recommends \
wget ca-certificates gnupg lsb-release sudo gosu curl unzip xz-utils libncurses5 libncurses6
RUN rm -rf /var/lib/apt/lists/*
-# ========= Install PostgreSQL client binaries (versions 12-18) =========
-# Pre-downloaded binaries from assets/tools/ - no network download needed
+# ========= Pre-built DB client binaries (PG, MySQL, MariaDB, MongoDB) =========
+# All client tools live under /app/assets/tools/<arch>/ — the backend resolves
+# them at runtime via runtime.GOARCH. We copy only the tree matching $TARGETARCH.
ARG TARGETARCH
-RUN mkdir -p /usr/lib/postgresql/12/bin /usr/lib/postgresql/13/bin \
- /usr/lib/postgresql/14/bin /usr/lib/postgresql/15/bin \
- /usr/lib/postgresql/16/bin /usr/lib/postgresql/17/bin \
- /usr/lib/postgresql/18/bin
-
-# Copy pre-downloaded PostgreSQL binaries based on architecture
-COPY assets/tools/x64/postgresql/ /tmp/pg-x64/
-COPY assets/tools/arm/postgresql/ /tmp/pg-arm/
-RUN if [ "$TARGETARCH" = "amd64" ]; then \
- cp -r /tmp/pg-x64/postgresql-12/bin/* /usr/lib/postgresql/12/bin/ && \
- cp -r /tmp/pg-x64/postgresql-13/bin/* /usr/lib/postgresql/13/bin/ && \
- cp -r /tmp/pg-x64/postgresql-14/bin/* /usr/lib/postgresql/14/bin/ && \
- cp -r /tmp/pg-x64/postgresql-15/bin/* /usr/lib/postgresql/15/bin/ && \
- cp -r /tmp/pg-x64/postgresql-16/bin/* /usr/lib/postgresql/16/bin/ && \
- cp -r /tmp/pg-x64/postgresql-17/bin/* /usr/lib/postgresql/17/bin/ && \
- cp -r /tmp/pg-x64/postgresql-18/bin/* /usr/lib/postgresql/18/bin/; \
+COPY assets/tools/x64/ /tmp/tools-x64/
+COPY assets/tools/arm/ /tmp/tools-arm/
+RUN mkdir -p /app/assets/tools && \
+ if [ "$TARGETARCH" = "amd64" ]; then \
+ mv /tmp/tools-x64 /app/assets/tools/x64; \
elif [ "$TARGETARCH" = "arm64" ]; then \
- cp -r /tmp/pg-arm/postgresql-12/bin/* /usr/lib/postgresql/12/bin/ && \
- cp -r /tmp/pg-arm/postgresql-13/bin/* /usr/lib/postgresql/13/bin/ && \
- cp -r /tmp/pg-arm/postgresql-14/bin/* /usr/lib/postgresql/14/bin/ && \
- cp -r /tmp/pg-arm/postgresql-15/bin/* /usr/lib/postgresql/15/bin/ && \
- cp -r /tmp/pg-arm/postgresql-16/bin/* /usr/lib/postgresql/16/bin/ && \
- cp -r /tmp/pg-arm/postgresql-17/bin/* /usr/lib/postgresql/17/bin/ && \
- cp -r /tmp/pg-arm/postgresql-18/bin/* /usr/lib/postgresql/18/bin/; \
+ mv /tmp/tools-arm /app/assets/tools/arm; \
fi && \
- rm -rf /tmp/pg-x64 /tmp/pg-arm && \
- chmod +x /usr/lib/postgresql/*/bin/*
-
-# Install PostgreSQL 17 server (needed for internal database)
-# Add PostgreSQL repository for server installation only
+ rm -rf /tmp/tools-x64 /tmp/tools-arm && \
+ chmod +x /app/assets/tools/*/postgresql/*/bin/* \
+ /app/assets/tools/*/mysql/*/bin/* \
+ /app/assets/tools/*/mariadb/*/bin/* \
+ /app/assets/tools/*/mongodb/bin/*
+
+# Install PostgreSQL 17 server (needed for the internal database — not for
+# clients, those come from assets above).
RUN wget -qO- https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \
echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" \
> /etc/apt/sources.list.d/pgdg.list && \
@@ -176,68 +163,6 @@ RUN apt-get update && \
apt-get install -y --no-install-recommends rclone && \
rm -rf /var/lib/apt/lists/*
-# Create directories for all database clients
-RUN mkdir -p /usr/local/mysql-5.7/bin /usr/local/mysql-8.0/bin /usr/local/mysql-8.4/bin \
- /usr/local/mysql-9/bin \
- /usr/local/mariadb-10.6/bin /usr/local/mariadb-12.1/bin \
- /usr/local/mongodb-database-tools/bin
-
-# ========= Install MySQL clients (5.7, 8.0, 8.4, 9) =========
-# Pre-downloaded binaries from assets/tools/ - no network download needed
-# Note: MySQL 5.7 is only available for x86_64
-# Note: MySQL binaries require libncurses5 for terminal handling
-COPY assets/tools/x64/mysql/ /tmp/mysql-x64/
-COPY assets/tools/arm/mysql/ /tmp/mysql-arm/
-RUN if [ "$TARGETARCH" = "amd64" ]; then \
- cp /tmp/mysql-x64/mysql-5.7/bin/* /usr/local/mysql-5.7/bin/ && \
- cp /tmp/mysql-x64/mysql-8.0/bin/* /usr/local/mysql-8.0/bin/ && \
- cp /tmp/mysql-x64/mysql-8.4/bin/* /usr/local/mysql-8.4/bin/ && \
- cp /tmp/mysql-x64/mysql-9/bin/* /usr/local/mysql-9/bin/; \
- elif [ "$TARGETARCH" = "arm64" ]; then \
- echo "MySQL 5.7 not available for arm64, skipping..." && \
- cp /tmp/mysql-arm/mysql-8.0/bin/* /usr/local/mysql-8.0/bin/ && \
- cp /tmp/mysql-arm/mysql-8.4/bin/* /usr/local/mysql-8.4/bin/ && \
- cp /tmp/mysql-arm/mysql-9/bin/* /usr/local/mysql-9/bin/; \
- fi && \
- rm -rf /tmp/mysql-x64 /tmp/mysql-arm && \
- chmod +x /usr/local/mysql-*/bin/*
-
-# ========= Install MariaDB clients (10.6, 12.1) =========
-# Pre-downloaded binaries from assets/tools/ - no network download needed
-# 10.6 (legacy): For older servers (5.5, 10.1) that don't have generation_expression column
-# 12.1 (modern): For newer servers (10.2+)
-COPY assets/tools/x64/mariadb/ /tmp/mariadb-x64/
-COPY assets/tools/arm/mariadb/ /tmp/mariadb-arm/
-RUN if [ "$TARGETARCH" = "amd64" ]; then \
- cp /tmp/mariadb-x64/mariadb-10.6/bin/* /usr/local/mariadb-10.6/bin/ && \
- cp /tmp/mariadb-x64/mariadb-12.1/bin/* /usr/local/mariadb-12.1/bin/; \
- elif [ "$TARGETARCH" = "arm64" ]; then \
- cp /tmp/mariadb-arm/mariadb-10.6/bin/* /usr/local/mariadb-10.6/bin/ && \
- cp /tmp/mariadb-arm/mariadb-12.1/bin/* /usr/local/mariadb-12.1/bin/; \
- fi && \
- rm -rf /tmp/mariadb-x64 /tmp/mariadb-arm && \
- chmod +x /usr/local/mariadb-*/bin/*
-
-# ========= Install MongoDB Database Tools =========
-# Note: MongoDB Database Tools are backward compatible - single version supports all server versions (4.0-8.0)
-# Note: For ARM64, we use Ubuntu 22.04 package as MongoDB doesn't provide Debian 12 ARM64 packages
-RUN apt-get update && \
- if [ "$TARGETARCH" = "amd64" ]; then \
- wget -q https://fastdl.mongodb.org/tools/db/mongodb-database-tools-debian12-x86_64-100.10.0.deb -O /tmp/mongodb-database-tools.deb; \
- elif [ "$TARGETARCH" = "arm64" ]; then \
- wget -q https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2204-arm64-100.10.0.deb -O /tmp/mongodb-database-tools.deb; \
- fi && \
- dpkg -i /tmp/mongodb-database-tools.deb || apt-get install -f -y --no-install-recommends && \
- rm -f /tmp/mongodb-database-tools.deb && \
- rm -rf /var/lib/apt/lists/* && \
- mkdir -p /usr/local/mongodb-database-tools/bin && \
- if [ -f /usr/bin/mongodump ]; then \
- ln -sf /usr/bin/mongodump /usr/local/mongodb-database-tools/bin/mongodump; \
- fi && \
- if [ -f /usr/bin/mongorestore ]; then \
- ln -sf /usr/bin/mongorestore /usr/local/mongodb-database-tools/bin/mongorestore; \
- fi
-
# Create postgres user and set up directories
RUN groupadd -g 999 postgres || true && \
useradd -m -s /bin/bash -u 999 -g 999 postgres || true && \
diff --git a/assets/tools/README.md b/assets/tools/README.md
index 2d2f7a83..8321bb46 100644
--- a/assets/tools/README.md
+++ b/assets/tools/README.md
@@ -1,17 +1,35 @@
-We keep binaries here to speed up CI \ CD tasks and building.
-
-Docker image needs:
-- PostgreSQL client tools (versions 12-18)
-- MySQL client tools (versions 5.7, 8.0, 8.4, 9)
-- MariaDB client tools (versions 10.6, 12.1)
-- MongoDB Database Tools (latest)
-
-For the most of tools, we need a couple of binaries for each version. However, if we download them on each run, it will download a couple of GBs each time.
-
-So, for speed up we keep only required executables (like pg_dump, mysqldump, mariadb-dump, mongodump, etc.).
-
-It takes:
-- ~ 100MB for ARM
-- ~ 100MB for x64
-
-Instead of GBs. See Dockefile for usage details.
\ No newline at end of file
+Pre-built DB client binaries committed to the repo so that local dev,
+CI, and the Docker image all read from one place. The Go backend
+resolves them at runtime via `runtime.GOOS`+`runtime.GOARCH` →
+`assets/tools/<arch-key>/<db>/<db>-<v>/bin/<command>[.exe]`.
+
+Layout (one subtree per arch, identical shape):
+
+```
+assets/tools/<arch>/
+ postgresql/postgresql-{12,13,14,15,16,17,18}/bin/
+ pg_dump, pg_restore, psql (+ minimal *.dll set on Windows)
+ mysql/mysql-{5.7,8.0,8.4,9}/bin/
+ mysql, mysqldump
+ mariadb/mariadb-{10.6,12.1}/bin/
+ mariadb, mariadb-dump
+ mongodb/bin/
+ mongodump, mongorestore
+```
+
+`<arch>` keys (mapping in `backend/internal/util/tools/paths.go`):
+
+| GOOS / GOARCH | key | size |
+|---------------------|-----------|-------|
+| `linux` / `amd64` | `x64` | ~160 MB |
+| `linux` / `arm64` | `arm` | ~125 MB |
+| `windows` / `amd64` | `win-x64` | ~120 MB |
+
+Notes:
+- MySQL `5.7` is amd64-only — `arm/mysql/mysql-5.7/` is intentionally absent.
+- MariaDB ships two client versions: legacy `10.6` (for MariaDB servers 5.5 / 10.1) and modern `12.1` (for 10.2+). The mapping lives in `tools/mariadb.go`.
+- MongoDB Database Tools are version 100.16.1 across all arches and are backward-compatible with all supported server versions (4.0 – 8.2).
+
+To refresh a tool set, drop the corresponding `bin/` contents in place
+and commit. There are no install scripts in this directory; binaries
+are sourced from the upstream vendor downloads.
diff --git a/assets/tools/arm/mongodb/bin/mongodump b/assets/tools/arm/mongodb/bin/mongodump
new file mode 100644
index 00000000..b0bb79d2
Binary files /dev/null and b/assets/tools/arm/mongodb/bin/mongodump differ
diff --git a/assets/tools/arm/mongodb/bin/mongorestore b/assets/tools/arm/mongodb/bin/mongorestore
new file mode 100644
index 00000000..6e9e859b
Binary files /dev/null and b/assets/tools/arm/mongodb/bin/mongorestore differ
diff --git a/assets/tools/arm/postgresql/postgresql-12/bin/createdb b/assets/tools/arm/postgresql/postgresql-12/bin/createdb
deleted file mode 100644
index 808e14d9..00000000
Binary files a/assets/tools/arm/postgresql/postgresql-12/bin/createdb and /dev/null differ
diff --git a/assets/tools/arm/postgresql/postgresql-12/bin/dropdb b/assets/tools/arm/postgresql/postgresql-12/bin/dropdb
deleted file mode 100644
index 1e2fbb12..00000000
Binary files a/assets/tools/arm/postgresql/postgresql-12/bin/dropdb and /dev/null differ
diff --git a/assets/tools/arm/postgresql/postgresql-12/bin/pg_dumpall b/assets/tools/arm/postgresql/postgresql-12/bin/pg_dumpall
deleted file mode 100644
index ec370626..00000000
Binary files a/assets/tools/arm/postgresql/postgresql-12/bin/pg_dumpall and /dev/null differ
diff --git a/assets/tools/arm/postgresql/postgresql-13/bin/createdb b/assets/tools/arm/postgresql/postgresql-13/bin/createdb
deleted file mode 100644
index 6c61fe58..00000000
Binary files a/assets/tools/arm/postgresql/postgresql-13/bin/createdb and /dev/null differ
diff --git a/assets/tools/arm/postgresql/postgresql-13/bin/dropdb b/assets/tools/arm/postgresql/postgresql-13/bin/dropdb
deleted file mode 100644
index f7094661..00000000
Binary files a/assets/tools/arm/postgresql/postgresql-13/bin/dropdb and /dev/null differ
diff --git a/assets/tools/arm/postgresql/postgresql-13/bin/pg_dumpall b/assets/tools/arm/postgresql/postgresql-13/bin/pg_dumpall
deleted file mode 100644
index fc6e49b9..00000000
Binary files a/assets/tools/arm/postgresql/postgresql-13/bin/pg_dumpall and /dev/null differ
diff --git a/assets/tools/arm/postgresql/postgresql-14/bin/createdb b/assets/tools/arm/postgresql/postgresql-14/bin/createdb
deleted file mode 100644
index 03a9e2be..00000000
Binary files a/assets/tools/arm/postgresql/postgresql-14/bin/createdb and /dev/null differ
diff --git a/assets/tools/arm/postgresql/postgresql-14/bin/dropdb b/assets/tools/arm/postgresql/postgresql-14/bin/dropdb
deleted file mode 100644
index 2ff6d5ce..00000000
Binary files a/assets/tools/arm/postgresql/postgresql-14/bin/dropdb and /dev/null differ
diff --git a/assets/tools/arm/postgresql/postgresql-14/bin/pg_dumpall b/assets/tools/arm/postgresql/postgresql-14/bin/pg_dumpall
deleted file mode 100644
index 9514847d..00000000
Binary files a/assets/tools/arm/postgresql/postgresql-14/bin/pg_dumpall and /dev/null differ
diff --git a/assets/tools/arm/postgresql/postgresql-15/bin/createdb b/assets/tools/arm/postgresql/postgresql-15/bin/createdb
deleted file mode 100644
index 9f37fd98..00000000
Binary files a/assets/tools/arm/postgresql/postgresql-15/bin/createdb and /dev/null differ
diff --git a/assets/tools/arm/postgresql/postgresql-15/bin/dropdb b/assets/tools/arm/postgresql/postgresql-15/bin/dropdb
deleted file mode 100644
index 9ebc3e95..00000000
Binary files a/assets/tools/arm/postgresql/postgresql-15/bin/dropdb and /dev/null differ
diff --git a/assets/tools/arm/postgresql/postgresql-15/bin/pg_dumpall b/assets/tools/arm/postgresql/postgresql-15/bin/pg_dumpall
deleted file mode 100644
index 8035530e..00000000
Binary files a/assets/tools/arm/postgresql/postgresql-15/bin/pg_dumpall and /dev/null differ
diff --git a/assets/tools/arm/postgresql/postgresql-16/bin/createdb b/assets/tools/arm/postgresql/postgresql-16/bin/createdb
deleted file mode 100644
index 96b07b8f..00000000
Binary files a/assets/tools/arm/postgresql/postgresql-16/bin/createdb and /dev/null differ
diff --git a/assets/tools/arm/postgresql/postgresql-16/bin/dropdb b/assets/tools/arm/postgresql/postgresql-16/bin/dropdb
deleted file mode 100644
index 98d8859a..00000000
Binary files a/assets/tools/arm/postgresql/postgresql-16/bin/dropdb and /dev/null differ
diff --git a/assets/tools/arm/postgresql/postgresql-16/bin/pg_dumpall b/assets/tools/arm/postgresql/postgresql-16/bin/pg_dumpall
deleted file mode 100644
index 5c93c2d8..00000000
Binary files a/assets/tools/arm/postgresql/postgresql-16/bin/pg_dumpall and /dev/null differ
diff --git a/assets/tools/arm/postgresql/postgresql-17/bin/createdb b/assets/tools/arm/postgresql/postgresql-17/bin/createdb
deleted file mode 100644
index 322622ac..00000000
Binary files a/assets/tools/arm/postgresql/postgresql-17/bin/createdb and /dev/null differ
diff --git a/assets/tools/arm/postgresql/postgresql-17/bin/dropdb b/assets/tools/arm/postgresql/postgresql-17/bin/dropdb
deleted file mode 100644
index 66a6aebe..00000000
Binary files a/assets/tools/arm/postgresql/postgresql-17/bin/dropdb and /dev/null differ
diff --git a/assets/tools/arm/postgresql/postgresql-17/bin/pg_dumpall b/assets/tools/arm/postgresql/postgresql-17/bin/pg_dumpall
deleted file mode 100644
index 3b6c8502..00000000
Binary files a/assets/tools/arm/postgresql/postgresql-17/bin/pg_dumpall and /dev/null differ
diff --git a/assets/tools/arm/postgresql/postgresql-18/bin/createdb b/assets/tools/arm/postgresql/postgresql-18/bin/createdb
deleted file mode 100644
index 772ca3fc..00000000
Binary files a/assets/tools/arm/postgresql/postgresql-18/bin/createdb and /dev/null differ
diff --git a/assets/tools/arm/postgresql/postgresql-18/bin/dropdb b/assets/tools/arm/postgresql/postgresql-18/bin/dropdb
deleted file mode 100644
index dca39137..00000000
Binary files a/assets/tools/arm/postgresql/postgresql-18/bin/dropdb and /dev/null differ
diff --git a/assets/tools/arm/postgresql/postgresql-18/bin/pg_dumpall b/assets/tools/arm/postgresql/postgresql-18/bin/pg_dumpall
deleted file mode 100644
index 9355b3a1..00000000
Binary files a/assets/tools/arm/postgresql/postgresql-18/bin/pg_dumpall and /dev/null differ
diff --git a/assets/tools/win-x64/mariadb/mariadb-10.6/bin/mariadb-dump.exe b/assets/tools/win-x64/mariadb/mariadb-10.6/bin/mariadb-dump.exe
new file mode 100644
index 00000000..b38874a0
Binary files /dev/null and b/assets/tools/win-x64/mariadb/mariadb-10.6/bin/mariadb-dump.exe differ
diff --git a/assets/tools/win-x64/mariadb/mariadb-10.6/bin/mariadb.exe b/assets/tools/win-x64/mariadb/mariadb-10.6/bin/mariadb.exe
new file mode 100644
index 00000000..6a5eaa69
Binary files /dev/null and b/assets/tools/win-x64/mariadb/mariadb-10.6/bin/mariadb.exe differ
diff --git a/assets/tools/win-x64/mariadb/mariadb-12.1/bin/mariadb-dump.exe b/assets/tools/win-x64/mariadb/mariadb-12.1/bin/mariadb-dump.exe
new file mode 100644
index 00000000..1e289bdf
Binary files /dev/null and b/assets/tools/win-x64/mariadb/mariadb-12.1/bin/mariadb-dump.exe differ
diff --git a/assets/tools/win-x64/mariadb/mariadb-12.1/bin/mariadb.exe b/assets/tools/win-x64/mariadb/mariadb-12.1/bin/mariadb.exe
new file mode 100644
index 00000000..2e7e9c93
Binary files /dev/null and b/assets/tools/win-x64/mariadb/mariadb-12.1/bin/mariadb.exe differ
diff --git a/assets/tools/win-x64/mongodb/bin/mongodump.exe b/assets/tools/win-x64/mongodb/bin/mongodump.exe
new file mode 100644
index 00000000..e4e3cfc3
Binary files /dev/null and b/assets/tools/win-x64/mongodb/bin/mongodump.exe differ
diff --git a/assets/tools/win-x64/mongodb/bin/mongorestore.exe b/assets/tools/win-x64/mongodb/bin/mongorestore.exe
new file mode 100644
index 00000000..6f5aa7a2
Binary files /dev/null and b/assets/tools/win-x64/mongodb/bin/mongorestore.exe differ
diff --git a/assets/tools/win-x64/mysql/mysql-5.7/bin/mysql.exe b/assets/tools/win-x64/mysql/mysql-5.7/bin/mysql.exe
new file mode 100644
index 00000000..3741f51e
Binary files /dev/null and b/assets/tools/win-x64/mysql/mysql-5.7/bin/mysql.exe differ
diff --git a/assets/tools/win-x64/mysql/mysql-5.7/bin/mysqldump.exe b/assets/tools/win-x64/mysql/mysql-5.7/bin/mysqldump.exe
new file mode 100644
index 00000000..931957ed
Binary files /dev/null and b/assets/tools/win-x64/mysql/mysql-5.7/bin/mysqldump.exe differ
diff --git a/assets/tools/win-x64/mysql/mysql-8.0/bin/mysql.exe b/assets/tools/win-x64/mysql/mysql-8.0/bin/mysql.exe
new file mode 100644
index 00000000..84293cc4
Binary files /dev/null and b/assets/tools/win-x64/mysql/mysql-8.0/bin/mysql.exe differ
diff --git a/assets/tools/win-x64/mysql/mysql-8.0/bin/mysqldump.exe b/assets/tools/win-x64/mysql/mysql-8.0/bin/mysqldump.exe
new file mode 100644
index 00000000..a41a3fe7
Binary files /dev/null and b/assets/tools/win-x64/mysql/mysql-8.0/bin/mysqldump.exe differ
diff --git a/assets/tools/win-x64/mysql/mysql-8.4/bin/mysql.exe b/assets/tools/win-x64/mysql/mysql-8.4/bin/mysql.exe
new file mode 100644
index 00000000..be941faf
Binary files /dev/null and b/assets/tools/win-x64/mysql/mysql-8.4/bin/mysql.exe differ
diff --git a/assets/tools/win-x64/mysql/mysql-8.4/bin/mysqldump.exe b/assets/tools/win-x64/mysql/mysql-8.4/bin/mysqldump.exe
new file mode 100644
index 00000000..27e28540
Binary files /dev/null and b/assets/tools/win-x64/mysql/mysql-8.4/bin/mysqldump.exe differ
diff --git a/assets/tools/win-x64/mysql/mysql-9/bin/mysql.exe b/assets/tools/win-x64/mysql/mysql-9/bin/mysql.exe
new file mode 100644
index 00000000..1b3f2cf8
Binary files /dev/null and b/assets/tools/win-x64/mysql/mysql-9/bin/mysql.exe differ
diff --git a/assets/tools/win-x64/mysql/mysql-9/bin/mysqldump.exe b/assets/tools/win-x64/mysql/mysql-9/bin/mysqldump.exe
new file mode 100644
index 00000000..32245853
Binary files /dev/null and b/assets/tools/win-x64/mysql/mysql-9/bin/mysqldump.exe differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-12/bin/libcrypto-1_1-x64.dll b/assets/tools/win-x64/postgresql/postgresql-12/bin/libcrypto-1_1-x64.dll
new file mode 100644
index 00000000..074f7739
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-12/bin/libcrypto-1_1-x64.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-12/bin/libiconv-2.dll b/assets/tools/win-x64/postgresql/postgresql-12/bin/libiconv-2.dll
new file mode 100644
index 00000000..12a27a94
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-12/bin/libiconv-2.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-12/bin/libintl-9.dll b/assets/tools/win-x64/postgresql/postgresql-12/bin/libintl-9.dll
new file mode 100644
index 00000000..82ffaad6
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-12/bin/libintl-9.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-12/bin/libpq.dll b/assets/tools/win-x64/postgresql/postgresql-12/bin/libpq.dll
new file mode 100644
index 00000000..9338eb31
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-12/bin/libpq.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-12/bin/libssl-1_1-x64.dll b/assets/tools/win-x64/postgresql/postgresql-12/bin/libssl-1_1-x64.dll
new file mode 100644
index 00000000..43b538a4
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-12/bin/libssl-1_1-x64.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-12/bin/libwinpthread-1.dll b/assets/tools/win-x64/postgresql/postgresql-12/bin/libwinpthread-1.dll
new file mode 100644
index 00000000..2d5ecc2e
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-12/bin/libwinpthread-1.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-12/bin/pg_dump.exe b/assets/tools/win-x64/postgresql/postgresql-12/bin/pg_dump.exe
new file mode 100644
index 00000000..11fca123
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-12/bin/pg_dump.exe differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-12/bin/pg_restore.exe b/assets/tools/win-x64/postgresql/postgresql-12/bin/pg_restore.exe
new file mode 100644
index 00000000..923b914b
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-12/bin/pg_restore.exe differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-12/bin/psql.exe b/assets/tools/win-x64/postgresql/postgresql-12/bin/psql.exe
new file mode 100644
index 00000000..8883ac9e
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-12/bin/psql.exe differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-12/bin/zlib1.dll b/assets/tools/win-x64/postgresql/postgresql-12/bin/zlib1.dll
new file mode 100644
index 00000000..e847044c
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-12/bin/zlib1.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-13/bin/libcrypto-1_1-x64.dll b/assets/tools/win-x64/postgresql/postgresql-13/bin/libcrypto-1_1-x64.dll
new file mode 100644
index 00000000..074f7739
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-13/bin/libcrypto-1_1-x64.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-13/bin/libiconv-2.dll b/assets/tools/win-x64/postgresql/postgresql-13/bin/libiconv-2.dll
new file mode 100644
index 00000000..12a27a94
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-13/bin/libiconv-2.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-13/bin/libintl-9.dll b/assets/tools/win-x64/postgresql/postgresql-13/bin/libintl-9.dll
new file mode 100644
index 00000000..82ffaad6
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-13/bin/libintl-9.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-13/bin/libpq.dll b/assets/tools/win-x64/postgresql/postgresql-13/bin/libpq.dll
new file mode 100644
index 00000000..6375fc64
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-13/bin/libpq.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-13/bin/libssl-1_1-x64.dll b/assets/tools/win-x64/postgresql/postgresql-13/bin/libssl-1_1-x64.dll
new file mode 100644
index 00000000..43b538a4
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-13/bin/libssl-1_1-x64.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-13/bin/libwinpthread-1.dll b/assets/tools/win-x64/postgresql/postgresql-13/bin/libwinpthread-1.dll
new file mode 100644
index 00000000..2d5ecc2e
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-13/bin/libwinpthread-1.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-13/bin/pg_dump.exe b/assets/tools/win-x64/postgresql/postgresql-13/bin/pg_dump.exe
new file mode 100644
index 00000000..8f9e387b
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-13/bin/pg_dump.exe differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-13/bin/pg_restore.exe b/assets/tools/win-x64/postgresql/postgresql-13/bin/pg_restore.exe
new file mode 100644
index 00000000..bb2db62e
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-13/bin/pg_restore.exe differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-13/bin/psql.exe b/assets/tools/win-x64/postgresql/postgresql-13/bin/psql.exe
new file mode 100644
index 00000000..3661232d
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-13/bin/psql.exe differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-13/bin/zlib1.dll b/assets/tools/win-x64/postgresql/postgresql-13/bin/zlib1.dll
new file mode 100644
index 00000000..e847044c
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-13/bin/zlib1.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-14/bin/libcrypto-1_1-x64.dll b/assets/tools/win-x64/postgresql/postgresql-14/bin/libcrypto-1_1-x64.dll
new file mode 100644
index 00000000..074f7739
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-14/bin/libcrypto-1_1-x64.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-14/bin/libiconv-2.dll b/assets/tools/win-x64/postgresql/postgresql-14/bin/libiconv-2.dll
new file mode 100644
index 00000000..12a27a94
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-14/bin/libiconv-2.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-14/bin/libintl-9.dll b/assets/tools/win-x64/postgresql/postgresql-14/bin/libintl-9.dll
new file mode 100644
index 00000000..82ffaad6
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-14/bin/libintl-9.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-14/bin/libpq.dll b/assets/tools/win-x64/postgresql/postgresql-14/bin/libpq.dll
new file mode 100644
index 00000000..c7e60874
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-14/bin/libpq.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-14/bin/libssl-1_1-x64.dll b/assets/tools/win-x64/postgresql/postgresql-14/bin/libssl-1_1-x64.dll
new file mode 100644
index 00000000..43b538a4
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-14/bin/libssl-1_1-x64.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-14/bin/libwinpthread-1.dll b/assets/tools/win-x64/postgresql/postgresql-14/bin/libwinpthread-1.dll
new file mode 100644
index 00000000..2d5ecc2e
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-14/bin/libwinpthread-1.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-14/bin/pg_dump.exe b/assets/tools/win-x64/postgresql/postgresql-14/bin/pg_dump.exe
new file mode 100644
index 00000000..9c51a459
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-14/bin/pg_dump.exe differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-14/bin/pg_restore.exe b/assets/tools/win-x64/postgresql/postgresql-14/bin/pg_restore.exe
new file mode 100644
index 00000000..dd5d5878
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-14/bin/pg_restore.exe differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-14/bin/psql.exe b/assets/tools/win-x64/postgresql/postgresql-14/bin/psql.exe
new file mode 100644
index 00000000..9c4343e0
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-14/bin/psql.exe differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-14/bin/zlib1.dll b/assets/tools/win-x64/postgresql/postgresql-14/bin/zlib1.dll
new file mode 100644
index 00000000..e847044c
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-14/bin/zlib1.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-15/bin/libcrypto-3-x64.dll b/assets/tools/win-x64/postgresql/postgresql-15/bin/libcrypto-3-x64.dll
new file mode 100644
index 00000000..82412fa2
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-15/bin/libcrypto-3-x64.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-15/bin/libiconv-2.dll b/assets/tools/win-x64/postgresql/postgresql-15/bin/libiconv-2.dll
new file mode 100644
index 00000000..12a27a94
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-15/bin/libiconv-2.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-15/bin/libintl-9.dll b/assets/tools/win-x64/postgresql/postgresql-15/bin/libintl-9.dll
new file mode 100644
index 00000000..82ffaad6
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-15/bin/libintl-9.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-15/bin/libpq.dll b/assets/tools/win-x64/postgresql/postgresql-15/bin/libpq.dll
new file mode 100644
index 00000000..b44cb1c5
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-15/bin/libpq.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-15/bin/libssl-3-x64.dll b/assets/tools/win-x64/postgresql/postgresql-15/bin/libssl-3-x64.dll
new file mode 100644
index 00000000..230f1570
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-15/bin/libssl-3-x64.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-15/bin/libwinpthread-1.dll b/assets/tools/win-x64/postgresql/postgresql-15/bin/libwinpthread-1.dll
new file mode 100644
index 00000000..2d5ecc2e
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-15/bin/libwinpthread-1.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-15/bin/libzstd.dll b/assets/tools/win-x64/postgresql/postgresql-15/bin/libzstd.dll
new file mode 100644
index 00000000..d1e926a1
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-15/bin/libzstd.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-15/bin/pg_dump.exe b/assets/tools/win-x64/postgresql/postgresql-15/bin/pg_dump.exe
new file mode 100644
index 00000000..e69d1d4b
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-15/bin/pg_dump.exe differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-15/bin/pg_restore.exe b/assets/tools/win-x64/postgresql/postgresql-15/bin/pg_restore.exe
new file mode 100644
index 00000000..7e4405c5
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-15/bin/pg_restore.exe differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-15/bin/psql.exe b/assets/tools/win-x64/postgresql/postgresql-15/bin/psql.exe
new file mode 100644
index 00000000..de85b453
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-15/bin/psql.exe differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-15/bin/zlib1.dll b/assets/tools/win-x64/postgresql/postgresql-15/bin/zlib1.dll
new file mode 100644
index 00000000..e847044c
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-15/bin/zlib1.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-16/bin/libcrypto-3-x64.dll b/assets/tools/win-x64/postgresql/postgresql-16/bin/libcrypto-3-x64.dll
new file mode 100644
index 00000000..82412fa2
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-16/bin/libcrypto-3-x64.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-16/bin/libiconv-2.dll b/assets/tools/win-x64/postgresql/postgresql-16/bin/libiconv-2.dll
new file mode 100644
index 00000000..12a27a94
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-16/bin/libiconv-2.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-16/bin/libintl-9.dll b/assets/tools/win-x64/postgresql/postgresql-16/bin/libintl-9.dll
new file mode 100644
index 00000000..82ffaad6
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-16/bin/libintl-9.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-16/bin/libpq.dll b/assets/tools/win-x64/postgresql/postgresql-16/bin/libpq.dll
new file mode 100644
index 00000000..b5720751
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-16/bin/libpq.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-16/bin/libssl-3-x64.dll b/assets/tools/win-x64/postgresql/postgresql-16/bin/libssl-3-x64.dll
new file mode 100644
index 00000000..230f1570
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-16/bin/libssl-3-x64.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-16/bin/libwinpthread-1.dll b/assets/tools/win-x64/postgresql/postgresql-16/bin/libwinpthread-1.dll
new file mode 100644
index 00000000..2d5ecc2e
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-16/bin/libwinpthread-1.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-16/bin/libzstd.dll b/assets/tools/win-x64/postgresql/postgresql-16/bin/libzstd.dll
new file mode 100644
index 00000000..d1e926a1
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-16/bin/libzstd.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-16/bin/pg_dump.exe b/assets/tools/win-x64/postgresql/postgresql-16/bin/pg_dump.exe
new file mode 100644
index 00000000..9b22093d
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-16/bin/pg_dump.exe differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-16/bin/pg_restore.exe b/assets/tools/win-x64/postgresql/postgresql-16/bin/pg_restore.exe
new file mode 100644
index 00000000..6ae1c821
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-16/bin/pg_restore.exe differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-16/bin/psql.exe b/assets/tools/win-x64/postgresql/postgresql-16/bin/psql.exe
new file mode 100644
index 00000000..ec6c4087
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-16/bin/psql.exe differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-16/bin/zlib1.dll b/assets/tools/win-x64/postgresql/postgresql-16/bin/zlib1.dll
new file mode 100644
index 00000000..e847044c
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-16/bin/zlib1.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-17/bin/libcrypto-3-x64.dll b/assets/tools/win-x64/postgresql/postgresql-17/bin/libcrypto-3-x64.dll
new file mode 100644
index 00000000..2594d57d
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-17/bin/libcrypto-3-x64.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-17/bin/libiconv-2.dll b/assets/tools/win-x64/postgresql/postgresql-17/bin/libiconv-2.dll
new file mode 100644
index 00000000..12a27a94
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-17/bin/libiconv-2.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-17/bin/libintl-9.dll b/assets/tools/win-x64/postgresql/postgresql-17/bin/libintl-9.dll
new file mode 100644
index 00000000..82ffaad6
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-17/bin/libintl-9.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-17/bin/libpq.dll b/assets/tools/win-x64/postgresql/postgresql-17/bin/libpq.dll
new file mode 100644
index 00000000..a7337a05
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-17/bin/libpq.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-17/bin/libssl-3-x64.dll b/assets/tools/win-x64/postgresql/postgresql-17/bin/libssl-3-x64.dll
new file mode 100644
index 00000000..be878c98
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-17/bin/libssl-3-x64.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-17/bin/libwinpthread-1.dll b/assets/tools/win-x64/postgresql/postgresql-17/bin/libwinpthread-1.dll
new file mode 100644
index 00000000..2d5ecc2e
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-17/bin/libwinpthread-1.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-17/bin/libzstd.dll b/assets/tools/win-x64/postgresql/postgresql-17/bin/libzstd.dll
new file mode 100644
index 00000000..d1e926a1
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-17/bin/libzstd.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-17/bin/pg_dump.exe b/assets/tools/win-x64/postgresql/postgresql-17/bin/pg_dump.exe
new file mode 100644
index 00000000..d1c5e340
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-17/bin/pg_dump.exe differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-17/bin/pg_restore.exe b/assets/tools/win-x64/postgresql/postgresql-17/bin/pg_restore.exe
new file mode 100644
index 00000000..d135f5f9
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-17/bin/pg_restore.exe differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-17/bin/psql.exe b/assets/tools/win-x64/postgresql/postgresql-17/bin/psql.exe
new file mode 100644
index 00000000..8a0875f5
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-17/bin/psql.exe differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-17/bin/zlib1.dll b/assets/tools/win-x64/postgresql/postgresql-17/bin/zlib1.dll
new file mode 100644
index 00000000..e847044c
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-17/bin/zlib1.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-18/bin/libcrypto-3-x64.dll b/assets/tools/win-x64/postgresql/postgresql-18/bin/libcrypto-3-x64.dll
new file mode 100644
index 00000000..15631efb
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-18/bin/libcrypto-3-x64.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-18/bin/libiconv-2.dll b/assets/tools/win-x64/postgresql/postgresql-18/bin/libiconv-2.dll
new file mode 100644
index 00000000..bc0e0c77
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-18/bin/libiconv-2.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-18/bin/libintl-9.dll b/assets/tools/win-x64/postgresql/postgresql-18/bin/libintl-9.dll
new file mode 100644
index 00000000..82ffaad6
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-18/bin/libintl-9.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-18/bin/libpq.dll b/assets/tools/win-x64/postgresql/postgresql-18/bin/libpq.dll
new file mode 100644
index 00000000..980e7ba6
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-18/bin/libpq.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-18/bin/libssl-3-x64.dll b/assets/tools/win-x64/postgresql/postgresql-18/bin/libssl-3-x64.dll
new file mode 100644
index 00000000..ec6c9652
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-18/bin/libssl-3-x64.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-18/bin/libwinpthread-1.dll b/assets/tools/win-x64/postgresql/postgresql-18/bin/libwinpthread-1.dll
new file mode 100644
index 00000000..2d5ecc2e
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-18/bin/libwinpthread-1.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-18/bin/libzstd.dll b/assets/tools/win-x64/postgresql/postgresql-18/bin/libzstd.dll
new file mode 100644
index 00000000..e113b6ac
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-18/bin/libzstd.dll differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-18/bin/pg_dump.exe b/assets/tools/win-x64/postgresql/postgresql-18/bin/pg_dump.exe
new file mode 100644
index 00000000..92d13497
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-18/bin/pg_dump.exe differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-18/bin/pg_restore.exe b/assets/tools/win-x64/postgresql/postgresql-18/bin/pg_restore.exe
new file mode 100644
index 00000000..bf20f460
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-18/bin/pg_restore.exe differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-18/bin/psql.exe b/assets/tools/win-x64/postgresql/postgresql-18/bin/psql.exe
new file mode 100644
index 00000000..097de95c
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-18/bin/psql.exe differ
diff --git a/assets/tools/win-x64/postgresql/postgresql-18/bin/zlib1.dll b/assets/tools/win-x64/postgresql/postgresql-18/bin/zlib1.dll
new file mode 100644
index 00000000..e847044c
Binary files /dev/null and b/assets/tools/win-x64/postgresql/postgresql-18/bin/zlib1.dll differ
diff --git a/assets/tools/x64/mongodb/bin/mongodump b/assets/tools/x64/mongodb/bin/mongodump
new file mode 100644
index 00000000..9ffddbca
Binary files /dev/null and b/assets/tools/x64/mongodb/bin/mongodump differ
diff --git a/assets/tools/x64/mongodb/bin/mongorestore b/assets/tools/x64/mongodb/bin/mongorestore
new file mode 100644
index 00000000..e9a8ddc3
Binary files /dev/null and b/assets/tools/x64/mongodb/bin/mongorestore differ
diff --git a/assets/tools/x64/postgresql/postgresql-12/bin/createdb b/assets/tools/x64/postgresql/postgresql-12/bin/createdb
deleted file mode 100644
index 1d08a34e..00000000
Binary files a/assets/tools/x64/postgresql/postgresql-12/bin/createdb and /dev/null differ
diff --git a/assets/tools/x64/postgresql/postgresql-12/bin/dropdb b/assets/tools/x64/postgresql/postgresql-12/bin/dropdb
deleted file mode 100644
index 01b68d01..00000000
Binary files a/assets/tools/x64/postgresql/postgresql-12/bin/dropdb and /dev/null differ
diff --git a/assets/tools/x64/postgresql/postgresql-12/bin/pg_dumpall b/assets/tools/x64/postgresql/postgresql-12/bin/pg_dumpall
deleted file mode 100644
index 0404ab5f..00000000
Binary files a/assets/tools/x64/postgresql/postgresql-12/bin/pg_dumpall and /dev/null differ
diff --git a/assets/tools/x64/postgresql/postgresql-13/bin/createdb b/assets/tools/x64/postgresql/postgresql-13/bin/createdb
deleted file mode 100644
index c1a2c0fd..00000000
Binary files a/assets/tools/x64/postgresql/postgresql-13/bin/createdb and /dev/null differ
diff --git a/assets/tools/x64/postgresql/postgresql-13/bin/dropdb b/assets/tools/x64/postgresql/postgresql-13/bin/dropdb
deleted file mode 100644
index 7378aaaf..00000000
Binary files a/assets/tools/x64/postgresql/postgresql-13/bin/dropdb and /dev/null differ
diff --git a/assets/tools/x64/postgresql/postgresql-13/bin/pg_dumpall b/assets/tools/x64/postgresql/postgresql-13/bin/pg_dumpall
deleted file mode 100644
index 8aecae10..00000000
Binary files a/assets/tools/x64/postgresql/postgresql-13/bin/pg_dumpall and /dev/null differ
diff --git a/assets/tools/x64/postgresql/postgresql-14/bin/createdb b/assets/tools/x64/postgresql/postgresql-14/bin/createdb
deleted file mode 100644
index 054e17d3..00000000
Binary files a/assets/tools/x64/postgresql/postgresql-14/bin/createdb and /dev/null differ
diff --git a/assets/tools/x64/postgresql/postgresql-14/bin/dropdb b/assets/tools/x64/postgresql/postgresql-14/bin/dropdb
deleted file mode 100644
index c7b9fd4f..00000000
Binary files a/assets/tools/x64/postgresql/postgresql-14/bin/dropdb and /dev/null differ
diff --git a/assets/tools/x64/postgresql/postgresql-14/bin/pg_dumpall b/assets/tools/x64/postgresql/postgresql-14/bin/pg_dumpall
deleted file mode 100644
index 4f2f012e..00000000
Binary files a/assets/tools/x64/postgresql/postgresql-14/bin/pg_dumpall and /dev/null differ
diff --git a/assets/tools/x64/postgresql/postgresql-15/bin/createdb b/assets/tools/x64/postgresql/postgresql-15/bin/createdb
deleted file mode 100644
index 8c6c32e3..00000000
Binary files a/assets/tools/x64/postgresql/postgresql-15/bin/createdb and /dev/null differ
diff --git a/assets/tools/x64/postgresql/postgresql-15/bin/dropdb b/assets/tools/x64/postgresql/postgresql-15/bin/dropdb
deleted file mode 100644
index 6c0764de..00000000
Binary files a/assets/tools/x64/postgresql/postgresql-15/bin/dropdb and /dev/null differ
diff --git a/assets/tools/x64/postgresql/postgresql-15/bin/pg_dumpall b/assets/tools/x64/postgresql/postgresql-15/bin/pg_dumpall
deleted file mode 100644
index 1508e48b..00000000
Binary files a/assets/tools/x64/postgresql/postgresql-15/bin/pg_dumpall and /dev/null differ
diff --git a/assets/tools/x64/postgresql/postgresql-16/bin/createdb b/assets/tools/x64/postgresql/postgresql-16/bin/createdb
deleted file mode 100644
index 77b6dda2..00000000
Binary files a/assets/tools/x64/postgresql/postgresql-16/bin/createdb and /dev/null differ
diff --git a/assets/tools/x64/postgresql/postgresql-16/bin/dropdb b/assets/tools/x64/postgresql/postgresql-16/bin/dropdb
deleted file mode 100644
index bd99ab2e..00000000
Binary files a/assets/tools/x64/postgresql/postgresql-16/bin/dropdb and /dev/null differ
diff --git a/assets/tools/x64/postgresql/postgresql-16/bin/pg_dumpall b/assets/tools/x64/postgresql/postgresql-16/bin/pg_dumpall
deleted file mode 100644
index 09d51c7b..00000000
Binary files a/assets/tools/x64/postgresql/postgresql-16/bin/pg_dumpall and /dev/null differ
diff --git a/assets/tools/x64/postgresql/postgresql-17/bin/createdb b/assets/tools/x64/postgresql/postgresql-17/bin/createdb
deleted file mode 100644
index 94318b60..00000000
Binary files a/assets/tools/x64/postgresql/postgresql-17/bin/createdb and /dev/null differ
diff --git a/assets/tools/x64/postgresql/postgresql-17/bin/dropdb b/assets/tools/x64/postgresql/postgresql-17/bin/dropdb
deleted file mode 100644
index de931d2a..00000000
Binary files a/assets/tools/x64/postgresql/postgresql-17/bin/dropdb and /dev/null differ
diff --git a/assets/tools/x64/postgresql/postgresql-17/bin/pg_dumpall b/assets/tools/x64/postgresql/postgresql-17/bin/pg_dumpall
deleted file mode 100644
index de33c639..00000000
Binary files a/assets/tools/x64/postgresql/postgresql-17/bin/pg_dumpall and /dev/null differ
diff --git a/assets/tools/x64/postgresql/postgresql-18/bin/createdb b/assets/tools/x64/postgresql/postgresql-18/bin/createdb
deleted file mode 100644
index aa81113b..00000000
Binary files a/assets/tools/x64/postgresql/postgresql-18/bin/createdb and /dev/null differ
diff --git a/assets/tools/x64/postgresql/postgresql-18/bin/dropdb b/assets/tools/x64/postgresql/postgresql-18/bin/dropdb
deleted file mode 100644
index c5b1d318..00000000
Binary files a/assets/tools/x64/postgresql/postgresql-18/bin/dropdb and /dev/null differ
diff --git a/assets/tools/x64/postgresql/postgresql-18/bin/pg_dumpall b/assets/tools/x64/postgresql/postgresql-18/bin/pg_dumpall
deleted file mode 100644
index f9d2b68a..00000000
Binary files a/assets/tools/x64/postgresql/postgresql-18/bin/pg_dumpall and /dev/null differ
diff --git a/backend/internal/config/config.go b/backend/internal/config/config.go
index 4cb860a0..090b836d 100644
--- a/backend/internal/config/config.go
+++ b/backend/internal/config/config.go
@@ -23,12 +23,8 @@ const (
)
type EnvVariables struct {
- IsTesting bool
- EnvMode env_utils.EnvMode `env:"ENV_MODE" required:"true"`
- PostgresesInstallDir string `env:"POSTGRES_INSTALL_DIR"`
- MysqlInstallDir string `env:"MYSQL_INSTALL_DIR"`
- MariadbInstallDir string `env:"MARIADB_INSTALL_DIR"`
- MongodbInstallDir string `env:"MONGODB_INSTALL_DIR"`
+ IsTesting bool
+ EnvMode env_utils.EnvMode `env:"ENV_MODE" required:"true"`
// Internal database
DatabaseDsn string `env:"DATABASE_DSN" required:"true"`
@@ -218,37 +214,7 @@ func loadEnvVariables() {
}
log.Info("ENV_MODE loaded", "mode", env.EnvMode)
- env.PostgresesInstallDir = filepath.Join(backendRoot, "tools", "postgresql")
- tools.VerifyPostgresesInstallation(
- log,
- env.EnvMode,
- env.PostgresesInstallDir,
- env.ShowDbInstallationVerificationLogs,
- )
-
- env.MysqlInstallDir = filepath.Join(backendRoot, "tools", "mysql")
- tools.VerifyMysqlInstallation(
- log,
- env.EnvMode,
- env.MysqlInstallDir,
- env.ShowDbInstallationVerificationLogs,
- )
-
- env.MariadbInstallDir = filepath.Join(backendRoot, "tools", "mariadb")
- tools.VerifyMariadbInstallation(
- log,
- env.EnvMode,
- env.MariadbInstallDir,
- env.ShowDbInstallationVerificationLogs,
- )
-
- env.MongodbInstallDir = filepath.Join(backendRoot, "tools", "mongodb")
- tools.VerifyMongodbInstallation(
- log,
- env.EnvMode,
- env.MongodbInstallDir,
- env.ShowDbInstallationVerificationLogs,
- )
+ tools.VerifyAllClientTools(log, env.ShowDbInstallationVerificationLogs)
if env.NodeNetworkThroughputMBs == 0 {
env.NodeNetworkThroughputMBs = 125 // 1 Gbit/s
diff --git a/backend/internal/features/backups/backups/usecases/mariadb/create_backup_uc.go b/backend/internal/features/backups/backups/usecases/mariadb/create_backup_uc.go
index a5d3615f..096ccf93 100644
--- a/backend/internal/features/backups/backups/usecases/mariadb/create_backup_uc.go
+++ b/backend/internal/features/backups/backups/usecases/mariadb/create_backup_uc.go
@@ -84,12 +84,7 @@ func (uc *CreateMariadbBackupUsecase) Execute(
ctx,
backup,
backupConfig,
- tools.GetMariadbExecutable(
- tools.MariadbExecutableMariadbDump,
- mdb.Version,
- config.GetEnv().EnvMode,
- config.GetEnv().MariadbInstallDir,
- ),
+ tools.GetMariadbExecutable(mdb.Version, tools.MariadbExecutableMariadbDump),
args,
decryptedPassword,
storage,
diff --git a/backend/internal/features/backups/backups/usecases/mongodb/create_backup_uc.go b/backend/internal/features/backups/backups/usecases/mongodb/create_backup_uc.go
index 17ec0bd2..0dd345da 100644
--- a/backend/internal/features/backups/backups/usecases/mongodb/create_backup_uc.go
+++ b/backend/internal/features/backups/backups/usecases/mongodb/create_backup_uc.go
@@ -78,11 +78,7 @@ func (uc *CreateMongodbBackupUsecase) Execute(
ctx,
backup,
backupConfig,
- tools.GetMongodbExecutable(
- tools.MongodbExecutableMongodump,
- config.GetEnv().EnvMode,
- config.GetEnv().MongodbInstallDir,
- ),
+ tools.GetMongodbExecutable(tools.MongodbExecutableMongodump),
args,
storage,
backupProgressListener,
diff --git a/backend/internal/features/backups/backups/usecases/mysql/create_backup_uc.go b/backend/internal/features/backups/backups/usecases/mysql/create_backup_uc.go
index 9567eb83..ec33e44f 100644
--- a/backend/internal/features/backups/backups/usecases/mysql/create_backup_uc.go
+++ b/backend/internal/features/backups/backups/usecases/mysql/create_backup_uc.go
@@ -84,12 +84,7 @@ func (uc *CreateMysqlBackupUsecase) Execute(
ctx,
backup,
backupConfig,
- tools.GetMysqlExecutable(
- my.Version,
- tools.MysqlExecutableMysqldump,
- config.GetEnv().EnvMode,
- config.GetEnv().MysqlInstallDir,
- ),
+ tools.GetMysqlExecutable(my.Version, tools.MysqlExecutableMysqldump),
args,
decryptedPassword,
storage,
diff --git a/backend/internal/features/backups/backups/usecases/postgresql/create_backup_uc.go b/backend/internal/features/backups/backups/usecases/postgresql/create_backup_uc.go
index 60961cfd..05e13a3b 100644
--- a/backend/internal/features/backups/backups/usecases/postgresql/create_backup_uc.go
+++ b/backend/internal/features/backups/backups/usecases/postgresql/create_backup_uc.go
@@ -90,12 +90,7 @@ func (uc *CreatePostgresqlBackupUsecase) Execute(
ctx,
backup,
backupConfig,
- tools.GetPostgresqlExecutable(
- pg.Version,
- "pg_dump",
- config.GetEnv().EnvMode,
- config.GetEnv().PostgresesInstallDir,
- ),
+ tools.GetPostgresqlExecutable(pg.Version, "pg_dump"),
args,
decryptedPassword,
storage,
diff --git a/backend/internal/features/restores/usecases/mariadb/restore_backup_uc.go b/backend/internal/features/restores/usecases/mariadb/restore_backup_uc.go
index df7e8945..fc5c4e2c 100644
--- a/backend/internal/features/restores/usecases/mariadb/restore_backup_uc.go
+++ b/backend/internal/features/restores/usecases/mariadb/restore_backup_uc.go
@@ -96,12 +96,7 @@ func (uc *RestoreMariadbBackupUsecase) Execute(
return uc.restoreFromStorage(
parentCtx,
originalDB,
- tools.GetMariadbExecutable(
- tools.MariadbExecutableMariadb,
- mdb.Version,
- config.GetEnv().EnvMode,
- config.GetEnv().MariadbInstallDir,
- ),
+ tools.GetMariadbExecutable(mdb.Version, tools.MariadbExecutableMariadb),
args,
mdb.Password,
backup,
diff --git a/backend/internal/features/restores/usecases/mongodb/restore_backup_uc.go b/backend/internal/features/restores/usecases/mongodb/restore_backup_uc.go
index 7d1b4912..20ea4a88 100644
--- a/backend/internal/features/restores/usecases/mongodb/restore_backup_uc.go
+++ b/backend/internal/features/restores/usecases/mongodb/restore_backup_uc.go
@@ -78,11 +78,7 @@ func (uc *RestoreMongodbBackupUsecase) Execute(
return uc.restoreFromStorage(
parentCtx,
- tools.GetMongodbExecutable(
- tools.MongodbExecutableMongorestore,
- config.GetEnv().EnvMode,
- config.GetEnv().MongodbInstallDir,
- ),
+ tools.GetMongodbExecutable(tools.MongodbExecutableMongorestore),
args,
backup,
storage,
diff --git a/backend/internal/features/restores/usecases/mysql/restore_backup_uc.go b/backend/internal/features/restores/usecases/mysql/restore_backup_uc.go
index db605add..e891aec9 100644
--- a/backend/internal/features/restores/usecases/mysql/restore_backup_uc.go
+++ b/backend/internal/features/restores/usecases/mysql/restore_backup_uc.go
@@ -87,12 +87,7 @@ func (uc *RestoreMysqlBackupUsecase) Execute(
return uc.restoreFromStorage(
parentCtx,
originalDB,
- tools.GetMysqlExecutable(
- my.Version,
- tools.MysqlExecutableMysql,
- config.GetEnv().EnvMode,
- config.GetEnv().MysqlInstallDir,
- ),
+ tools.GetMysqlExecutable(my.Version, tools.MysqlExecutableMysql),
args,
my.Password,
backup,
diff --git a/backend/internal/features/restores/usecases/postgresql/restore_backup_uc.go b/backend/internal/features/restores/usecases/postgresql/restore_backup_uc.go
index 7221aa66..ea8b09ed 100644
--- a/backend/internal/features/restores/usecases/postgresql/restore_backup_uc.go
+++ b/backend/internal/features/restores/usecases/postgresql/restore_backup_uc.go
@@ -72,12 +72,7 @@ func (uc *RestorePostgresqlBackupUsecase) Execute(
)
}
- pgBin := tools.GetPostgresqlExecutable(
- pg.Version,
- "pg_restore",
- config.GetEnv().EnvMode,
- config.GetEnv().PostgresesInstallDir,
- )
+ pgBin := tools.GetPostgresqlExecutable(pg.Version, "pg_restore")
// All PostgreSQL backups are now custom format (-Fc)
return uc.restoreCustomType(
diff --git a/backend/internal/util/tools/common.go b/backend/internal/util/tools/common.go
new file mode 100644
index 00000000..0630355f
--- /dev/null
+++ b/backend/internal/util/tools/common.go
@@ -0,0 +1,71 @@
+package tools
+
+import (
+ "log/slog"
+ "os"
+ "path/filepath"
+ "runtime"
+)
+
+// withExeOnWindows appends ".exe" when running on Windows.
+func withExeOnWindows(name string) string {
+ if runtime.GOOS == "windows" {
+ return name + ".exe"
+ }
+
+ return name
+}
+
+// verifyBinDir checks that binDir exists and contains every command in
+// requiredCommands. Logs at the requested verbosity. Exits the process if
+// isFatal is true and anything is missing; otherwise warns and continues.
+func verifyBinDir(
+ logger *slog.Logger,
+ dbName, versionLabel, binDir string,
+ requiredCommands []string,
+ isFatal, isShowLogs bool,
+) {
+ log := logger.With("db", dbName, "version", versionLabel, "path", binDir)
+
+ if isShowLogs {
+ log.Info("verifying client tools installation")
+ }
+
+ if _, err := os.Stat(binDir); os.IsNotExist(err) {
+ if isFatal {
+ log.Error("client tools bin directory not found")
+ os.Exit(1)
+ }
+
+ log.Warn("client tools bin directory not found - support disabled")
+ return
+ }
+
+ for _, cmd := range requiredCommands {
+ cmdPath := filepath.Join(binDir, withExeOnWindows(cmd))
+ if _, err := os.Stat(cmdPath); os.IsNotExist(err) {
+ if isFatal {
+ log.Error("client command not found", "command", cmd, "command_path", cmdPath)
+ os.Exit(1)
+ }
+
+ log.Warn("client command not found - support disabled",
+ "command", cmd, "command_path", cmdPath)
+ continue
+ }
+
+ if isShowLogs {
+ log.Info("client command found", "command", cmd)
+ }
+ }
+}
+
+// VerifyAllClientTools runs the per-DB verifications. Postgres is fatal;
+// MySQL/MariaDB/MongoDB are non-fatal (warn and continue) so the app stays
+// up when only some clients are present.
+func VerifyAllClientTools(logger *slog.Logger, isShowLogs bool) {
+ VerifyPostgresqlInstallation(logger, isShowLogs)
+ VerifyMysqlInstallation(logger, isShowLogs)
+ VerifyMariadbInstallation(logger, isShowLogs)
+ VerifyMongodbInstallation(logger, isShowLogs)
+}
diff --git a/backend/internal/util/tools/mariadb.go b/backend/internal/util/tools/mariadb.go
index 19ac95cf..2f314824 100644
--- a/backend/internal/util/tools/mariadb.go
+++ b/backend/internal/util/tools/mariadb.go
@@ -3,12 +3,8 @@ package tools
import (
"fmt"
"log/slog"
- "os"
"path/filepath"
- "runtime"
"strings"
-
- env_utils "databasus-backend/internal/util/env"
)
type MariadbVersion string
@@ -27,14 +23,14 @@ const (
MariadbVersion120 MariadbVersion = "12.0"
)
-// MariadbClientVersion represents the client tool version to use
+// MariadbClientVersion is the client tool version installed in assets.
type MariadbClientVersion string
const (
- // MariadbClientLegacy is used for older MariaDB servers (5.5, 10.1) that don't support
- // the generation_expression column in information_schema.columns
+ // MariadbClientLegacy is used for older MariaDB servers (5.5, 10.1) that
+ // don't have the generation_expression column in information_schema.columns.
MariadbClientLegacy MariadbClientVersion = "10.6"
- // MariadbClientModern is used for newer MariaDB servers (10.2+)
+ // MariadbClientModern is used for newer MariaDB servers (10.2+).
MariadbClientModern MariadbClientVersion = "12.1"
)
@@ -45,10 +41,10 @@ const (
MariadbExecutableMariadb MariadbExecutable = "mariadb"
)
-// GetMariadbClientVersionForServer returns the appropriate client version to use
-// for a given server version. MariaDB 12.1 client uses SQL queries that reference
-// the generation_expression column which was added in MariaDB 10.2, so older
-// servers (5.5, 10.1) need the legacy 10.6 client.
+// GetMariadbClientVersionForServer returns the client version that talks to
+// the given server version. The 12.1 client uses queries referencing
+// generation_expression (added in MariaDB 10.2), so older servers (5.5, 10.1)
+// need the 10.6 legacy client.
func GetMariadbClientVersionForServer(serverVersion MariadbVersion) MariadbClientVersion {
switch serverVersion {
case MariadbVersion55, MariadbVersion101:
@@ -58,128 +54,42 @@ func GetMariadbClientVersionForServer(serverVersion MariadbVersion) MariadbClien
}
}
-// GetMariadbExecutable returns the full path to a MariaDB executable.
-// The serverVersion parameter determines which client tools to use:
-// - For MariaDB 5.5 and 10.1: uses legacy 10.6 client (compatible with older servers)
-// - For MariaDB 10.2+: uses modern 12.1 client
+// GetMariadbExecutable returns the absolute path to a MariaDB client binary
+// appropriate for the given server version.
func GetMariadbExecutable(
- executable MariadbExecutable,
serverVersion MariadbVersion,
- envMode env_utils.EnvMode,
- mariadbInstallDir string,
+ executable MariadbExecutable,
) string {
clientVersion := GetMariadbClientVersionForServer(serverVersion)
- basePath := getMariadbBasePath(clientVersion, envMode, mariadbInstallDir)
- executableName := string(executable)
-
- if runtime.GOOS == "windows" {
- executableName += ".exe"
- }
+ return filepath.Join(getMariadbBinDir(clientVersion), withExeOnWindows(string(executable)))
+}
- return filepath.Join(basePath, executableName)
+func getMariadbBinDir(clientVersion MariadbClientVersion) string {
+ return filepath.Join(
+ AssetsToolsDir(),
+ "mariadb",
+ fmt.Sprintf("mariadb-%s", clientVersion),
+ "bin",
+ )
}
-// VerifyMariadbInstallation verifies that MariaDB client tools are installed.
-// MariaDB uses two client versions:
-// - Legacy (10.6) for older servers (5.5, 10.1)
-// - Modern (12.1) for newer servers (10.2+)
-func VerifyMariadbInstallation(
- logger *slog.Logger,
- envMode env_utils.EnvMode,
- mariadbInstallDir string,
- isShowLogs bool,
-) {
+// VerifyMariadbInstallation is non-fatal — MariaDB support is optional.
+func VerifyMariadbInstallation(logger *slog.Logger, isShowLogs bool) {
clientVersions := []MariadbClientVersion{MariadbClientLegacy, MariadbClientModern}
- for _, clientVersion := range clientVersions {
- binDir := getMariadbBasePath(clientVersion, envMode, mariadbInstallDir)
-
- if isShowLogs {
- logger.Info(
- "Verifying MariaDB installation",
- "clientVersion", clientVersion,
- "path", binDir,
- )
- }
-
- if _, err := os.Stat(binDir); os.IsNotExist(err) {
- if envMode == env_utils.EnvModeDevelopment {
- logger.Warn(
- "MariaDB bin directory not found. Some MariaDB versions may not be supported. Read ./tools/readme.md for details",
- "clientVersion",
- clientVersion,
- "path",
- binDir,
- )
- } else {
- logger.Warn(
- "MariaDB bin directory not found. Some MariaDB versions may not be supported.",
- "clientVersion", clientVersion,
- "path", binDir,
- )
- }
- continue
- }
-
- requiredCommands := []MariadbExecutable{
- MariadbExecutableMariadbDump,
- MariadbExecutableMariadb,
- }
-
- for _, cmd := range requiredCommands {
- // Use a dummy server version that maps to this client version
- var dummyServerVersion MariadbVersion
- if clientVersion == MariadbClientLegacy {
- dummyServerVersion = MariadbVersion55
- } else {
- dummyServerVersion = MariadbVersion102
- }
- cmdPath := GetMariadbExecutable(cmd, dummyServerVersion, envMode, mariadbInstallDir)
-
- if isShowLogs {
- logger.Info(
- "Checking for MariaDB command",
- "clientVersion", clientVersion,
- "command", cmd,
- "path", cmdPath,
- )
- }
-
- if _, err := os.Stat(cmdPath); os.IsNotExist(err) {
- if envMode == env_utils.EnvModeDevelopment {
- logger.Warn(
- "MariaDB command not found. Some MariaDB versions may not be supported. Read ./tools/readme.md for details",
- "clientVersion",
- clientVersion,
- "command",
- cmd,
- "path",
- cmdPath,
- )
- } else {
- logger.Warn(
- "MariaDB command not found. Some MariaDB versions may not be supported.",
- "clientVersion", clientVersion,
- "command", cmd,
- "path", cmdPath,
- )
- }
- continue
- }
-
- if isShowLogs {
- logger.Info("MariaDB command found", "clientVersion", clientVersion, "command", cmd)
- }
- }
+ required := []string{
+ string(MariadbExecutableMariadbDump),
+ string(MariadbExecutableMariadb),
}
- if isShowLogs {
- logger.Info("MariaDB client tools verification completed!")
+ for _, cv := range clientVersions {
+ verifyBinDir(logger, "mariadb", string(cv), getMariadbBinDir(cv),
+ required, false, isShowLogs)
}
}
-// IsMariadbBackupVersionHigherThanRestoreVersion checks if backup was made with
-// a newer MariaDB version than the restore target
+// IsMariadbBackupVersionHigherThanRestoreVersion reports whether a backup
+// produced on backupVersion would be downgrade-restoring onto restoreVersion.
func IsMariadbBackupVersionHigherThanRestoreVersion(
backupVersion, restoreVersion MariadbVersion,
) bool {
@@ -199,7 +109,6 @@ func IsMariadbBackupVersionHigherThanRestoreVersion(
return versionOrder[backupVersion] > versionOrder[restoreVersion]
}
-// GetMariadbVersionEnum converts a version string to MariadbVersion enum
func GetMariadbVersionEnum(version string) MariadbVersion {
switch version {
case "5.5":
@@ -229,22 +138,10 @@ func GetMariadbVersionEnum(version string) MariadbVersion {
}
}
-// EscapeMariadbPassword escapes special characters for MariaDB .my.cnf file format.
+// EscapeMariadbPassword escapes special characters for the MariaDB .my.cnf
+// file format.
func EscapeMariadbPassword(password string) string {
password = strings.ReplaceAll(password, "\\", "\\\\")
password = strings.ReplaceAll(password, "\"", "\\\"")
return password
}
-
-func getMariadbBasePath(
- clientVersion MariadbClientVersion,
- envMode env_utils.EnvMode,
- mariadbInstallDir string,
-) string {
- if envMode == env_utils.EnvModeDevelopment {
- // Development: tools/mariadb/mariadb-{version}/bin
- return filepath.Join(mariadbInstallDir, fmt.Sprintf("mariadb-%s", clientVersion), "bin")
- }
- // Production: /usr/local/mariadb-{version}/bin
- return fmt.Sprintf("/usr/local/mariadb-%s/bin", clientVersion)
-}
diff --git a/backend/internal/util/tools/mongodb.go b/backend/internal/util/tools/mongodb.go
index ed5eac1d..6d63aaee 100644
--- a/backend/internal/util/tools/mongodb.go
+++ b/backend/internal/util/tools/mongodb.go
@@ -3,12 +3,8 @@ package tools
import (
"fmt"
"log/slog"
- "os"
"path/filepath"
"regexp"
- "runtime"
-
- env_utils "databasus-backend/internal/util/env"
)
type MongodbVersion string
@@ -28,105 +24,30 @@ const (
MongodbExecutableMongorestore MongodbExecutable = "mongorestore"
)
-// GetMongodbExecutable returns the full path to a MongoDB executable.
-// MongoDB Database Tools use a single client version that is backward compatible
-// with all server versions.
-func GetMongodbExecutable(
- executable MongodbExecutable,
- envMode env_utils.EnvMode,
- mongodbInstallDir string,
-) string {
- basePath := getMongodbBasePath(envMode, mongodbInstallDir)
- executableName := string(executable)
-
- if runtime.GOOS == "windows" {
- executableName += ".exe"
- }
-
- return filepath.Join(basePath, executableName)
+// GetMongodbExecutable returns the absolute path to a MongoDB Database Tools
+// binary. The tools are version-agnostic — a single client supports all
+// supported server versions (4.0 – 8.x).
+func GetMongodbExecutable(executable MongodbExecutable) string {
+ return filepath.Join(getMongodbBinDir(), withExeOnWindows(string(executable)))
}
-// VerifyMongodbInstallation verifies that MongoDB Database Tools are installed.
-// Unlike PostgreSQL (version-specific), MongoDB tools use a single version that
-// supports all server versions (backward compatible).
-func VerifyMongodbInstallation(
- logger *slog.Logger,
- envMode env_utils.EnvMode,
- mongodbInstallDir string,
- isShowLogs bool,
-) {
- binDir := getMongodbBasePath(envMode, mongodbInstallDir)
-
- if isShowLogs {
- logger.Info(
- "Verifying MongoDB Database Tools installation",
- "path", binDir,
- )
- }
-
- if _, err := os.Stat(binDir); os.IsNotExist(err) {
- if envMode == env_utils.EnvModeDevelopment {
- logger.Warn(
- "MongoDB bin directory not found. MongoDB support will be disabled. Read ./tools/readme.md for details",
- "path",
- binDir,
- )
- } else {
- logger.Warn(
- "MongoDB bin directory not found. MongoDB support will be disabled.",
- "path", binDir,
- )
- }
- return
- }
-
- requiredCommands := []MongodbExecutable{
- MongodbExecutableMongodump,
- MongodbExecutableMongorestore,
- }
-
- for _, cmd := range requiredCommands {
- cmdPath := GetMongodbExecutable(cmd, envMode, mongodbInstallDir)
-
- if isShowLogs {
- logger.Info(
- "Checking for MongoDB command",
- "command", cmd,
- "path", cmdPath,
- )
- }
-
- if _, err := os.Stat(cmdPath); os.IsNotExist(err) {
- if envMode == env_utils.EnvModeDevelopment {
- logger.Warn(
- "MongoDB command not found. MongoDB support will be disabled. Read ./tools/readme.md for details",
- "command",
- cmd,
- "path",
- cmdPath,
- )
- } else {
- logger.Warn(
- "MongoDB command not found. MongoDB support will be disabled.",
- "command", cmd,
- "path", cmdPath,
- )
- }
- continue
- }
+func getMongodbBinDir() string {
+ return filepath.Join(AssetsToolsDir(), "mongodb", "bin")
+}
- if isShowLogs {
- logger.Info("MongoDB command found", "command", cmd)
- }
+// VerifyMongodbInstallation is non-fatal — MongoDB support is optional.
+func VerifyMongodbInstallation(logger *slog.Logger, isShowLogs bool) {
+ required := []string{
+ string(MongodbExecutableMongodump),
+ string(MongodbExecutableMongorestore),
}
- if isShowLogs {
- logger.Info("MongoDB Database Tools verification completed!")
- }
+ verifyBinDir(logger, "mongodb", "tools", getMongodbBinDir(),
+ required, false, isShowLogs)
}
-// IsMongodbBackupVersionHigherThanRestoreVersion checks if backup was made with
-// a newer MongoDB version than the restore target
+// IsMongodbBackupVersionHigherThanRestoreVersion reports whether a backup
+// produced on backupVersion would be downgrade-restoring onto restoreVersion.
func IsMongodbBackupVersionHigherThanRestoreVersion(
backupVersion, restoreVersion MongodbVersion,
) bool {
@@ -140,8 +61,8 @@ func IsMongodbBackupVersionHigherThanRestoreVersion(
return versionOrder[backupVersion] > versionOrder[restoreVersion]
}
-// GetMongodbVersionEnum converts a version string to MongodbVersion enum.
-// Accepts full version strings (e.g., "8.2", "5.0.1") and extracts the major version.
+// GetMongodbVersionEnum extracts the major version from a full version
+// string (e.g. "8.2", "5.0.1") and returns the matching enum value.
func GetMongodbVersionEnum(version string) MongodbVersion {
re := regexp.MustCompile(`^(\d+)`)
matches := re.FindStringSubmatch(version)
@@ -165,14 +86,3 @@ func GetMongodbVersionEnum(version string) MongodbVersion {
panic(fmt.Sprintf("unsupported mongodb major version: %s", major))
}
}
-
-func getMongodbBasePath(
- envMode env_utils.EnvMode,
- mongodbInstallDir string,
-) string {
- if envMode == env_utils.EnvModeDevelopment {
- return filepath.Join(mongodbInstallDir, "bin")
- }
- // Production: single client version in /usr/local/mongodb-database-tools/bin
- return "/usr/local/mongodb-database-tools/bin"
-}
diff --git a/backend/internal/util/tools/mysql.go b/backend/internal/util/tools/mysql.go
index db601439..e2bfd96a 100644
--- a/backend/internal/util/tools/mysql.go
+++ b/backend/internal/util/tools/mysql.go
@@ -3,12 +3,8 @@ package tools
import (
"fmt"
"log/slog"
- "os"
"path/filepath"
- "runtime"
"strings"
-
- env_utils "databasus-backend/internal/util/env"
)
type MysqlVersion string
@@ -27,36 +23,24 @@ const (
MysqlExecutableMysql MysqlExecutable = "mysql"
)
-// GetMysqlExecutable returns the full path to a specific MySQL executable
-// for the given version. Common executables include: mysqldump, mysql.
-// On Windows, automatically appends .exe extension.
-func GetMysqlExecutable(
- version MysqlVersion,
- executable MysqlExecutable,
- envMode env_utils.EnvMode,
- mysqlInstallDir string,
-) string {
- basePath := getMysqlBasePath(version, envMode, mysqlInstallDir)
- executableName := string(executable)
-
- if runtime.GOOS == "windows" {
- executableName += ".exe"
- }
+// GetMysqlExecutable returns the absolute path to a MySQL client binary for
+// the given version (mysqldump or mysql).
+func GetMysqlExecutable(version MysqlVersion, executable MysqlExecutable) string {
+ return filepath.Join(getMysqlBinDir(version), withExeOnWindows(string(executable)))
+}
- return filepath.Join(basePath, executableName)
+func getMysqlBinDir(version MysqlVersion) string {
+ return filepath.Join(
+ AssetsToolsDir(),
+ "mysql",
+ fmt.Sprintf("mysql-%s", version),
+ "bin",
+ )
}
-// VerifyMysqlInstallation verifies that MySQL versions 5.7, 8.0, 8.4, 9 are installed
-// in the current environment. Each version should be installed with the required
-// client tools (mysqldump, mysql) available.
-// In development: ./tools/mysql/mysql-{VERSION}/bin
-// In production: /usr/local/mysql-{VERSION}/bin
-func VerifyMysqlInstallation(
- logger *slog.Logger,
- envMode env_utils.EnvMode,
- mysqlInstallDir string,
- isShowLogs bool,
-) {
+// VerifyMysqlInstallation is non-fatal — MySQL support is optional, so a
+// missing version warns rather than exiting.
+func VerifyMysqlInstallation(logger *slog.Logger, isShowLogs bool) {
versions := []MysqlVersion{
MysqlVersion57,
MysqlVersion80,
@@ -64,119 +48,19 @@ func VerifyMysqlInstallation(
MysqlVersion9,
}
- requiredCommands := []MysqlExecutable{
- MysqlExecutableMysqldump,
- MysqlExecutableMysql,
- }
-
- for _, version := range versions {
- binDir := getMysqlBasePath(version, envMode, mysqlInstallDir)
-
- if isShowLogs {
- logger.Info(
- "Verifying MySQL installation",
- "version",
- string(version),
- "path",
- binDir,
- )
- }
-
- if _, err := os.Stat(binDir); os.IsNotExist(err) {
- if envMode == env_utils.EnvModeDevelopment {
- logger.Warn(
- "MySQL bin directory not found. MySQL support will be disabled. Read ./tools/readme.md for details",
- "version",
- string(version),
- "path",
- binDir,
- )
- } else {
- logger.Warn(
- "MySQL bin directory not found. MySQL support will be disabled.",
- "version",
- string(version),
- "path",
- binDir,
- )
- }
- continue
- }
-
- for _, cmd := range requiredCommands {
- cmdPath := GetMysqlExecutable(
- version,
- cmd,
- envMode,
- mysqlInstallDir,
- )
-
- if isShowLogs {
- logger.Info(
- "Checking for MySQL command",
- "command",
- cmd,
- "version",
- string(version),
- "path",
- cmdPath,
- )
- }
-
- if _, err := os.Stat(cmdPath); os.IsNotExist(err) {
- if envMode == env_utils.EnvModeDevelopment {
- logger.Warn(
- "MySQL command not found. MySQL support for this version will be disabled. Read ./tools/readme.md for details",
- "command",
- cmd,
- "version",
- string(version),
- "path",
- cmdPath,
- )
- } else {
- logger.Warn(
- "MySQL command not found. MySQL support for this version will be disabled.",
- "command",
- cmd,
- "version",
- string(version),
- "path",
- cmdPath,
- )
- }
- continue
- }
-
- if isShowLogs {
- logger.Info(
- "MySQL command found",
- "command",
- cmd,
- "version",
- string(version),
- )
- }
- }
-
- if isShowLogs {
- logger.Info(
- "Installation of MySQL verified",
- "version",
- string(version),
- "path",
- binDir,
- )
- }
+ required := []string{
+ string(MysqlExecutableMysqldump),
+ string(MysqlExecutableMysql),
}
- if isShowLogs {
- logger.Info("MySQL version-specific client tools verification completed!")
+ for _, v := range versions {
+ verifyBinDir(logger, "mysql", string(v), getMysqlBinDir(v),
+ required, false, isShowLogs)
}
}
-// IsMysqlBackupVersionHigherThanRestoreVersion checks if backup was made with
-// a newer MySQL version than the restore target
+// IsMysqlBackupVersionHigherThanRestoreVersion reports whether a backup
+// produced on backupVersion would be downgrade-restoring onto restoreVersion.
func IsMysqlBackupVersionHigherThanRestoreVersion(
backupVersion, restoreVersion MysqlVersion,
) bool {
@@ -189,16 +73,14 @@ func IsMysqlBackupVersionHigherThanRestoreVersion(
return versionOrder[backupVersion] > versionOrder[restoreVersion]
}
-// EscapeMysqlPassword escapes special characters for MySQL .my.cnf file format.
-// In .my.cnf, passwords with special chars should be quoted.
-// Escape backslash and quote characters.
+// EscapeMysqlPassword escapes special characters for the MySQL .my.cnf file
+// format (passwords with special chars are double-quoted).
func EscapeMysqlPassword(password string) string {
password = strings.ReplaceAll(password, "\\", "\\\\")
password = strings.ReplaceAll(password, "\"", "\\\"")
return password
}
-// GetMysqlVersionEnum converts a version string to MysqlVersion enum
func GetMysqlVersionEnum(version string) MysqlVersion {
switch version {
case "5.7":
@@ -213,18 +95,3 @@ func GetMysqlVersionEnum(version string) MysqlVersion {
panic(fmt.Sprintf("invalid mysql version: %s", version))
}
}
-
-func getMysqlBasePath(
- version MysqlVersion,
- envMode env_utils.EnvMode,
- mysqlInstallDir string,
-) string {
- if envMode == env_utils.EnvModeDevelopment {
- return filepath.Join(
- mysqlInstallDir,
- fmt.Sprintf("mysql-%s", string(version)),
- "bin",
- )
- }
- return fmt.Sprintf("/usr/local/mysql-%s/bin", string(version))
-}
diff --git a/backend/internal/util/tools/paths.go b/backend/internal/util/tools/paths.go
new file mode 100644
index 00000000..c024bdd4
--- /dev/null
+++ b/backend/internal/util/tools/paths.go
@@ -0,0 +1,58 @@
+package tools
+
+import (
+ "fmt"
+ "os"
+ "path/filepath"
+ "runtime"
+ "sync"
+)
+
+// archAssetsKey returns the assets/tools/<key>/ subdirectory name for the
+// current GOOS+GOARCH. Panics on unsupported combinations because the app
+// cannot operate without DB client binaries.
+func archAssetsKey() string {
+ switch runtime.GOOS {
+ case "windows":
+ if runtime.GOARCH == "amd64" {
+ return "win-x64"
+ }
+ case "linux":
+ if runtime.GOARCH == "arm64" {
+ return "arm"
+ }
+
+ return "x64"
+ }
+
+ panic(fmt.Sprintf("unsupported OS/arch for DB client tools: %s/%s",
+ runtime.GOOS, runtime.GOARCH))
+}
+
+// AssetsToolsDir returns the absolute path to assets/tools/<arch-key>/.
+// Walks up from cwd looking for the directory. In Docker (cwd=/app) this
+// resolves to /app/assets/tools/<arch-key>/.
+var AssetsToolsDir = sync.OnceValue(func() string {
+ key := archAssetsKey()
+
+ cwd, err := os.Getwd()
+ if err != nil {
+ panic(fmt.Sprintf("could not get cwd: %v", err))
+ }
+
+ candidate := cwd
+ for {
+ path := filepath.Join(candidate, "assets", "tools", key)
+ if info, err := os.Stat(path); err == nil && info.IsDir() {
+ return path
+ }
+
+ parent := filepath.Dir(candidate)
+ if parent == candidate {
+ break
+ }
+ candidate = parent
+ }
+
+ panic(fmt.Sprintf("could not locate assets/tools/%s starting from %s", key, cwd))
+})
diff --git a/backend/internal/util/tools/postgresql.go b/backend/internal/util/tools/postgresql.go
index d4bf4566..0302dfcc 100644
--- a/backend/internal/util/tools/postgresql.go
+++ b/backend/internal/util/tools/postgresql.go
@@ -3,45 +3,40 @@ package tools
import (
"fmt"
"log/slog"
- "os"
"path/filepath"
"runtime"
"strings"
-
- env_utils "databasus-backend/internal/util/env"
)
-// GetPostgresqlExecutable returns the full path to a specific PostgreSQL executable
-// for the given version. Common executables include: pg_dump, psql, etc.
-// On Windows, automatically appends .exe extension.
+// GetPostgresqlExecutable returns the absolute path to a PostgreSQL client
+// binary for the given version (e.g. pg_dump, pg_restore, psql).
func GetPostgresqlExecutable(
version PostgresqlVersion,
executable PostgresqlExecutable,
- envMode env_utils.EnvMode,
- postgresesInstallDir string,
) string {
- basePath := getPostgresqlBasePath(version, envMode, postgresesInstallDir)
- executableName := string(executable)
+ return filepath.Join(getPostgresqlBinDir(version), withExeOnWindows(string(executable)))
+}
- // Add .exe extension on Windows
+func getPostgresqlBinDir(version PostgresqlVersion) string {
+ // Windows pg 12/13 have a piping bug on restore — fall through to the v14
+ // client which speaks the older wire formats fine.
if runtime.GOOS == "windows" {
- executableName += ".exe"
+ if version == PostgresqlVersion12 || version == PostgresqlVersion13 {
+ version = PostgresqlVersion14
+ }
}
- return filepath.Join(basePath, executableName)
+ return filepath.Join(
+ AssetsToolsDir(),
+ "postgresql",
+ fmt.Sprintf("postgresql-%s", version),
+ "bin",
+ )
}
-// VerifyPostgresesInstallation verifies that PostgreSQL versions 12-18 are installed
-// in the current environment. Each version should be installed with the required
-// client tools (pg_dump, psql) available.
-// In development: ./tools/postgresql/postgresql-{VERSION}/bin
-// In production: /usr/pgsql-{VERSION}/bin
-func VerifyPostgresesInstallation(
- logger *slog.Logger,
- envMode env_utils.EnvMode,
- postgresesInstallDir string,
- isShowLogs bool,
-) {
+// VerifyPostgresqlInstallation is fatal — the app needs every PG version
+// because we read the version from each managed database.
+func VerifyPostgresqlInstallation(logger *slog.Logger, isShowLogs bool) {
versions := []PostgresqlVersion{
PostgresqlVersion12,
PostgresqlVersion13,
@@ -52,156 +47,25 @@ func VerifyPostgresesInstallation(
PostgresqlVersion18,
}
- requiredCommands := []PostgresqlExecutable{
- PostgresqlExecutablePgDump,
- PostgresqlExecutablePsql,
- }
-
- for _, version := range versions {
- binDir := getPostgresqlBasePath(version, envMode, postgresesInstallDir)
-
- if isShowLogs {
- logger.Info(
- "Verifying PostgreSQL installation",
- "version",
- string(version),
- "path",
- binDir,
- )
- }
-
- if _, err := os.Stat(binDir); os.IsNotExist(err) {
- if envMode == env_utils.EnvModeDevelopment {
- logger.Error(
- "PostgreSQL bin directory not found. Make sure PostgreSQL is installed. Read ./tools/readme.md for details",
- "version",
- string(version),
- "path",
- binDir,
- )
- } else {
- logger.Error(
- "PostgreSQL bin directory not found. Please ensure PostgreSQL client tools are installed.",
- "version",
- string(version),
- "path",
- binDir,
- )
- }
- os.Exit(1)
- }
-
- for _, cmd := range requiredCommands {
- cmdPath := GetPostgresqlExecutable(
- version,
- cmd,
- envMode,
- postgresesInstallDir,
- )
-
- if isShowLogs {
- logger.Info(
- "Checking for PostgreSQL command",
- "command",
- cmd,
- "version",
- string(version),
- "path",
- cmdPath,
- )
- }
-
- if _, err := os.Stat(cmdPath); os.IsNotExist(err) {
- if envMode == env_utils.EnvModeDevelopment {
- logger.Error(
- "PostgreSQL command not found. Make sure PostgreSQL is installed. Read ./tools/readme.md for details",
- "command",
- cmd,
- "version",
- string(version),
- "path",
- cmdPath,
- )
- } else {
- logger.Error(
- "PostgreSQL command not found. Please ensure PostgreSQL client tools are properly installed.",
- "command",
- cmd,
- "version",
- string(version),
- "path",
- cmdPath,
- )
- }
- os.Exit(1)
- }
-
- if isShowLogs {
- logger.Info(
- "PostgreSQL command found",
- "command",
- cmd,
- "version",
- string(version),
- )
- }
- }
-
- if isShowLogs {
- logger.Info(
- "Installation of PostgreSQL verified",
- "version",
- string(version),
- "path",
- binDir,
- )
- }
+ required := []string{
+ string(PostgresqlExecutablePgDump),
+ string(PostgresqlExecutablePsql),
}
- if isShowLogs {
- logger.Info(
- "All PostgreSQL version-specific client tools verification completed successfully!",
- )
+ for _, v := range versions {
+ verifyBinDir(logger, "postgresql", string(v), getPostgresqlBinDir(v),
+ required, true, isShowLogs)
}
}
-// EscapePgpassField escapes special characters in a field value for .pgpass file format.
-// According to PostgreSQL documentation, the .pgpass file format requires:
-// - Backslash (\) must be escaped as \\
-// - Colon (:) must be escaped as \:
-// Additionally, newlines and carriage returns are removed to prevent format corruption.
+// EscapePgpassField escapes special characters for the .pgpass file format.
+// PostgreSQL requires backslash → \\ and colon → \:; newlines and carriage
+// returns are stripped to prevent format corruption.
func EscapePgpassField(field string) string {
- // Remove newlines and carriage returns that would break .pgpass format
field = strings.ReplaceAll(field, "\r", "")
field = strings.ReplaceAll(field, "\n", "")
-
- // Escape backslashes first (order matters!)
- // Then escape colons
field = strings.ReplaceAll(field, "\\", "\\\\")
field = strings.ReplaceAll(field, ":", "\\:")
return field
}
-
-func getPostgresqlBasePath(
- version PostgresqlVersion,
- envMode env_utils.EnvMode,
- postgresesInstallDir string,
-) string {
- if envMode == env_utils.EnvModeDevelopment {
- // On Windows, PostgreSQL 12 and 13 have issues with piping over restore
- if runtime.GOOS == "windows" {
- if version == PostgresqlVersion12 || version == PostgresqlVersion13 {
- version = PostgresqlVersion14
- }
- }
-
- return filepath.Join(
- postgresesInstallDir,
- fmt.Sprintf("postgresql-%s", string(version)),
- "bin",
- )
- } else {
- return fmt.Sprintf("/usr/lib/postgresql/%s/bin", string(version))
- }
-}
diff --git a/backend/tools/.gitignore b/backend/tools/.gitignore
deleted file mode 100644
index aa9cd374..00000000
--- a/backend/tools/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-postgresql
-mysql
-downloads
-mariadb
-mongodb
\ No newline at end of file
diff --git a/backend/tools/download_linux.sh b/backend/tools/download_linux.sh
deleted file mode 100644
index 5bf8779b..00000000
--- a/backend/tools/download_linux.sh
+++ /dev/null
@@ -1,359 +0,0 @@
-#!/bin/bash
-
-set -e # Exit on any error
-
-# Ensure non-interactive mode for apt
-export DEBIAN_FRONTEND=noninteractive
-
-echo "Installing PostgreSQL, MySQL, MariaDB and MongoDB client tools for Linux (Debian/Ubuntu)..."
-echo
-
-# Check if running on supported system
-if ! command -v apt-get > /dev/null 2>&1; then
- echo "Error: This script requires apt-get (Debian/Ubuntu-like system)"
- exit 1
-fi
-
-# Check if running as root or with sudo
-if [ $EUID -eq 0 ]; then
- SUDO=""
-else
- SUDO="sudo"
- echo "This script requires sudo privileges to install packages."
-fi
-
-# Create directories
-mkdir -p postgresql
-mkdir -p mysql
-
-# Get absolute paths
-POSTGRES_DIR="$(pwd)/postgresql"
-MYSQL_DIR="$(pwd)/mysql"
-
-echo "Installing PostgreSQL client tools to: $POSTGRES_DIR"
-echo "Installing MySQL client tools to: $MYSQL_DIR"
-echo
-
-# ========== PostgreSQL Installation ==========
-echo "========================================"
-echo "Installing PostgreSQL client tools (versions 12-18)..."
-echo "========================================"
-
-# Add PostgreSQL official APT repository
-echo "Adding PostgreSQL official APT repository..."
-$SUDO apt-get update -qq -y
-$SUDO apt-get install -y -qq wget ca-certificates gnupg lsb-release
-
-# Add GPG key
-wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | $SUDO apt-key add - 2>/dev/null
-
-# Add repository
-echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" | $SUDO tee /etc/apt/sources.list.d/pgdg.list >/dev/null
-
-# Update package list
-echo "Updating package list..."
-$SUDO apt-get update -qq -y
-
-# Install PostgreSQL client tools for each version
-pg_versions="12 13 14 15 16 17 18"
-
-for version in $pg_versions; do
- echo "Installing PostgreSQL $version client tools..."
-
- # Install client tools only
- $SUDO apt-get install -y -qq postgresql-client-$version
-
- # Create version-specific directory and symlinks
- version_dir="$POSTGRES_DIR/postgresql-$version"
- mkdir -p "$version_dir/bin"
-
- # On Debian/Ubuntu, PostgreSQL binaries are located in /usr/lib/postgresql/{version}/bin/
- pg_bin_dir="/usr/lib/postgresql/$version/bin"
-
- if [ -d "$pg_bin_dir" ] && [ -f "$pg_bin_dir/pg_dump" ]; then
- # Create symlinks to the version-specific binaries
- ln -sf "$pg_bin_dir/pg_dump" "$version_dir/bin/pg_dump"
- ln -sf "$pg_bin_dir/pg_dumpall" "$version_dir/bin/pg_dumpall"
- ln -sf "$pg_bin_dir/psql" "$version_dir/bin/psql"
- ln -sf "$pg_bin_dir/pg_restore" "$version_dir/bin/pg_restore"
- ln -sf "$pg_bin_dir/createdb" "$version_dir/bin/createdb"
- ln -sf "$pg_bin_dir/dropdb" "$version_dir/bin/dropdb"
-
- echo "PostgreSQL $version client tools installed successfully"
- else
- echo "Error: PostgreSQL $version binaries not found in expected location: $pg_bin_dir"
- echo "Available PostgreSQL directories:"
- ls -la /usr/lib/postgresql/ 2>/dev/null || echo "No PostgreSQL directories found in /usr/lib/postgresql/"
- if [ -d "$pg_bin_dir" ]; then
- echo "Contents of $pg_bin_dir:"
- ls -la "$pg_bin_dir" 2>/dev/null || echo "Directory exists but cannot list contents"
- fi
- exit 1
- fi
- echo
-done
-
-# ========== MySQL Installation ==========
-echo "========================================"
-echo "Installing MySQL client tools (versions 5.7, 8.0, 8.4, 9)..."
-echo "========================================"
-
-# Download and extract MySQL client tools
-mysql_versions="5.7 8.0 8.4 9"
-
-for version in $mysql_versions; do
- echo "Installing MySQL $version client tools..."
-
- version_dir="$MYSQL_DIR/mysql-$version"
- mkdir -p "$version_dir/bin"
-
- # Skip if already exists
- if [ -f "$version_dir/bin/mysqldump" ]; then
- echo " MySQL $version already installed, skipping..."
- continue
- fi
-
- # Download MySQL client tools from official CDN
- # Note: 5.7 is in Downloads, 8.0, 8.4 specific versions are in archives, 9.5 is in MySQL-9.5
- case $version in
- "5.7")
- MYSQL_URL="https://cdn.mysql.com/Downloads/MySQL-5.7/mysql-5.7.44-linux-glibc2.12-x86_64.tar.gz"
- ;;
- "8.0")
- MYSQL_URL="https://cdn.mysql.com/archives/mysql-8.0/mysql-8.0.40-linux-glibc2.17-x86_64-minimal.tar.xz"
- ;;
- "8.4")
- MYSQL_URL="https://cdn.mysql.com/archives/mysql-8.4/mysql-8.4.3-linux-glibc2.17-x86_64-minimal.tar.xz"
- ;;
- "9")
- MYSQL_URL="https://dev.mysql.com/get/Downloads/MySQL-9.5/mysql-9.5.0-linux-glibc2.28-x86_64.tar.xz"
- ;;
- esac
-
- TEMP_DIR="/tmp/mysql_install_$version"
- mkdir -p "$TEMP_DIR"
- cd "$TEMP_DIR"
-
- echo " Downloading MySQL $version..."
- wget -q "$MYSQL_URL" -O "mysql-$version.tar.gz" || wget -q "$MYSQL_URL" -O "mysql-$version.tar.xz"
-
- echo " Extracting MySQL $version..."
- case "$MYSQL_URL" in
- *.xz)
- tar -xJf "mysql-$version.tar.xz" 2>/dev/null || tar -xJf "mysql-$version.tar.gz" 2>/dev/null
- ;;
- *)
- tar -xzf "mysql-$version.tar.gz" 2>/dev/null || tar -xzf "mysql-$version.tar.xz" 2>/dev/null
- ;;
- esac
-
- # Find extracted directory
- EXTRACTED_DIR=$(ls -d mysql-*/ 2>/dev/null | head -1)
-
- if [ -d "$EXTRACTED_DIR" ] && [ -f "$EXTRACTED_DIR/bin/mysqldump" ]; then
- # Copy client binaries
- cp "$EXTRACTED_DIR/bin/mysql" "$version_dir/bin/" 2>/dev/null || true
- cp "$EXTRACTED_DIR/bin/mysqldump" "$version_dir/bin/" 2>/dev/null || true
- chmod +x "$version_dir/bin/"*
-
- echo " MySQL $version client tools installed successfully"
- else
- echo " Warning: Could not extract MySQL $version binaries"
- echo " You may need to install MySQL $version client tools manually"
- fi
-
- # Cleanup
- cd - >/dev/null
- rm -rf "$TEMP_DIR"
- echo
-done
-
-# ========== MariaDB Installation ==========
-echo "========================================"
-echo "Installing MariaDB client tools (versions 10.6 and 12.1)..."
-echo "========================================"
-
-# MariaDB uses two client versions:
-# - 10.6 (legacy): For older servers (5.5, 10.1) that don't have generation_expression column
-# - 12.1 (modern): For newer servers (10.2+)
-
-MARIADB_DIR="$(pwd)/mariadb"
-
-echo "Installing MariaDB client tools to: $MARIADB_DIR"
-
-# Install dependencies
-$SUDO apt-get install -y -qq apt-transport-https curl
-
-# MariaDB versions to install
-mariadb_versions="10.6 12.1"
-
-for version in $mariadb_versions; do
- echo "Installing MariaDB $version client tools..."
-
- version_dir="$MARIADB_DIR/mariadb-$version"
- mkdir -p "$version_dir/bin"
-
- # Skip if already exists
- if [ -f "$version_dir/bin/mariadb-dump" ]; then
- echo "MariaDB $version already installed, skipping..."
- continue
- fi
-
- # Get URL based on version
- case "$version" in
- "10.6")
- url="https://archive.mariadb.org/mariadb-10.6.21/bintar-linux-systemd-x86_64/mariadb-10.6.21-linux-systemd-x86_64.tar.gz"
- ;;
- "12.1")
- url="https://archive.mariadb.org/mariadb-12.1.2/bintar-linux-systemd-x86_64/mariadb-12.1.2-linux-systemd-x86_64.tar.gz"
- ;;
- *)
- echo " Warning: Unknown MariaDB version $version"
- continue
- ;;
- esac
-
- TEMP_DIR="/tmp/mariadb_install_$version"
- mkdir -p "$TEMP_DIR"
- cd "$TEMP_DIR"
-
- echo " Downloading MariaDB $version from official archive..."
- wget -q "$url" -O "mariadb-$version.tar.gz" || {
- echo " Warning: Could not download MariaDB $version binaries"
- cd - >/dev/null
- rm -rf "$TEMP_DIR"
- continue
- }
-
- echo " Extracting MariaDB $version..."
- tar -xzf "mariadb-$version.tar.gz"
- EXTRACTED_DIR=$(ls -d mariadb-*/ 2>/dev/null | head -1)
-
- if [ -d "$EXTRACTED_DIR" ] && [ -f "$EXTRACTED_DIR/bin/mariadb-dump" ]; then
- cp "$EXTRACTED_DIR/bin/mariadb" "$version_dir/bin/" 2>/dev/null || true
- cp "$EXTRACTED_DIR/bin/mariadb-dump" "$version_dir/bin/" 2>/dev/null || true
- chmod +x "$version_dir/bin/"*
- echo " MariaDB $version client tools installed successfully"
- else
- echo " Warning: Could not extract MariaDB $version binaries"
- fi
-
- # Cleanup
- cd - >/dev/null
- rm -rf "$TEMP_DIR"
- echo
-done
-
-# ========== MongoDB Installation ==========
-echo "========================================"
-echo "Installing MongoDB Database Tools (single latest version)..."
-echo "========================================"
-
-MONGODB_DIR="$(pwd)/mongodb"
-mkdir -p "$MONGODB_DIR/bin"
-
-echo "Installing MongoDB Database Tools to: $MONGODB_DIR"
-
-# Skip if already installed
-if [ -f "$MONGODB_DIR/bin/mongodump" ] && [ -L "$MONGODB_DIR/bin/mongodump" ]; then
- echo "MongoDB Database Tools already installed, skipping..."
-else
- # MongoDB Database Tools are backward compatible - single version supports all servers (4.0-8.0)
- # Detect architecture
- ARCH=$(uname -m)
- if [ "$ARCH" = "x86_64" ]; then
- MONGODB_TOOLS_URL="https://fastdl.mongodb.org/tools/db/mongodb-database-tools-debian12-x86_64-100.10.0.deb"
- elif [ "$ARCH" = "aarch64" ]; then
- MONGODB_TOOLS_URL="https://fastdl.mongodb.org/tools/db/mongodb-database-tools-debian12-aarch64-100.10.0.deb"
- else
- echo "Warning: Unsupported architecture $ARCH for MongoDB Database Tools"
- MONGODB_TOOLS_URL=""
- fi
-
- if [ -n "$MONGODB_TOOLS_URL" ]; then
- TEMP_DIR="/tmp/mongodb_install"
- mkdir -p "$TEMP_DIR"
- cd "$TEMP_DIR"
-
- echo "Downloading MongoDB Database Tools..."
- if ! wget -q "$MONGODB_TOOLS_URL" -O mongodb-database-tools.deb; then
- echo "Warning: Could not download MongoDB Database Tools"
- cd - >/dev/null
- rm -rf "$TEMP_DIR"
- else
- if [ -f "mongodb-database-tools.deb" ]; then
- echo "Installing MongoDB Database Tools..."
- $SUDO dpkg -i mongodb-database-tools.deb 2>/dev/null || $SUDO apt-get install -f -y -qq
-
- # Create symlinks to tools directory
- ln -sf /usr/bin/mongodump "$MONGODB_DIR/bin/mongodump"
- ln -sf /usr/bin/mongorestore "$MONGODB_DIR/bin/mongorestore"
-
- echo "MongoDB Database Tools installed successfully"
- fi
-
- cd - >/dev/null
- rm -rf "$TEMP_DIR"
- fi
- fi
-fi
-
-echo
-
-echo "========================================"
-echo "Installation completed!"
-echo "========================================"
-echo
-echo "PostgreSQL client tools are available in: $POSTGRES_DIR"
-echo "MySQL client tools are available in: $MYSQL_DIR"
-echo "MariaDB client tools are available in: $MARIADB_DIR"
-echo "MongoDB Database Tools are available in: $MONGODB_DIR"
-echo
-
-# List installed PostgreSQL versions
-echo "Installed PostgreSQL client versions:"
-for version in $pg_versions; do
- version_dir="$POSTGRES_DIR/postgresql-$version"
- if [ -f "$version_dir/bin/pg_dump" ]; then
- echo " postgresql-$version: $version_dir/bin/"
- version_output=$("$version_dir/bin/pg_dump" --version 2>/dev/null | grep -o "pg_dump (PostgreSQL) [0-9]\+\.[0-9]\+")
- echo " Version check: $version_output"
- fi
-done
-
-echo
-echo "Installed MySQL client versions:"
-for version in $mysql_versions; do
- version_dir="$MYSQL_DIR/mysql-$version"
- if [ -f "$version_dir/bin/mysqldump" ]; then
- echo " mysql-$version: $version_dir/bin/"
- version_output=$("$version_dir/bin/mysqldump" --version 2>/dev/null | head -1)
- echo " Version check: $version_output"
- fi
-done
-
-echo
-echo "Installed MariaDB client versions:"
-for version in $mariadb_versions; do
- version_dir="$MARIADB_DIR/mariadb-$version"
- if [ -f "$version_dir/bin/mariadb-dump" ]; then
- echo " mariadb-$version: $version_dir/bin/"
- version_output=$("$version_dir/bin/mariadb-dump" --version 2>/dev/null | head -1)
- echo " Version check: $version_output"
- fi
-done
-
-echo
-echo "Installed MongoDB Database Tools:"
-if [ -f "$MONGODB_DIR/bin/mongodump" ]; then
- echo " mongodb: $MONGODB_DIR/bin/"
- version_output=$("$MONGODB_DIR/bin/mongodump" --version 2>/dev/null | head -1)
- echo " Version check: $version_output"
-fi
-
-echo
-echo "Usage examples:"
-echo " $POSTGRES_DIR/postgresql-15/bin/pg_dump --version"
-echo " $MYSQL_DIR/mysql-8.0/bin/mysqldump --version"
-echo " $MARIADB_DIR/mariadb-12.1/bin/mariadb-dump --version"
-echo " $MONGODB_DIR/bin/mongodump --version"
\ No newline at end of file
diff --git a/backend/tools/download_macos.sh b/backend/tools/download_macos.sh
deleted file mode 100755
index 05fd9b96..00000000
--- a/backend/tools/download_macos.sh
+++ /dev/null
@@ -1,392 +0,0 @@
-#!/bin/bash
-
-set -e # Exit on any error
-
-echo "Installing PostgreSQL, MySQL, MariaDB and MongoDB client tools for MacOS..."
-echo
-
-# Check if Homebrew is installed
-if ! command -v brew &> /dev/null; then
- echo "Error: This script requires Homebrew to be installed."
- echo "Install Homebrew from: https://brew.sh/"
- exit 1
-fi
-
-# Create directories
-mkdir -p postgresql
-mkdir -p mysql
-
-# Get absolute paths
-POSTGRES_DIR="$(pwd)/postgresql"
-MYSQL_DIR="$(pwd)/mysql"
-
-echo "Installing PostgreSQL client tools to: $POSTGRES_DIR"
-echo "Installing MySQL client tools to: $MYSQL_DIR"
-echo
-
-# Update Homebrew
-echo "Updating Homebrew..."
-brew update
-
-# Install build dependencies
-echo "Installing build dependencies..."
-brew install wget openssl readline zlib cmake
-
-# ========== PostgreSQL Installation ==========
-echo "========================================"
-echo "Building PostgreSQL client tools (versions 12-18)..."
-echo "========================================"
-
-# PostgreSQL source URLs
-declare -A PG_URLS=(
- ["12"]="https://ftp.postgresql.org/pub/source/v12.20/postgresql-12.20.tar.gz"
- ["13"]="https://ftp.postgresql.org/pub/source/v13.16/postgresql-13.16.tar.gz"
- ["14"]="https://ftp.postgresql.org/pub/source/v14.13/postgresql-14.13.tar.gz"
- ["15"]="https://ftp.postgresql.org/pub/source/v15.8/postgresql-15.8.tar.gz"
- ["16"]="https://ftp.postgresql.org/pub/source/v16.4/postgresql-16.4.tar.gz"
- ["17"]="https://ftp.postgresql.org/pub/source/v17.0/postgresql-17.0.tar.gz"
- ["18"]="https://ftp.postgresql.org/pub/source/v18.0/postgresql-18.0.tar.gz"
-)
-
-# Create temporary build directory
-BUILD_DIR="/tmp/db_tools_build_$$"
-mkdir -p "$BUILD_DIR"
-
-echo "Using temporary build directory: $BUILD_DIR"
-echo
-
-# Function to build PostgreSQL client tools
-build_postgresql_client() {
- local version=$1
- local url=$2
- local version_dir="$POSTGRES_DIR/postgresql-$version"
-
- echo "Building PostgreSQL $version client tools..."
-
- # Skip if already exists
- if [ -f "$version_dir/bin/pg_dump" ]; then
- echo "PostgreSQL $version already installed, skipping..."
- return
- fi
-
- cd "$BUILD_DIR"
-
- # Download source
- echo " Downloading PostgreSQL $version source..."
- wget -q "$url" -O "postgresql-$version.tar.gz"
-
- # Extract
- echo " Extracting source..."
- tar -xzf "postgresql-$version.tar.gz"
- cd "postgresql-$version"*
-
- # Configure (client tools only)
- echo " Configuring build..."
- ./configure \
- --prefix="$version_dir" \
- --with-openssl \
- --with-readline \
- --without-zlib \
- --disable-server \
- --disable-docs \
- --quiet
-
- # Build client tools only
- echo " Building client tools (this may take a few minutes)..."
- make -s -C src/bin install
- make -s -C src/include install
- make -s -C src/interfaces install
-
- # Verify installation
- if [ -f "$version_dir/bin/pg_dump" ]; then
- echo " PostgreSQL $version client tools installed successfully"
-
- # Test the installation
- local pg_version=$("$version_dir/bin/pg_dump" --version | cut -d' ' -f3)
- echo " Verified version: $pg_version"
- else
- echo " Warning: PostgreSQL $version may not have installed correctly"
- fi
-
- # Clean up source
- cd "$BUILD_DIR"
- rm -rf "postgresql-$version"*
-
- echo
-}
-
-# Build each PostgreSQL version
-pg_versions="12 13 14 15 16 17 18"
-
-for version in $pg_versions; do
- url=${PG_URLS[$version]}
- if [ -n "$url" ]; then
- build_postgresql_client "$version" "$url"
- else
- echo "Warning: No URL defined for PostgreSQL $version"
- fi
-done
-
-# ========== MySQL Installation ==========
-echo "========================================"
-echo "Installing MySQL client tools (versions 5.7, 8.0, 8.4, 9)..."
-echo "========================================"
-
-# Detect architecture
-ARCH=$(uname -m)
-if [ "$ARCH" = "arm64" ]; then
- MYSQL_ARCH="arm64"
-else
- MYSQL_ARCH="x86_64"
-fi
-
-# MySQL download URLs for macOS (using CDN)
-# Note: 5.7 is in Downloads, 8.0, 8.4 specific versions are in archives, 9.5 is in MySQL-9.5
-declare -A MYSQL_URLS=(
- ["5.7"]="https://cdn.mysql.com/Downloads/MySQL-5.7/mysql-5.7.44-macos10.14-x86_64.tar.gz"
- ["8.0"]="https://cdn.mysql.com/archives/mysql-8.0/mysql-8.0.40-macos14-${MYSQL_ARCH}.tar.gz"
- ["8.4"]="https://cdn.mysql.com/archives/mysql-8.4/mysql-8.4.3-macos14-${MYSQL_ARCH}.tar.gz"
- ["9"]="https://dev.mysql.com/get/Downloads/MySQL-9.5/mysql-9.5.0-macos14-${MYSQL_ARCH}.tar.gz"
-)
-
-# Function to install MySQL client tools
-install_mysql_client() {
- local version=$1
- local url=$2
- local version_dir="$MYSQL_DIR/mysql-$version"
-
- echo "Installing MySQL $version client tools..."
-
- # Skip if already exists
- if [ -f "$version_dir/bin/mysqldump" ]; then
- echo "MySQL $version already installed, skipping..."
- return
- fi
-
- mkdir -p "$version_dir/bin"
- cd "$BUILD_DIR"
-
- # Download
- echo " Downloading MySQL $version..."
- wget -q "$url" -O "mysql-$version.tar.gz" || {
- echo " Warning: Could not download MySQL $version for $MYSQL_ARCH"
- echo " You may need to install MySQL $version client tools manually"
- return
- }
-
- # Extract
- echo " Extracting MySQL $version..."
- tar -xzf "mysql-$version.tar.gz"
-
- # Find extracted directory
- EXTRACTED_DIR=$(ls -d mysql-*/ 2>/dev/null | head -1)
-
- if [ -d "$EXTRACTED_DIR" ] && [ -f "$EXTRACTED_DIR/bin/mysqldump" ]; then
- # Copy client binaries
- cp "$EXTRACTED_DIR/bin/mysql" "$version_dir/bin/" 2>/dev/null || true
- cp "$EXTRACTED_DIR/bin/mysqldump" "$version_dir/bin/" 2>/dev/null || true
- chmod +x "$version_dir/bin/"*
-
- echo " MySQL $version client tools installed successfully"
-
- # Test the installation
- local mysql_version=$("$version_dir/bin/mysqldump" --version 2>/dev/null | head -1)
- echo " Verified: $mysql_version"
- else
- echo " Warning: Could not extract MySQL $version binaries"
- echo " You may need to install MySQL $version client tools manually"
- fi
-
- # Clean up
- rm -rf "mysql-$version.tar.gz" mysql-*/
-
- echo
-}
-
-# Install each MySQL version
-mysql_versions="5.7 8.0 8.4 9"
-
-for version in $mysql_versions; do
- url=${MYSQL_URLS[$version]}
- if [ -n "$url" ]; then
- install_mysql_client "$version" "$url"
- else
- echo "Warning: No URL defined for MySQL $version"
- fi
-done
-
-# ========== MariaDB Installation ==========
-echo "========================================"
-echo "Installing MariaDB client tools (versions 10.6 and 12.1)..."
-echo "========================================"
-
-# MariaDB uses two client versions:
-# - 10.6 (legacy): For older servers (5.5, 10.1) that don't have generation_expression column
-# - 12.1 (modern): For newer servers (10.2+)
-
-MARIADB_DIR="$(pwd)/mariadb"
-
-echo "Installing MariaDB client tools to: $MARIADB_DIR"
-
-# MariaDB versions to install
-# Note: MariaDB doesn't provide pre-built macOS binaries for older versions
-# We install via Homebrew and use the same version for both (Homebrew only has latest)
-# For production macOS use, the latest client should work with older servers for basic operations
-
-mariadb_versions="10.6 12.1"
-
-# Install MariaDB via Homebrew first (we'll use it for the modern version)
-echo " Installing MariaDB via Homebrew..."
-brew install mariadb 2>/dev/null || {
- echo " Warning: Could not install mariadb via Homebrew"
- brew install mariadb-connector-c 2>/dev/null || true
-}
-
-# Find Homebrew MariaDB path
-BREW_MARIADB=""
-if [ -f "/opt/homebrew/bin/mariadb-dump" ]; then
- BREW_MARIADB="/opt/homebrew/bin"
-elif [ -f "/usr/local/bin/mariadb-dump" ]; then
- BREW_MARIADB="/usr/local/bin"
-else
- BREW_PREFIX=$(brew --prefix mariadb 2>/dev/null || echo "")
- if [ -n "$BREW_PREFIX" ] && [ -f "$BREW_PREFIX/bin/mariadb-dump" ]; then
- BREW_MARIADB="$BREW_PREFIX/bin"
- fi
-fi
-
-for version in $mariadb_versions; do
- echo "Setting up MariaDB $version client tools..."
-
- version_dir="$MARIADB_DIR/mariadb-$version"
- mkdir -p "$version_dir/bin"
-
- # Skip if already exists
- if [ -f "$version_dir/bin/mariadb-dump" ]; then
- echo " MariaDB $version already installed, skipping..."
- continue
- fi
-
- if [ -n "$BREW_MARIADB" ]; then
- # Link from Homebrew
- # Note: On macOS, we use the same Homebrew version for both paths
- # The Homebrew version (latest) should handle both old and new servers
- ln -sf "$BREW_MARIADB/mariadb" "$version_dir/bin/mariadb"
- ln -sf "$BREW_MARIADB/mariadb-dump" "$version_dir/bin/mariadb-dump"
- echo " MariaDB $version client tools linked from Homebrew"
-
- # Test the installation
- mariadb_ver=$("$version_dir/bin/mariadb-dump" --version 2>/dev/null | head -1)
- echo " Verified: $mariadb_ver"
- else
- echo " Warning: Could not find MariaDB binaries for $version"
- echo " Please install MariaDB manually: brew install mariadb"
- fi
- echo
-done
-
-# ========== MongoDB Installation ==========
-echo "========================================"
-echo "Installing MongoDB Database Tools..."
-echo "========================================"
-
-MONGODB_DIR="$(pwd)/mongodb"
-mkdir -p "$MONGODB_DIR/bin"
-
-echo "Installing MongoDB Database Tools to: $MONGODB_DIR"
-
-# Install via Homebrew
-echo " Installing MongoDB Database Tools via Homebrew..."
-brew tap mongodb/brew 2>/dev/null || true
-brew install mongodb-database-tools 2>/dev/null || {
- echo " Warning: Could not install mongodb-database-tools via Homebrew"
-}
-
-# Find Homebrew MongoDB tools path
-BREW_MONGODB=""
-if [ -f "/opt/homebrew/bin/mongodump" ]; then
- BREW_MONGODB="/opt/homebrew/bin"
-elif [ -f "/usr/local/bin/mongodump" ]; then
- BREW_MONGODB="/usr/local/bin"
-fi
-
-if [ -n "$BREW_MONGODB" ]; then
- ln -sf "$BREW_MONGODB/mongodump" "$MONGODB_DIR/bin/mongodump"
- ln -sf "$BREW_MONGODB/mongorestore" "$MONGODB_DIR/bin/mongorestore"
- echo " MongoDB Database Tools linked from Homebrew"
-
- mongodump_ver=$("$MONGODB_DIR/bin/mongodump" --version 2>/dev/null | head -1)
- echo " Verified: $mongodump_ver"
-else
- echo " Warning: Could not find MongoDB Database Tools binaries"
- echo " Please install manually: brew tap mongodb/brew && brew install mongodb-database-tools"
-fi
-
-echo
-
-# Clean up build directory
-echo "Cleaning up build directory..."
-rm -rf "$BUILD_DIR"
-
-echo "========================================"
-echo "Installation completed!"
-echo "========================================"
-echo
-echo "PostgreSQL client tools are available in: $POSTGRES_DIR"
-echo "MySQL client tools are available in: $MYSQL_DIR"
-echo "MariaDB client tools are available in: $MARIADB_DIR"
-echo "MongoDB Database Tools are available in: $MONGODB_DIR"
-echo
-
-# List installed PostgreSQL versions
-echo "Installed PostgreSQL client versions:"
-for version in $pg_versions; do
- version_dir="$POSTGRES_DIR/postgresql-$version"
- if [ -f "$version_dir/bin/pg_dump" ]; then
- pg_version=$("$version_dir/bin/pg_dump" --version | cut -d' ' -f3)
- echo " postgresql-$version ($pg_version): $version_dir/bin/"
- fi
-done
-
-echo
-echo "Installed MySQL client versions:"
-for version in $mysql_versions; do
- version_dir="$MYSQL_DIR/mysql-$version"
- if [ -f "$version_dir/bin/mysqldump" ]; then
- mysql_version=$("$version_dir/bin/mysqldump" --version 2>/dev/null | head -1)
- echo " mysql-$version: $version_dir/bin/"
- echo " $mysql_version"
- fi
-done
-
-echo
-echo "Installed MariaDB client versions:"
-for version in $mariadb_versions; do
- version_dir="$MARIADB_DIR/mariadb-$version"
- if [ -f "$version_dir/bin/mariadb-dump" ]; then
- mariadb_ver=$("$version_dir/bin/mariadb-dump" --version 2>/dev/null | head -1)
- echo " mariadb-$version: $version_dir/bin/"
- echo " $mariadb_ver"
- fi
-done
-
-echo
-echo "Installed MongoDB Database Tools:"
-if [ -f "$MONGODB_DIR/bin/mongodump" ]; then
- mongodump_ver=$("$MONGODB_DIR/bin/mongodump" --version 2>/dev/null | head -1)
- echo " mongodb: $MONGODB_DIR/bin/"
- echo " $mongodump_ver"
-fi
-
-echo
-echo "Usage examples:"
-echo " $POSTGRES_DIR/postgresql-15/bin/pg_dump --version"
-echo " $MYSQL_DIR/mysql-8.0/bin/mysqldump --version"
-echo " $MARIADB_DIR/mariadb-12.1/bin/mariadb-dump --version"
-echo " $MONGODB_DIR/bin/mongodump --version"
-echo
-echo "To add specific versions to your PATH temporarily:"
-echo " export PATH=\"$POSTGRES_DIR/postgresql-15/bin:\$PATH\""
-echo " export PATH=\"$MYSQL_DIR/mysql-8.0/bin:\$PATH\""
-echo " export PATH=\"$MARIADB_DIR/mariadb-12.1/bin:\$PATH\""
-echo " export PATH=\"$MONGODB_DIR/bin:\$PATH\""
\ No newline at end of file
diff --git a/backend/tools/download_windows.bat b/backend/tools/download_windows.bat
deleted file mode 100644
index 1314b51d..00000000
--- a/backend/tools/download_windows.bat
+++ /dev/null
@@ -1,414 +0,0 @@
-@echo off
-setlocal enabledelayedexpansion
-
-echo Downloading and installing PostgreSQL, MySQL, MariaDB and MongoDB client tools for Windows...
-echo.
-
-:: Create directories if they don't exist
-if not exist "downloads" mkdir downloads
-if not exist "postgresql" mkdir postgresql
-if not exist "mysql" mkdir mysql
-if not exist "mariadb" mkdir mariadb
-if not exist "mongodb" mkdir mongodb
-
-:: Get the absolute paths
-set "POSTGRES_DIR=%cd%\postgresql"
-set "MYSQL_DIR=%cd%\mysql"
-set "MARIADB_DIR=%cd%\mariadb"
-set "MONGODB_DIR=%cd%\mongodb"
-
-echo PostgreSQL will be installed to: %POSTGRES_DIR%
-echo MySQL will be installed to: %MYSQL_DIR%
-echo MariaDB will be installed to: %MARIADB_DIR%
-echo MongoDB will be installed to: %MONGODB_DIR%
-echo.
-
-cd downloads
-
-:: ========== PostgreSQL Installation ==========
-echo ========================================
-echo Installing PostgreSQL client tools (versions 12-18)...
-echo ========================================
-echo.
-
-:: PostgreSQL download URLs for Windows x64
-set "BASE_URL=https://get.enterprisedb.com/postgresql"
-
-:: Define PostgreSQL versions and their corresponding download URLs
-set "PG12_URL=%BASE_URL%/postgresql-12.20-1-windows-x64.exe"
-set "PG13_URL=%BASE_URL%/postgresql-13.16-1-windows-x64.exe"
-set "PG14_URL=%BASE_URL%/postgresql-14.13-1-windows-x64.exe"
-set "PG15_URL=%BASE_URL%/postgresql-15.8-1-windows-x64.exe"
-set "PG16_URL=%BASE_URL%/postgresql-16.4-1-windows-x64.exe"
-set "PG17_URL=%BASE_URL%/postgresql-17.0-1-windows-x64.exe"
-set "PG18_URL=%BASE_URL%/postgresql-18.0-1-windows-x64.exe"
-
-:: PostgreSQL versions
-set "pg_versions=12 13 14 15 16 17 18"
-
-:: Download and install each PostgreSQL version
-for %%v in (%pg_versions%) do (
- echo Processing PostgreSQL %%v...
- set "filename=postgresql-%%v-windows-x64.exe"
- set "install_dir=%POSTGRES_DIR%\postgresql-%%v"
-
- :: Check if already installed
- if exist "!install_dir!" (
- echo PostgreSQL %%v already installed, skipping...
- ) else (
- :: Download if not exists
- if not exist "!filename!" (
- echo Downloading PostgreSQL %%v...
- powershell -Command "& {$ProgressPreference = 'SilentlyContinue'; [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $uri = '!PG%%v_URL!'; $file = '!filename!'; $client = New-Object System.Net.WebClient; $client.Headers.Add('User-Agent', 'Mozilla/5.0'); $client.add_DownloadProgressChanged({param($s,$e) $pct = $e.ProgressPercentage; $recv = [math]::Round($e.BytesReceived/1MB,1); $total = [math]::Round($e.TotalBytesToReceive/1MB,1); Write-Host ('{0}%% - {1} MB / {2} MB' -f $pct, $recv, $total) -NoNewline; Write-Host ('`r') -NoNewline}); try {Write-Host 'Starting download...'; $client.DownloadFile($uri, $file); Write-Host ''; Write-Host 'Download completed!'} finally {$client.Dispose()}}"
-
- if !errorlevel! neq 0 (
- echo Failed to download PostgreSQL %%v
- goto :next_pg_version
- )
- echo PostgreSQL %%v downloaded successfully
- ) else (
- echo PostgreSQL %%v already downloaded
- )
-
- :: Install PostgreSQL client tools only
- echo Installing PostgreSQL %%v client tools to !install_dir!...
- echo This may take up to 10 minutes even on powerful machines, please wait...
-
- :: First try: Install with component selection
- start /wait "" "!filename!" --mode unattended --unattendedmodeui none --prefix "!install_dir!" --disable-components server,pgAdmin,stackbuilder --enable-components commandlinetools
-
- :: Check if installation actually worked by looking for pg_dump.exe
- if exist "!install_dir!\bin\pg_dump.exe" (
- echo PostgreSQL %%v client tools installed successfully
- ) else (
- echo Component selection failed, trying full installation...
- echo This may take up to 10 minutes even on powerful machines, please wait...
- :: Fallback: Install everything but without starting services
- start /wait "" "!filename!" --mode unattended --unattendedmodeui none --prefix "!install_dir!" --datadir "!install_dir!\data" --servicename "postgresql-%%v" --serviceaccount "NetworkService" --superpassword "postgres" --serverport 543%%v --extract-only 1
-
- :: Check again
- if exist "!install_dir!\bin\pg_dump.exe" (
- echo PostgreSQL %%v installed successfully
- ) else (
- echo Failed to install PostgreSQL %%v - No files found in installation directory
- echo Checking what was created:
- if exist "!install_dir!" (
- powershell -Command "Get-ChildItem '!install_dir!' -Recurse | Select-Object -First 10 | ForEach-Object { $_.FullName }"
- ) else (
- echo Installation directory was not created
- )
- )
- )
- )
-
- :next_pg_version
- echo.
-)
-
-:: ========== MySQL Installation ==========
-echo ========================================
-echo Installing MySQL client tools (versions 5.7, 8.0, 8.4, 9)...
-echo ========================================
-echo.
-
-:: MySQL download URLs for Windows x64 (ZIP archives) - using CDN
-:: Note: 5.7 is in Downloads, 8.0, 8.4 specific versions are in archives, 9.5 is in MySQL-9.5
-set "MYSQL57_URL=https://cdn.mysql.com/Downloads/MySQL-5.7/mysql-5.7.44-winx64.zip"
-set "MYSQL80_URL=https://cdn.mysql.com/archives/mysql-8.0/mysql-8.0.40-winx64.zip"
-set "MYSQL84_URL=https://cdn.mysql.com/archives/mysql-8.4/mysql-8.4.3-winx64.zip"
-set "MYSQL9_URL=https://dev.mysql.com/get/Downloads/MySQL-9.5/mysql-9.5.0-winx64.zip"
-
-:: MySQL versions
-set "mysql_versions=5.7 8.0 8.4 9"
-
-:: Download and install each MySQL version
-for %%v in (%mysql_versions%) do (
- echo Processing MySQL %%v...
- set "version_underscore=%%v"
- set "version_underscore=!version_underscore:.=!"
- set "filename=mysql-%%v-winx64.zip"
- set "install_dir=%MYSQL_DIR%\mysql-%%v"
-
- :: Build the URL variable name and get its value
- call set "current_url=%%MYSQL!version_underscore!_URL%%"
-
- :: Check if already installed
- if exist "!install_dir!\bin\mysqldump.exe" (
- echo MySQL %%v already installed, skipping...
- ) else (
- :: Download if not exists
- if not exist "!filename!" (
- echo Downloading MySQL %%v...
- echo Downloading from: !current_url!
- curl -L -o "!filename!" -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36" "!current_url!"
- if !errorlevel! neq 0 (
- echo ERROR: Download request failed
- goto :next_mysql_version
- )
- if not exist "!filename!" (
- echo ERROR: Download failed - file not created
- goto :next_mysql_version
- )
- for %%s in ("!filename!") do if %%~zs LSS 1000000 (
- echo ERROR: Download failed - file too small, likely error page
- del "!filename!" 2>nul
- goto :next_mysql_version
- )
- echo MySQL %%v downloaded successfully
- ) else (
- echo MySQL %%v already downloaded
- )
-
- :: Verify file exists before extraction
- if not exist "!filename!" (
- echo Download file not found, skipping extraction...
- goto :next_mysql_version
- )
-
- :: Extract MySQL
- echo Extracting MySQL %%v...
- mkdir "!install_dir!" 2>nul
-
- powershell -Command "Expand-Archive -Path '!filename!' -DestinationPath '!install_dir!_temp' -Force"
-
- :: Move files from nested directory to install_dir
- for /d %%d in ("!install_dir!_temp\mysql-*") do (
- if exist "%%d\bin\mysqldump.exe" (
- mkdir "!install_dir!\bin" 2>nul
- copy "%%d\bin\mysql.exe" "!install_dir!\bin\" >nul 2>&1
- copy "%%d\bin\mysqldump.exe" "!install_dir!\bin\" >nul 2>&1
- )
- )
-
- :: Cleanup temp directory
- rmdir /s /q "!install_dir!_temp" 2>nul
-
- :: Verify installation
- if exist "!install_dir!\bin\mysqldump.exe" (
- echo MySQL %%v client tools installed successfully
- ) else (
- echo Failed to install MySQL %%v - mysqldump.exe not found
- )
- )
-
- :next_mysql_version
- echo.
-)
-
-:: ========== MariaDB Installation ==========
-echo ========================================
-echo Installing MariaDB client tools (versions 10.6 and 12.1)...
-echo ========================================
-echo.
-
-:: MariaDB uses two client versions:
-:: - 10.6 (legacy): For older servers (5.5, 10.1) that don't have generation_expression column
-:: - 12.1 (modern): For newer servers (10.2+)
-
-:: MariaDB download URLs
-set "MARIADB106_URL=https://archive.mariadb.org/mariadb-10.6.21/winx64-packages/mariadb-10.6.21-winx64.zip"
-set "MARIADB121_URL=https://archive.mariadb.org/mariadb-12.1.2/winx64-packages/mariadb-12.1.2-winx64.zip"
-
-:: MariaDB versions to install
-set "mariadb_versions=10.6 12.1"
-
-:: Download and install each MariaDB version
-for %%v in (%mariadb_versions%) do (
- echo Processing MariaDB %%v...
- set "version_underscore=%%v"
- set "version_underscore=!version_underscore:.=!"
- set "mariadb_install_dir=%MARIADB_DIR%\mariadb-%%v"
-
- :: Build the URL variable name and get its value
- call set "current_url=%%MARIADB!version_underscore!_URL%%"
-
- :: Check if already installed
- if exist "!mariadb_install_dir!\bin\mariadb-dump.exe" (
- echo MariaDB %%v already installed, skipping...
- ) else (
- :: Extract version number from URL for filename
- for %%u in ("!current_url!") do set "mariadb_filename=%%~nxu"
-
- if not exist "!mariadb_filename!" (
- echo Downloading MariaDB %%v...
- echo Downloading from: !current_url!
- curl -L -o "!mariadb_filename!" -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36" "!current_url!"
- if !errorlevel! neq 0 (
- echo ERROR: Download request failed
- goto :next_mariadb_version
- )
- if not exist "!mariadb_filename!" (
- echo ERROR: Download failed - file not created
- goto :next_mariadb_version
- )
- for %%s in ("!mariadb_filename!") do if %%~zs LSS 1000000 (
- echo ERROR: Download failed - file too small, likely error page
- del "!mariadb_filename!" 2>nul
- goto :next_mariadb_version
- )
- echo MariaDB %%v downloaded successfully
- ) else (
- echo MariaDB %%v already downloaded
- )
-
- :: Verify file exists before extraction
- if not exist "!mariadb_filename!" (
- echo Download file not found, skipping extraction...
- goto :next_mariadb_version
- )
-
- :: Extract MariaDB
- echo Extracting MariaDB %%v...
- mkdir "!mariadb_install_dir!" 2>nul
- mkdir "!mariadb_install_dir!\bin" 2>nul
-
- powershell -Command "Expand-Archive -Path '!mariadb_filename!' -DestinationPath '!mariadb_install_dir!_temp' -Force"
-
- :: Move files from nested directory to install_dir
- for /d %%d in ("!mariadb_install_dir!_temp\mariadb-*") do (
- if exist "%%d\bin\mariadb-dump.exe" (
- copy "%%d\bin\mariadb.exe" "!mariadb_install_dir!\bin\" >nul 2>&1
- copy "%%d\bin\mariadb-dump.exe" "!mariadb_install_dir!\bin\" >nul 2>&1
- )
- )
-
- :: Cleanup temp directory
- rmdir /s /q "!mariadb_install_dir!_temp" 2>nul
-
- :: Verify installation
- if exist "!mariadb_install_dir!\bin\mariadb-dump.exe" (
- echo MariaDB %%v client tools installed successfully
- ) else (
- echo Failed to install MariaDB %%v - mariadb-dump.exe not found
- )
- )
-
- :next_mariadb_version
- echo.
-)
-
-:skip_mariadb
-echo.
-
-:: ========== MongoDB Installation ==========
-echo ========================================
-echo Installing MongoDB Database Tools...
-echo ========================================
-echo.
-
-:: MongoDB Database Tools are backward compatible - single version supports all servers (4.0-8.0)
-set "MONGODB_TOOLS_URL=https://fastdl.mongodb.org/tools/db/mongodb-database-tools-windows-x86_64-100.10.0.zip"
-
-set "mongodb_install_dir=%MONGODB_DIR%"
-
-:: Check if already installed
-if exist "!mongodb_install_dir!\bin\mongodump.exe" (
- echo MongoDB Database Tools already installed, skipping...
-) else (
- set "mongodb_filename=mongodb-database-tools.zip"
-
- if not exist "!mongodb_filename!" (
- echo Downloading MongoDB Database Tools...
- curl -L -o "!mongodb_filename!" -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36" "!MONGODB_TOOLS_URL!"
- if !errorlevel! neq 0 (
- echo ERROR: Download request failed
- goto :skip_mongodb
- )
- if not exist "!mongodb_filename!" (
- echo ERROR: Download failed - file not created
- goto :skip_mongodb
- )
- for %%s in ("!mongodb_filename!") do if %%~zs LSS 1000000 (
- echo ERROR: Download failed - file too small, likely error page
- del "!mongodb_filename!" 2>nul
- goto :skip_mongodb
- )
- echo MongoDB Database Tools downloaded successfully
- ) else (
- echo MongoDB Database Tools already downloaded
- )
-
- :: Extract MongoDB Database Tools
- echo Extracting MongoDB Database Tools...
- mkdir "!mongodb_install_dir!" 2>nul
- mkdir "!mongodb_install_dir!\bin" 2>nul
-
- powershell -Command "Expand-Archive -Path '!mongodb_filename!' -DestinationPath '!mongodb_install_dir!_temp' -Force"
-
- :: Move files from nested directory to install_dir
- for /d %%d in ("!mongodb_install_dir!_temp\mongodb-database-tools-*") do (
- if exist "%%d\bin\mongodump.exe" (
- copy "%%d\bin\mongodump.exe" "!mongodb_install_dir!\bin\" >nul 2>&1
- copy "%%d\bin\mongorestore.exe" "!mongodb_install_dir!\bin\" >nul 2>&1
- )
- )
-
- :: Cleanup temp directory
- rmdir /s /q "!mongodb_install_dir!_temp" 2>nul
-
- :: Verify installation
- if exist "!mongodb_install_dir!\bin\mongodump.exe" (
- echo MongoDB Database Tools installed successfully
- ) else (
- echo Failed to install MongoDB Database Tools - mongodump.exe not found
- )
-)
-
-:skip_mongodb
-echo.
-
-cd ..
-
-echo.
-echo ========================================
-echo Installation process completed!
-echo ========================================
-echo.
-echo PostgreSQL versions are installed in: %POSTGRES_DIR%
-echo MySQL versions are installed in: %MYSQL_DIR%
-echo MariaDB is installed in: %MARIADB_DIR%
-echo MongoDB Database Tools are installed in: %MONGODB_DIR%
-echo.
-
-:: List installed PostgreSQL versions
-echo Installed PostgreSQL client versions:
-for %%v in (%pg_versions%) do (
- set "version_dir=%POSTGRES_DIR%\postgresql-%%v"
- if exist "!version_dir!\bin\pg_dump.exe" (
- echo postgresql-%%v: !version_dir!\bin\
- )
-)
-
-echo.
-echo Installed MySQL client versions:
-for %%v in (%mysql_versions%) do (
- set "version_dir=%MYSQL_DIR%\mysql-%%v"
- if exist "!version_dir!\bin\mysqldump.exe" (
- echo mysql-%%v: !version_dir!\bin\
- )
-)
-
-echo.
-echo Installed MariaDB client versions:
-for %%v in (%mariadb_versions%) do (
- set "version_dir=%MARIADB_DIR%\mariadb-%%v"
- if exist "!version_dir!\bin\mariadb-dump.exe" (
- echo mariadb-%%v: !version_dir!\bin\
- )
-)
-
-echo.
-echo Installed MongoDB Database Tools:
-if exist "%MONGODB_DIR%\bin\mongodump.exe" (
- echo mongodb: %MONGODB_DIR%\bin\
-)
-
-echo.
-echo Usage examples:
-echo %POSTGRES_DIR%\postgresql-15\bin\pg_dump.exe --version
-echo %MYSQL_DIR%\mysql-8.0\bin\mysqldump.exe --version
-echo %MARIADB_DIR%\mariadb-12.1\bin\mariadb-dump.exe --version
-echo %MONGODB_DIR%\bin\mongodump.exe --version
-echo.
-
-pause
diff --git a/backend/tools/readme.md b/backend/tools/readme.md
deleted file mode 100644
index 55727a59..00000000
--- a/backend/tools/readme.md
+++ /dev/null
@@ -1,262 +0,0 @@
-This directory is needed only for development and CI\CD.
-
-We have to download and install all the PostgreSQL versions from 12 to 18, MySQL versions 5.7, 8.0, 8.4, 9, MariaDB client tools and MongoDB Database Tools locally.
-This is needed so we can call pg_dump, pg_restore, mysqldump, mysql, mariadb-dump, mariadb, mongodump, mongorestore, etc. on each version of the database.
-
-You do not need to install the databases fully with all the components.
-We only need the client tools for each version.
-
-## Required Versions
-
-### PostgreSQL
-
-- PostgreSQL 12
-- PostgreSQL 13
-- PostgreSQL 14
-- PostgreSQL 15
-- PostgreSQL 16
-- PostgreSQL 17
-- PostgreSQL 18
-
-### MySQL
-
-- MySQL 5.7
-- MySQL 8.0
-- MySQL 8.4
-- MySQL 9
-
-### MariaDB
-
-MariaDB uses two client versions to support all server versions:
-
-- MariaDB 10.6 (legacy client - for older servers 5.5 and 10.1)
-- MariaDB 12.1 (modern client - for servers 10.2+)
-
-The reason for two versions is that MariaDB 12.1 client uses SQL queries that reference the `generation_expression` column in `information_schema.columns`, which was only added in MariaDB 10.2. Older servers (5.5, 10.1) don't have this column and fail with newer clients.
-
-### MongoDB
-
-MongoDB Database Tools are backward compatible - a single version supports all server versions:
-
-- MongoDB Database Tools 100.10.0 (supports MongoDB servers 4.0-8.0)
-
-The MongoDB Database Tools (`mongodump`, `mongorestore`) are designed to be backward compatible with all MongoDB server versions, so only one client version is needed.
-
-## Installation
-
-Run the appropriate download script for your platform:
-
-### Windows
-
-```cmd
-download_windows.bat
-```
-
-### Linux (Debian/Ubuntu)
-
-```bash
-chmod +x download_linux.sh
-./download_linux.sh
-```
-
-### MacOS
-
-```bash
-chmod +x download_macos.sh
-./download_macos.sh
-```
-
-## Platform-Specific Notes
-
-### Windows
-
-- Downloads official PostgreSQL installers from EnterpriseDB
-- Downloads official MySQL ZIP archives from dev.mysql.com
-- Installs client tools only (no server components)
-- May require administrator privileges during PostgreSQL installation
-
-### Linux (Debian/Ubuntu)
-
-- Uses the official PostgreSQL APT repository
-- Downloads MySQL client tools from official archives
-- Installs MariaDB client from official MariaDB repository
-- Requires sudo privileges to install packages
-- Creates symlinks in version-specific directories for consistency
-
-### MacOS
-
-- Requires Homebrew to be installed
-- Compiles PostgreSQL from source (client tools only)
-- Downloads pre-built MySQL binaries from dev.mysql.com
-- Downloads pre-built MariaDB binaries or installs via Homebrew
-- Takes longer than other platforms due to PostgreSQL compilation
-- Supports both Intel (x86_64) and Apple Silicon (arm64)
-
-## Manual Installation
-
-If something goes wrong with the automated scripts, install manually.
-The final directory structure should match:
-
-### PostgreSQL
-
-```
-./tools/postgresql/postgresql-{version}/bin/pg_dump
-./tools/postgresql/postgresql-{version}/bin/pg_dumpall
-./tools/postgresql/postgresql-{version}/bin/psql
-./tools/postgresql/postgresql-{version}/bin/pg_restore
-```
-
-For example:
-
-- `./tools/postgresql/postgresql-12/bin/pg_dump`
-- `./tools/postgresql/postgresql-13/bin/pg_dump`
-- `./tools/postgresql/postgresql-14/bin/pg_dump`
-- `./tools/postgresql/postgresql-15/bin/pg_dump`
-- `./tools/postgresql/postgresql-16/bin/pg_dump`
-- `./tools/postgresql/postgresql-17/bin/pg_dump`
-- `./tools/postgresql/postgresql-18/bin/pg_dump`
-
-### MySQL
-
-```
-./tools/mysql/mysql-{version}/bin/mysqldump
-./tools/mysql/mysql-{version}/bin/mysql
-```
-
-For example:
-
-- `./tools/mysql/mysql-5.7/bin/mysqldump`
-- `./tools/mysql/mysql-8.0/bin/mysqldump`
-- `./tools/mysql/mysql-8.4/bin/mysqldump`
-- `./tools/mysql/mysql-9/bin/mysqldump`
-
-### MariaDB
-
-MariaDB uses two client versions to handle compatibility with all server versions:
-
-```
-./tools/mariadb/mariadb-{client-version}/bin/mariadb-dump
-./tools/mariadb/mariadb-{client-version}/bin/mariadb
-```
-
-For example:
-
-- `./tools/mariadb/mariadb-10.6/bin/mariadb-dump` (legacy - for servers 5.5, 10.1)
-- `./tools/mariadb/mariadb-12.1/bin/mariadb-dump` (modern - for servers 10.2+)
-
-### MongoDB
-
-MongoDB Database Tools use a single version that supports all server versions:
-
-```
-./tools/mongodb/bin/mongodump
-./tools/mongodb/bin/mongorestore
-```
-
-## Usage
-
-After installation, you can use version-specific tools:
-
-```bash
-# Windows - PostgreSQL
-./postgresql/postgresql-15/bin/pg_dump.exe --version
-
-# Windows - MySQL
-./mysql/mysql-8.0/bin/mysqldump.exe --version
-
-# Windows - MariaDB
-./mariadb/mariadb-12.1/bin/mariadb-dump.exe --version
-
-# Windows - MongoDB
-./mongodb/bin/mongodump.exe --version
-
-# Linux/MacOS - PostgreSQL
-./postgresql/postgresql-15/bin/pg_dump --version
-
-# Linux/MacOS - MySQL
-./mysql/mysql-8.0/bin/mysqldump --version
-
-# Linux/MacOS - MariaDB
-./mariadb/mariadb-12.1/bin/mariadb-dump --version
-
-# Linux/MacOS - MongoDB
-./mongodb/bin/mongodump --version
-```
-
-## Environment Variables
-
-The application expects these environment variables to be set (or uses defaults):
-
-```env
-# PostgreSQL tools directory (default: ./tools/postgresql)
-POSTGRES_INSTALL_DIR=C:\path\to\tools\postgresql
-
-# MySQL tools directory (default: ./tools/mysql)
-MYSQL_INSTALL_DIR=C:\path\to\tools\mysql
-
-# MariaDB tools directory (default: ./tools/mariadb)
-# Contains subdirectories: mariadb-10.6 and mariadb-12.1
-MARIADB_INSTALL_DIR=C:\path\to\tools\mariadb
-
-# MongoDB tools directory (default: ./tools/mongodb)
-# Contains bin subdirectory with mongodump and mongorestore
-MONGODB_INSTALL_DIR=C:\path\to\tools\mongodb
-```
-
-## Troubleshooting
-
-### MySQL 5.7 on Apple Silicon (M1/M2/M3)
-
-MySQL 5.7 does not have native ARM64 binaries for macOS. The script will attempt to download the x86_64 version, which may work under Rosetta 2. If you encounter issues:
-
-1. Ensure Rosetta 2 is installed: `softwareupdate --install-rosetta`
-2. Or skip MySQL 5.7 if you don't need to support that version
-
-### Permission Errors on Linux
-
-If you encounter permission errors, ensure you have sudo privileges:
-
-```bash
-sudo ./download_linux.sh
-```
-
-### Download Failures
-
-If downloads fail, you can manually download the files:
-
-- PostgreSQL: https://www.postgresql.org/ftp/source/
-- MySQL: https://dev.mysql.com/downloads/mysql/
-- MariaDB: https://mariadb.org/download/ or https://archive.mariadb.org/
-- MongoDB Database Tools: https://www.mongodb.com/try/download/database-tools
-
-### MariaDB Client Compatibility
-
-MariaDB client tools require different versions depending on the server:
-
-**Legacy client (10.6)** - Required for:
-
-- MariaDB 5.5
-- MariaDB 10.1
-
-**Modern client (12.1)** - Works with:
-
-- MariaDB 10.2 - 10.6
-- MariaDB 10.11
-- MariaDB 11.4, 11.8
-- MariaDB 12.0
-
-The reason is that MariaDB 12.1 client uses SQL queries referencing the `generation_expression` column in `information_schema.columns`, which was added in MariaDB 10.2. The application automatically selects the appropriate client version based on the target server version.
-
-### MongoDB Database Tools Compatibility
-
-MongoDB Database Tools are backward compatible - a single version supports all server versions:
-
-**Supported MongoDB server versions:**
-
-- MongoDB 4.0, 4.2, 4.4 (EOL but still supported)
-- MongoDB 5.0
-- MongoDB 6.0
-- MongoDB 7.0 (LTS)
-- MongoDB 8.0 (Current)
-
-The application uses MongoDB Database Tools version 100.10.0, which supports all the above server versions.