From 54bd0fdf604dc633e0bc5693d45185a3a9cb1470 Mon Sep 17 00:00:00 2001 From: Jose Garcia <47431411+ruxwez@users.noreply.github.com> Date: Fri, 24 Oct 2025 15:12:10 +0200 Subject: [PATCH 1/6] Enhance PostgreSQL extensions installer with testing capabilities and version detection - Updated GitHub Actions workflow to include testing step. - Added support for detecting PostgreSQL version from the base image. - Introduced CLI arguments for test mode and PostgreSQL version. - Enhanced Dockerfile to conditionally run tests based on TEST_MODE. - Updated README files with new status badges and improved instructions. - Added configuration management for tests. --- .github/workflows/pr-test.yml | 6 +- Cargo.lock | 127 ++++++++++++++++++++++++++++++++++ Cargo.toml | 1 + Dockerfile | 8 ++- README.es.md | 8 +-- README.md | 8 +-- makefile | 6 +- src/common.rs | 18 +++++ src/core.rs | 56 +++++++++++++++ src/main.rs | 80 ++++----------------- src/structs.rs | 13 ++++ src/tests/config.rs | 24 +++++++ src/tests/mod.rs | 9 +++ 13 files changed, 283 insertions(+), 81 deletions(-) create mode 100644 src/core.rs create mode 100644 src/tests/config.rs create mode 100644 src/tests/mod.rs diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index cf0d11a..18f9d21 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -14,7 +14,7 @@ concurrency: jobs: build: - name: Build (no push) β€” PostgreSQL ${{ matrix.postgres_version }} / ${{ matrix.platform }} + name: Test β€” PostgreSQL ${{ matrix.postgres_version }} / ${{ matrix.platform }} runs-on: ubuntu-latest strategy: matrix: @@ -45,8 +45,12 @@ jobs: pr-test/${{ github.repository }}:postgres-${{ matrix.postgres_version }}-pr${{ github.event.pull_request.number }} build-args: | POSTGRES_VERSION=${{ matrix.postgres_version }} + TEST_MODE=true cache-from: type=gha cache-to: type=gha,mode=max + - name: Execute test inside the built image + run: | + docker run --rm pr-test/${{ github.repository }}:postgres-${{ matrix.postgres_version }}-pr${{ github.event.pull_request.number }} pg_config - name: Output build metadata run: | diff --git a/Cargo.lock b/Cargo.lock index 73c09d2..ee440ca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,56 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2" +dependencies = [ + "windows-sys 0.60.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.60.2", +] + [[package]] name = "bitflags" version = "2.10.0" @@ -20,13 +70,72 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" +[[package]] +name = "clap" +version = "4.5.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c2cfd7bf8a6017ddaa4e32ffe7403d547790db06bd171c1c53926faab501623" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a4c05b9e80c5ccd3a7ef080ad7b6ba7d6fc00a985b8b157197075677c82c7a0" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.49" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" + +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "install-extensions" version = "0.1.0" dependencies = [ + "clap", "tokio", ] +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + [[package]] name = "libc" version = "0.2.177" @@ -53,6 +162,12 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + [[package]] name = "parking_lot" version = "0.12.5" @@ -140,6 +255,12 @@ dependencies = [ "windows-sys 0.60.2", ] +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + [[package]] name = "syn" version = "2.0.108" @@ -185,6 +306,12 @@ version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "462eeb75aeb73aea900253ce739c8e18a67423fadf006037cd3ff27e82748a06" +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "wasi" version = "0.11.1+wasi-snapshot-preview1" diff --git a/Cargo.toml b/Cargo.toml index 719ffa9..6b344ca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,4 +5,5 @@ version = "0.1.0" edition = "2024" [dependencies] +clap = { version = "4.5.50", features = ["derive"] } tokio = { version = "1.48.0", features = ["full"] } diff --git a/Dockerfile b/Dockerfile index 1ec55fd..595445a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ ARG POSTGRES_VERSION=latest +ARG TEST_MODE=false # Builder stage: compile the Rust binary FROM rust:slim AS builder @@ -12,12 +13,15 @@ RUN cargo build --release # Final stage: only Postgres FROM postgres:${POSTGRES_VERSION} ARG POSTGRES_VERSION +ARG TEST_MODE # Copy the compiled binary COPY --from=builder /installer/target/release/install-extensions /usr/local/bin/installer # Run installer (all logic including cleanup is inside the binary) -RUN /usr/local/bin/installer ${POSTGRES_VERSION} && \ - rm /usr/local/bin/installer +RUN /usr/local/bin/installer --pg-version ${POSTGRES_VERSION} + +# If TEST_MODE is true, run tests +RUN if [ "${TEST_MODE}" = "false" ]; then rm /usr/local/bin/installer; fi EXPOSE 5432 diff --git a/README.es.md b/README.es.md index 8b2ecb5..ada12ff 100644 --- a/README.es.md +++ b/README.es.md @@ -1,9 +1,9 @@ # Instalador de extensiones para PostgreSQL (imagen Docker derivada) -![Docker Pulls](https://img.shields.io/docker/pulls/ruxwez/postgres?style=flat-square) -![GitHub branch check runs](https://img.shields.io/github/check-runs/ruxwez/postgres/main?cacheSeconds=60) +[![Docker Pulls](https://img.shields.io/docker/pulls/ruxwez/postgres?style=flat-square)](https://hub.docker.com/r/ruxwez/postgres) +[![GitHub branch check runs](https://img.shields.io/github/check-runs/ruxwez/postgres/main?style=flat-square&label=build)](https://github.com/ruxwez/postgres/actions) ![GitHub contributors](https://img.shields.io/github/contributors/ruxwez/postgres?style=flat-square) -![GitHub License](https://img.shields.io/github/license/ruxwez/postgres?style=flat-square) -![GitHub Issues or Pull Requests](https://img.shields.io/github/issues/ruxwez/postgres?style=flat-square) +[![GitHub License](https://img.shields.io/github/license/ruxwez/postgres?style=flat-square)](https://github.com/ruxwez/postgres/blob/main/LICENSE) +[![GitHub Issues or Pull Requests](https://img.shields.io/github/issues/ruxwez/postgres?style=flat-square)](https://github.com/ruxwez/postgres/issues) ## PropΓ³sito diff --git a/README.md b/README.md index c617305..c81d80d 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # PostgreSQL Extensions Installer (derived Docker image) -![Docker Pulls](https://img.shields.io/docker/pulls/ruxwez/postgres?style=flat-square) -![GitHub branch check runs](https://img.shields.io/github/check-runs/ruxwez/postgres/main?cacheSeconds=60) +[![Docker Pulls](https://img.shields.io/docker/pulls/ruxwez/postgres?style=flat-square)](https://hub.docker.com/r/ruxwez/postgres) +[![GitHub branch check runs](https://img.shields.io/github/check-runs/ruxwez/postgres/main?style=flat-square&label=build)](https://github.com/ruxwez/postgres/actions) ![GitHub contributors](https://img.shields.io/github/contributors/ruxwez/postgres?style=flat-square) -![GitHub License](https://img.shields.io/github/license/ruxwez/postgres?style=flat-square) -![GitHub Issues or Pull Requests](https://img.shields.io/github/issues/ruxwez/postgres?style=flat-square) +[![GitHub License](https://img.shields.io/github/license/ruxwez/postgres?style=flat-square)](https://github.com/ruxwez/postgres/blob/main/LICENSE) +[![GitHub Issues or Pull Requests](https://img.shields.io/github/issues/ruxwez/postgres?style=flat-square)](https://github.com/ruxwez/postgres/issues) ## Purpose diff --git a/makefile b/makefile index f46762e..1a587d5 100644 --- a/makefile +++ b/makefile @@ -1,7 +1,7 @@ - test: - docker build -t ruxwez/postgres . --no-cache - docker rmi ruxwez/postgres + docker build -t postgres-testmode --build-arg TEST_MODE=true . + docker run -e POSTGRES_PASSWORD=testmode postgres-testmode /usr/local/bin/installer --test-mode + docker rmi postgres-testmode build: docker build -t ruxwez/postgres . diff --git a/src/common.rs b/src/common.rs index 02dd5b4..0a685cf 100644 --- a/src/common.rs +++ b/src/common.rs @@ -28,3 +28,21 @@ pub fn run_output(cmd: &str) -> String { String::from_utf8_lossy(&output.stdout).trim().to_string() } + +pub fn get_current_postgres_version() -> String { + + println!("πŸ”Ž Detecting PostgreSQL version from the base image (requested: latest)..."); + // Try `postgres --version`. This requires that the base image already provides the postgres binary. + let ver_output = run_output("postgres --version"); + // Typical output: "postgres (PostgreSQL) 15.3" + // We take the last whitespace-separated token as the numeric version. + let numeric_version = ver_output + .split_whitespace() + .last() + .expect("Failed to parse postgres --version output") + .to_string(); + + println!("ℹ️ Detected PostgreSQL version: {}", numeric_version); + + numeric_version +} diff --git a/src/core.rs b/src/core.rs new file mode 100644 index 0000000..253e17d --- /dev/null +++ b/src/core.rs @@ -0,0 +1,56 @@ +use std::sync::Arc; + +use crate::{common::run, extensions}; + +pub async fn installer(pg_version: String) { + if !cfg!(unix) { + panic!("❌ The installer only supports Unix-like operating systems."); + } + + let pg_version = Arc::new(pg_version); + + let pg_major = pg_version.split(".").next().unwrap(); + + println!( + "πŸš€ Installing PostgreSQL extensions for version {}", + pg_version + ); + + // Install necessary packages + println!("πŸ“¦ Installing build dependencies..."); + run(&format!( + "apt-get update && apt-get install -y --no-install-recommends \ + postgresql-contrib \ + git \ + build-essential \ + postgresql-server-dev-{} \ + ca-certificates", + pg_major + )); + + // Install extensions + println!("πŸ”§ Installing extensions in parallel..."); + extensions::install(pg_version.clone()).await; + + // Clean up build packages to reduce image size + println!("🧹 Cleaning up to reduce image size..."); + run(&format!( + "apt-get purge -y --auto-remove \ + git \ + build-essential \ + postgresql-server-dev-{} \ + && apt-get autoremove -y \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* \ + && rm -rf /tmp/* \ + && rm -rf /var/tmp/* \ + && rm -rf /root/.cache \ + && rm -rf /var/cache/apt/* \ + && rm -rf /usr/share/doc/* \ + && rm -rf /usr/share/man/* \ + && find /var/log -type f -delete", + pg_major + )); + + println!("βœ… Installation completed successfully!"); +} diff --git a/src/main.rs b/src/main.rs index 69dfe0a..4c3e0d3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,83 +1,29 @@ -use std::{env, sync::Arc}; - -use crate::common::{run, run_output}; +use clap::Parser; mod common; +mod core; mod extensions; mod structs; +mod tests; #[tokio::main] async fn main() { - // Collect command-line arguments - let args: Vec = env::args().collect(); + let cli = structs::CLI::parse(); - if args.len() != 2 { - panic!("Insert PostgreSQL version as argument"); + if cli.test_mode { + return tests::run().await; } // If user passed "latest", detect the numeric version from the installed postgres binary. // Otherwise use the provided version string (e.g. "15.3" or "15"). - let mut pg_version = args[1].clone(); - if pg_version.eq_ignore_ascii_case("latest") { - println!("πŸ”Ž Detecting PostgreSQL version from the base image (requested: latest)..."); - // Try `postgres --version`. This requires that the base image already provides the postgres binary. - let ver_output = run_output("postgres --version"); - // Typical output: "postgres (PostgreSQL) 15.3" - // We take the last whitespace-separated token as the numeric version. - let numeric_version = ver_output - .split_whitespace() - .last() - .expect("Failed to parse postgres --version output") - .to_string(); - - println!("ℹ️ Detected PostgreSQL version: {}", numeric_version); - pg_version = numeric_version; + let mut pg_version = cli.pg_version; + if pg_version == "ignore" { + panic!("Error: --pg-version is required."); } - let pg_version = Arc::new(pg_version); - - let pg_major = pg_version.split(".").next().unwrap(); - - println!( - "πŸš€ Installing PostgreSQL extensions for version {}", - pg_version - ); - - // Install necessary packages - println!("πŸ“¦ Installing build dependencies..."); - run(&format!( - "apt-get update && apt-get install -y --no-install-recommends \ - postgresql-contrib \ - git \ - build-essential \ - postgresql-server-dev-{} \ - ca-certificates", - pg_major - )); - - // Install extensions - println!("πŸ”§ Installing extensions in parallel..."); - extensions::install(pg_version.clone()).await; - - // Clean up build packages to reduce image size - println!("🧹 Cleaning up to reduce image size..."); - run(&format!( - "apt-get purge -y --auto-remove \ - git \ - build-essential \ - postgresql-server-dev-{} \ - && apt-get autoremove -y \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* \ - && rm -rf /tmp/* \ - && rm -rf /var/tmp/* \ - && rm -rf /root/.cache \ - && rm -rf /var/cache/apt/* \ - && rm -rf /usr/share/doc/* \ - && rm -rf /usr/share/man/* \ - && find /var/log -type f -delete", - pg_major - )); + if pg_version.eq_ignore_ascii_case("latest") { + pg_version = common::get_current_postgres_version() + } - println!("βœ… Installation completed successfully!"); + core::installer(pg_version).await; } diff --git a/src/structs.rs b/src/structs.rs index 9cf5a19..a652456 100644 --- a/src/structs.rs +++ b/src/structs.rs @@ -1,3 +1,5 @@ +use clap::Parser; + pub struct ExtensionVersionCompatibility<'a> { pub v16: &'a str, pub v17: &'a str, @@ -19,3 +21,14 @@ impl ExtensionVersionCompatibility<'static> { } } } + +#[derive(Parser, Debug)] +pub struct CLI { + // Test mode + #[arg(short, long, default_value_t = false)] + pub test_mode: bool, + + // PG Version + #[arg(long, default_value_t = String::from("ignore"))] + pub pg_version: String, +} diff --git a/src/tests/config.rs b/src/tests/config.rs new file mode 100644 index 0000000..368f387 --- /dev/null +++ b/src/tests/config.rs @@ -0,0 +1,24 @@ +use std::{env, sync::OnceLock}; + +#[derive(Debug)] +pub struct Config { + pub PG_PASSWORD: String, + pub PG_USER: String, + pub PG_DB: String, +} + +static CONFIG: OnceLock = OnceLock::new(); + +pub fn init() { + let config = Config { + PG_PASSWORD: env::var("PG_PASSWORD").expect("Error to get Postgres Password"), + PG_DB: "postgres".to_owned(), + PG_USER: "postgres".to_owned(), + }; + + CONFIG.set(config).expect("Failed to set config"); +} + +pub fn get() -> &'static Config { + CONFIG.get().expect("Config not initialized") +} diff --git a/src/tests/mod.rs b/src/tests/mod.rs new file mode 100644 index 0000000..486853e --- /dev/null +++ b/src/tests/mod.rs @@ -0,0 +1,9 @@ +use std::time::Duration; + +use tokio::time::sleep; + +mod config; + +pub async fn run() { + sleep(Duration::from_secs(100)).await; +} From 9f5d94f9cfea5890124cfb7debd40162149e9bb2 Mon Sep 17 00:00:00 2001 From: Jose Garcia <47431411+ruxwez@users.noreply.github.com> Date: Fri, 24 Oct 2025 22:06:50 +0200 Subject: [PATCH 2/6] feat: Add SQLx dependency and implement PostgreSQL extension tests - Updated Cargo.toml to include sqlx for PostgreSQL support. - Modified makefile to build and run tests in a Docker container with PostgreSQL. - Refactored common.rs to clean up whitespace. - Enhanced extensions module to include a run_tests function for testing extensions. - Implemented run_test functions for pgmq, pgvector, and postgis extensions to verify their installation. - Updated main.rs to initialize the database pool and run extension tests in test mode. - Removed obsolete config and tests modules, replacing them with a new test module for database pool management. --- .github/workflows/pr-test.yml | 54 +- Cargo.lock | 1715 ++++++++++++++++++++++++++++++--- Cargo.toml | 1 + makefile | 7 +- src/common.rs | 1 - src/extensions/mod.rs | 8 + src/extensions/pgmq.rs | 11 +- src/extensions/pgvector.rs | 11 +- src/extensions/postgis.rs | 13 +- src/main.rs | 6 +- src/test.rs | 20 + src/tests/config.rs | 24 - src/tests/mod.rs | 9 - 13 files changed, 1655 insertions(+), 225 deletions(-) create mode 100644 src/test.rs delete mode 100644 src/tests/config.rs delete mode 100644 src/tests/mod.rs diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index 18f9d21..8163ae1 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -1,4 +1,4 @@ -name: PR - Build (amd64, arm64) +name: PR - Build & Test Extensions on: pull_request: @@ -13,12 +13,12 @@ concurrency: cancel-in-progress: true jobs: - build: - name: Test β€” PostgreSQL ${{ matrix.postgres_version }} / ${{ matrix.platform }} + build-and-test: + name: PostgreSQL ${{ matrix.postgres_version }} / ${{ matrix.platform }} runs-on: ubuntu-latest strategy: matrix: - postgres_version: ["latest", "18", "17", "17.6", "16", "16.10"] + postgres_version: ["18", "17", "17.6", "16", "16.10"] platform: ["linux/amd64"] fail-fast: false @@ -26,7 +26,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Set up QEMU (for multi-arch builds) + - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx @@ -34,45 +34,35 @@ jobs: with: install: true - - name: Build image for ${{ matrix.platform }} (no push) + - name: Build test image uses: docker/build-push-action@v5 with: context: . platforms: ${{ matrix.platform }} push: false - load: false - tags: | - pr-test/${{ github.repository }}:postgres-${{ matrix.postgres_version }}-pr${{ github.event.pull_request.number }} + load: true + tags: postgres-test:${{ matrix.postgres_version }} build-args: | POSTGRES_VERSION=${{ matrix.postgres_version }} TEST_MODE=true - cache-from: type=gha - cache-to: type=gha,mode=max - - name: Execute test inside the built image - run: | - docker run --rm pr-test/${{ github.repository }}:postgres-${{ matrix.postgres_version }}-pr${{ github.event.pull_request.number }} pg_config + cache-from: type=gha,scope=postgres-${{ matrix.postgres_version }} + cache-to: type=gha,mode=max,scope=postgres-${{ matrix.postgres_version }} - - name: Output build metadata + - name: Run extension tests + timeout-minutes: 5 run: | - echo "βœ… Build completed successfully" - echo "Built (multi-arch) for POSTGRES_VERSION=${{ matrix.postgres_version }} PLATFORM=${{ matrix.platform }}" - echo "Tag used: pr-test/${{ github.repository }}:postgres-${{ matrix.postgres_version }}-pr${{ github.event.pull_request.number }}" + docker run --rm \ + -e POSTGRES_PASSWORD=testmode \ + postgres-test:${{ matrix.postgres_version }} \ + bash -c "docker-entrypoint.sh postgres & sleep 5 && until pg_isready -U postgres; do sleep 1; done && /usr/local/bin/installer --test-mode" - # Job resumen que agrupa todos los builds de la matriz - build-complete: - name: All builds passed + test-summary: + name: Test Summary runs-on: ubuntu-latest - needs: build + needs: build-and-test if: always() steps: - - name: Check build matrix status - if: needs.build.result != 'success' - run: | - echo "❌ One or more builds failed" - exit 1 - - - name: All builds passed - run: | - echo "βœ… All PostgreSQL versions built successfully" - echo "Ready to merge!" + - name: Check results + if: needs.build-and-test.result != 'success' + run: exit 1 diff --git a/Cargo.lock b/Cargo.lock index ee440ca..c33f4be 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,12 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + [[package]] name = "anstream" version = "0.6.21" @@ -52,11 +58,56 @@ dependencies = [ "windows-sys 0.60.2", ] +[[package]] +name = "atoi" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528" +dependencies = [ + "num-traits", +] + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64ct" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" + [[package]] name = "bitflags" version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" +dependencies = [ + "serde_core", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" @@ -117,292 +168,1654 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" [[package]] -name = "heck" -version = "0.5.0" +name = "concurrent-queue" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] [[package]] -name = "install-extensions" -version = "0.1.0" +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" dependencies = [ - "clap", - "tokio", + "libc", ] [[package]] -name = "is_terminal_polyfill" -version = "1.70.2" +name = "crc" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" +checksum = "9710d3b3739c2e349eb44fe848ad0b7c8cb1e42bd87ee49371df2f7acaf3e675" +dependencies = [ + "crc-catalog", +] [[package]] -name = "libc" -version = "0.2.177" +name = "crc-catalog" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" +checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" [[package]] -name = "lock_api" -version = "0.4.14" +name = "crossbeam-queue" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115" dependencies = [ - "scopeguard", + "crossbeam-utils", ] [[package]] -name = "mio" -version = "1.1.0" +name = "crossbeam-utils" +version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69d83b0086dc8ecf3ce9ae2874b2d1290252e2a30720bea58a5c6639b0092873" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "libc", - "wasi", - "windows-sys 0.61.2", + "generic-array", + "typenum", ] [[package]] -name = "once_cell_polyfill" -version = "1.70.2" +name = "der" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "pem-rfc7468", + "zeroize", +] [[package]] -name = "parking_lot" -version = "0.12.5" +name = "digest" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "lock_api", - "parking_lot_core", + "block-buffer", + "const-oid", + "crypto-common", + "subtle", ] [[package]] -name = "parking_lot_core" -version = "0.9.12" +name = "displaydoc" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-link", + "proc-macro2", + "quote", + "syn", ] [[package]] -name = "pin-project-lite" -version = "0.2.16" +name = "dotenvy" +version = "0.15.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" +checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" [[package]] -name = "proc-macro2" -version = "1.0.102" +name = "either" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e0f6df8eaa422d97d72edcd152e1451618fed47fabbdbd5a8864167b1d4aff7" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" dependencies = [ - "unicode-ident", + "serde", ] [[package]] -name = "quote" -version = "1.0.41" +name = "equivalent" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "etcetera" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943" dependencies = [ - "proc-macro2", + "cfg-if", + "home", + "windows-sys 0.48.0", ] [[package]] -name = "redox_syscall" -version = "0.5.18" +name = "event-listener" +version = "5.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +checksum = "e13b66accf52311f30a0db42147dadea9850cb48cd070028831ae5f5d4b856ab" dependencies = [ - "bitflags", + "concurrent-queue", + "parking", + "pin-project-lite", ] [[package]] -name = "scopeguard" -version = "1.2.0" +name = "flume" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" +dependencies = [ + "futures-core", + "futures-sink", + "spin", +] [[package]] -name = "signal-hook-registry" -version = "1.4.6" +name = "foldhash" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2a4719bff48cee6b39d12c020eeb490953ad2443b7055bd0b21fca26bd8c28b" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" dependencies = [ - "libc", + "percent-encoding", ] [[package]] -name = "smallvec" -version = "1.15.1" +name = "futures-channel" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] [[package]] -name = "socket2" -version = "0.6.1" +name = "futures-core" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ - "libc", - "windows-sys 0.60.2", + "futures-core", + "futures-task", + "futures-util", ] [[package]] -name = "strsim" -version = "0.11.1" +name = "futures-intrusive" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", + "parking_lot", +] [[package]] -name = "syn" -version = "2.0.108" +name = "futures-io" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", ] [[package]] -name = "tokio" -version = "1.48.0" +name = "generic-array" +version = "0.14.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" +checksum = "4bb6743198531e02858aeaea5398fcc883e71851fcbcb5a2f773e2fb6cb1edf2" dependencies = [ - "bytes", + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", "libc", - "mio", - "parking_lot", - "pin-project-lite", - "signal-hook-registry", - "socket2", - "tokio-macros", - "windows-sys 0.61.2", + "wasi", ] [[package]] -name = "tokio-macros" -version = "2.6.0" +name = "hashbrown" +version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" dependencies = [ - "proc-macro2", - "quote", - "syn", + "allocator-api2", + "equivalent", + "foldhash", ] [[package]] -name = "unicode-ident" -version = "1.0.20" +name = "hashbrown" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "462eeb75aeb73aea900253ce739c8e18a67423fadf006037cd3ff27e82748a06" +checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" [[package]] -name = "utf8parse" -version = "0.2.2" +name = "hashlink" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" +checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" +dependencies = [ + "hashbrown 0.15.5", +] [[package]] -name = "wasi" -version = "0.11.1+wasi-snapshot-preview1" +name = "heck" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] -name = "windows-link" -version = "0.2.1" +name = "hex" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] -name = "windows-sys" -version = "0.60.2" +name = "hkdf" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" dependencies = [ - "windows-targets", + "hmac", ] [[package]] -name = "windows-sys" -version = "0.61.2" +name = "hmac" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "windows-link", + "digest", ] [[package]] -name = "windows-targets" -version = "0.53.5" +name = "home" +version = "0.5.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d" dependencies = [ - "windows-link", - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows-sys 0.61.2", ] [[package]] -name = "windows_aarch64_gnullvm" -version = "0.53.1" +name = "icu_collections" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" +checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47" +dependencies = [ + "displaydoc", + "potential_utf", + "yoke", + "zerofrom", + "zerovec", +] [[package]] -name = "windows_aarch64_msvc" -version = "0.53.1" +name = "icu_locale_core" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" +checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] [[package]] -name = "windows_i686_gnu" -version = "0.53.1" +name = "icu_normalizer" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" +checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] [[package]] -name = "windows_i686_gnullvm" -version = "0.53.1" +name = "icu_normalizer_data" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" +checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3" [[package]] -name = "windows_i686_msvc" -version = "0.53.1" +name = "icu_properties" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" +checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "potential_utf", + "zerotrie", + "zerovec", +] [[package]] -name = "windows_x86_64_gnu" -version = "0.53.1" +name = "icu_properties_data" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" +checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632" [[package]] -name = "windows_x86_64_gnullvm" -version = "0.53.1" +name = "icu_provider" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" +checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af" +dependencies = [ + "displaydoc", + "icu_locale_core", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] [[package]] -name = "windows_x86_64_msvc" -version = "0.53.1" +name = "idna" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "2.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f" +dependencies = [ + "equivalent", + "hashbrown 0.16.0", +] + +[[package]] +name = "install-extensions" +version = "0.1.0" +dependencies = [ + "clap", + "sqlx", + "tokio", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "itoa" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +dependencies = [ + "spin", +] + +[[package]] +name = "libc" +version = "0.2.177" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" + +[[package]] +name = "libm" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" + +[[package]] +name = "libredox" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb" +dependencies = [ + "bitflags", + "libc", + "redox_syscall", +] + +[[package]] +name = "libsqlite3-sys" +version = "0.30.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" +dependencies = [ + "pkg-config", + "vcpkg", +] + +[[package]] +name = "litemap" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" + +[[package]] +name = "md-5" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" +dependencies = [ + "cfg-if", + "digest", +] + +[[package]] +name = "memchr" +version = "2.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" + +[[package]] +name = "mio" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69d83b0086dc8ecf3ce9ae2874b2d1290252e2a30720bea58a5c6639b0092873" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "num-bigint-dig" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151" +dependencies = [ + "byteorder", + "lazy_static", + "libm", + "num-integer", + "num-iter", + "num-traits", + "rand", + "smallvec", + "zeroize", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkcs1" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" +dependencies = [ + "der", + "pkcs8", + "spki", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "pkg-config" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" + +[[package]] +name = "potential_utf" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84df19adbe5b5a0782edcab45899906947ab039ccf4573713735ee7de1e6b08a" +dependencies = [ + "zerovec", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro2" +version = "1.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e0f6df8eaa422d97d72edcd152e1451618fed47fabbdbd5a8864167b1d4aff7" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags", +] + +[[package]] +name = "rsa" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78928ac1ed176a5ca1d17e578a1825f3d81ca54cf41053a592584b020cfd691b" +dependencies = [ + "const-oid", + "digest", + "num-bigint-dig", + "num-integer", + "num-traits", + "pkcs1", + "pkcs8", + "rand_core", + "signature", + "spki", + "subtle", + "zeroize", +] + +[[package]] +name = "ryu" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.145" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", + "serde_core", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a4719bff48cee6b39d12c020eeb490953ad2443b7055bd0b21fca26bd8c28b" +dependencies = [ + "libc", +] + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core", +] + +[[package]] +name = "slab" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" +dependencies = [ + "serde", +] + +[[package]] +name = "socket2" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881" +dependencies = [ + "libc", + "windows-sys 0.60.2", +] + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "sqlx" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fefb893899429669dcdd979aff487bd78f4064e5e7907e4269081e0ef7d97dc" +dependencies = [ + "sqlx-core", + "sqlx-macros", + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", +] + +[[package]] +name = "sqlx-core" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee6798b1838b6a0f69c007c133b8df5866302197e404e8b6ee8ed3e3a5e68dc6" +dependencies = [ + "base64", + "bytes", + "crc", + "crossbeam-queue", + "either", + "event-listener", + "futures-core", + "futures-intrusive", + "futures-io", + "futures-util", + "hashbrown 0.15.5", + "hashlink", + "indexmap", + "log", + "memchr", + "once_cell", + "percent-encoding", + "serde", + "serde_json", + "sha2", + "smallvec", + "thiserror", + "tokio", + "tokio-stream", + "tracing", + "url", +] + +[[package]] +name = "sqlx-macros" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2d452988ccaacfbf5e0bdbc348fb91d7c8af5bee192173ac3636b5fb6e6715d" +dependencies = [ + "proc-macro2", + "quote", + "sqlx-core", + "sqlx-macros-core", + "syn", +] + +[[package]] +name = "sqlx-macros-core" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19a9c1841124ac5a61741f96e1d9e2ec77424bf323962dd894bdb93f37d5219b" +dependencies = [ + "dotenvy", + "either", + "heck", + "hex", + "once_cell", + "proc-macro2", + "quote", + "serde", + "serde_json", + "sha2", + "sqlx-core", + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", + "syn", + "tokio", + "url", +] + +[[package]] +name = "sqlx-mysql" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa003f0038df784eb8fecbbac13affe3da23b45194bd57dba231c8f48199c526" +dependencies = [ + "atoi", + "base64", + "bitflags", + "byteorder", + "bytes", + "crc", + "digest", + "dotenvy", + "either", + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "generic-array", + "hex", + "hkdf", + "hmac", + "itoa", + "log", + "md-5", + "memchr", + "once_cell", + "percent-encoding", + "rand", + "rsa", + "serde", + "sha1", + "sha2", + "smallvec", + "sqlx-core", + "stringprep", + "thiserror", + "tracing", + "whoami", +] + +[[package]] +name = "sqlx-postgres" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db58fcd5a53cf07c184b154801ff91347e4c30d17a3562a635ff028ad5deda46" +dependencies = [ + "atoi", + "base64", + "bitflags", + "byteorder", + "crc", + "dotenvy", + "etcetera", + "futures-channel", + "futures-core", + "futures-util", + "hex", + "hkdf", + "hmac", + "home", + "itoa", + "log", + "md-5", + "memchr", + "once_cell", + "rand", + "serde", + "serde_json", + "sha2", + "smallvec", + "sqlx-core", + "stringprep", + "thiserror", + "tracing", + "whoami", +] + +[[package]] +name = "sqlx-sqlite" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2d12fe70b2c1b4401038055f90f151b78208de1f9f89a7dbfd41587a10c3eea" +dependencies = [ + "atoi", + "flume", + "futures-channel", + "futures-core", + "futures-executor", + "futures-intrusive", + "futures-util", + "libsqlite3-sys", + "log", + "percent-encoding", + "serde", + "serde_urlencoded", + "sqlx-core", + "thiserror", + "tracing", + "url", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "stringprep" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1" +dependencies = [ + "unicode-bidi", + "unicode-normalization", + "unicode-properties", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thiserror" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tinystr" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" +dependencies = [ + "bytes", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-stream" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tracing" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" +dependencies = [ + "once_cell", +] + +[[package]] +name = "typenum" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" + +[[package]] +name = "unicode-bidi" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" + +[[package]] +name = "unicode-ident" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "462eeb75aeb73aea900253ce739c8e18a67423fadf006037cd3ff27e82748a06" + +[[package]] +name = "unicode-normalization" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-properties" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0" + +[[package]] +name = "url" +version = "2.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" + +[[package]] +name = "whoami" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d4a4db5077702ca3015d3d02d74974948aba2ad9e12ab7df718ee64ccd7e97d" +dependencies = [ + "libredox", + "wasite", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.5", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + +[[package]] +name = "writeable" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb" + +[[package]] +name = "yoke" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zerofrom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" + +[[package]] +name = "zerotrie" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7aa2bd55086f1ab526693ecbe444205da57e25f4489879da80635a46d90e73b" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/Cargo.toml b/Cargo.toml index 6b344ca..e849c1c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,4 +6,5 @@ edition = "2024" [dependencies] clap = { version = "4.5.50", features = ["derive"] } +sqlx = { version = "0.8.6", features = ["runtime-tokio", "postgres"] } tokio = { version = "1.48.0", features = ["full"] } diff --git a/makefile b/makefile index 1a587d5..558a016 100644 --- a/makefile +++ b/makefile @@ -1,7 +1,8 @@ test: - docker build -t postgres-testmode --build-arg TEST_MODE=true . - docker run -e POSTGRES_PASSWORD=testmode postgres-testmode /usr/local/bin/installer --test-mode - docker rmi postgres-testmode + @echo "Building test image with extensions..." + docker build --build-arg POSTGRES_VERSION=18 --build-arg TEST_MODE=true -t postgres-test-local . + @echo "Starting PostgreSQL container and running tests..." + docker run --rm --name postgres-test-runner -e POSTGRES_PASSWORD=testmode postgres-test-local bash -c "docker-entrypoint.sh postgres & sleep 5 && until pg_isready -U postgres; do sleep 1; done && /usr/local/bin/installer --test-mode" build: docker build -t ruxwez/postgres . diff --git a/src/common.rs b/src/common.rs index 0a685cf..0b90ad0 100644 --- a/src/common.rs +++ b/src/common.rs @@ -30,7 +30,6 @@ pub fn run_output(cmd: &str) -> String { } pub fn get_current_postgres_version() -> String { - println!("πŸ”Ž Detecting PostgreSQL version from the base image (requested: latest)..."); // Try `postgres --version`. This requires that the base image already provides the postgres binary. let ver_output = run_output("postgres --version"); diff --git a/src/extensions/mod.rs b/src/extensions/mod.rs index 7e77395..d9c94a3 100644 --- a/src/extensions/mod.rs +++ b/src/extensions/mod.rs @@ -13,3 +13,11 @@ pub async fn install(pg_version: Arc) { // Wait for all installations to complete let _ = tokio::join!(pgmq_handle, pgvector_handle); } + +pub async fn run_tests() { + postgis::run_test().await; + pgvector::run_test().await; + pgmq::run_test().await; + + println!("All extension tests passed!"); +} diff --git a/src/extensions/pgmq.rs b/src/extensions/pgmq.rs index f778b1b..c5c7d2e 100644 --- a/src/extensions/pgmq.rs +++ b/src/extensions/pgmq.rs @@ -1,4 +1,4 @@ -use crate::{common::run, structs::ExtensionVersionCompatibility}; +use crate::{common::run, structs::ExtensionVersionCompatibility, test}; use std::{ fs, sync::{Arc, LazyLock}, @@ -28,3 +28,12 @@ pub fn install(pg_version: Arc) -> JoinHandle<()> { fs::remove_dir_all("/tmp/pgmq").ok(); }) } + +pub async fn run_test() { + let pool = test::get_pool(); + + sqlx::query("CREATE EXTENSION pgmq") + .execute(pool) + .await + .expect("Error to verify postgis extension"); +} diff --git a/src/extensions/pgvector.rs b/src/extensions/pgvector.rs index b6dd51c..b0bdf1d 100644 --- a/src/extensions/pgvector.rs +++ b/src/extensions/pgvector.rs @@ -1,4 +1,4 @@ -use crate::{common::run, structs::ExtensionVersionCompatibility}; +use crate::{common::run, structs::ExtensionVersionCompatibility, test}; use std::{ fs, sync::{Arc, LazyLock}, @@ -32,3 +32,12 @@ pub fn install(pg_version: Arc) -> JoinHandle<()> { fs::remove_dir_all("/tmp/pgvector").ok(); }) } + +pub async fn run_test() { + let pool = test::get_pool(); + + sqlx::query("CREATE EXTENSION avector") + .execute(pool) + .await + .expect("Error to verify postgis extension"); +} diff --git a/src/extensions/postgis.rs b/src/extensions/postgis.rs index 3cd77e6..4892a60 100644 --- a/src/extensions/postgis.rs +++ b/src/extensions/postgis.rs @@ -1,6 +1,8 @@ use std::sync::{Arc, LazyLock}; -use crate::{common::run, structs::ExtensionVersionCompatibility}; +use sqlx::Executor; + +use crate::{common::run, structs::ExtensionVersionCompatibility, test}; static VERSIONS: LazyLock = LazyLock::new(|| ExtensionVersionCompatibility { @@ -24,3 +26,12 @@ pub fn install(pg_version: Arc) { pg_major, ex_version, pg_major, ex_version )); } + +pub async fn run_test() { + let pool = test::get_pool(); + + sqlx::query("CREATE EXTENSION postgis") + .execute(pool) + .await + .expect("Error to verify postgis extension"); +} diff --git a/src/main.rs b/src/main.rs index 4c3e0d3..f24a0da 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,14 +4,16 @@ mod common; mod core; mod extensions; mod structs; -mod tests; +mod test; #[tokio::main] async fn main() { let cli = structs::CLI::parse(); if cli.test_mode { - return tests::run().await; + test::init_db_pool().await; + + return extensions::run_tests().await; } // If user passed "latest", detect the numeric version from the installed postgres binary. diff --git a/src/test.rs b/src/test.rs new file mode 100644 index 0000000..ebd7bb9 --- /dev/null +++ b/src/test.rs @@ -0,0 +1,20 @@ +use sqlx::{Pool, Postgres, postgres::PgPoolOptions}; +use std::sync::OnceLock; + +static POOL: OnceLock> = OnceLock::new(); + +pub async fn init_db_pool() { + let pool_options = PgPoolOptions::new() + .max_connections(10) + .connect(&format!( + "postgres://postgres:testmode@127.0.0.1:5432/postgres" + )) + .await + .unwrap(); + + POOL.set(pool_options).expect("Failed to set Postgres pool"); +} + +pub fn get_pool() -> &'static Pool { + POOL.get().expect("Postgres pool not initialized") +} diff --git a/src/tests/config.rs b/src/tests/config.rs deleted file mode 100644 index 368f387..0000000 --- a/src/tests/config.rs +++ /dev/null @@ -1,24 +0,0 @@ -use std::{env, sync::OnceLock}; - -#[derive(Debug)] -pub struct Config { - pub PG_PASSWORD: String, - pub PG_USER: String, - pub PG_DB: String, -} - -static CONFIG: OnceLock = OnceLock::new(); - -pub fn init() { - let config = Config { - PG_PASSWORD: env::var("PG_PASSWORD").expect("Error to get Postgres Password"), - PG_DB: "postgres".to_owned(), - PG_USER: "postgres".to_owned(), - }; - - CONFIG.set(config).expect("Failed to set config"); -} - -pub fn get() -> &'static Config { - CONFIG.get().expect("Config not initialized") -} diff --git a/src/tests/mod.rs b/src/tests/mod.rs deleted file mode 100644 index 486853e..0000000 --- a/src/tests/mod.rs +++ /dev/null @@ -1,9 +0,0 @@ -use std::time::Duration; - -use tokio::time::sleep; - -mod config; - -pub async fn run() { - sleep(Duration::from_secs(100)).await; -} From cc49b183c4dfa51257292c661cde1b4dc71c8f5f Mon Sep 17 00:00:00 2001 From: Jose Garcia <47431411+ruxwez@users.noreply.github.com> Date: Fri, 24 Oct 2025 22:07:08 +0200 Subject: [PATCH 3/6] fix: Correct extension name in pgvector and remove unused import in postgis --- src/extensions/pgvector.rs | 2 +- src/extensions/postgis.rs | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/extensions/pgvector.rs b/src/extensions/pgvector.rs index b0bdf1d..f040abc 100644 --- a/src/extensions/pgvector.rs +++ b/src/extensions/pgvector.rs @@ -36,7 +36,7 @@ pub fn install(pg_version: Arc) -> JoinHandle<()> { pub async fn run_test() { let pool = test::get_pool(); - sqlx::query("CREATE EXTENSION avector") + sqlx::query("CREATE EXTENSION vector") .execute(pool) .await .expect("Error to verify postgis extension"); diff --git a/src/extensions/postgis.rs b/src/extensions/postgis.rs index 4892a60..59af2ed 100644 --- a/src/extensions/postgis.rs +++ b/src/extensions/postgis.rs @@ -1,7 +1,5 @@ use std::sync::{Arc, LazyLock}; -use sqlx::Executor; - use crate::{common::run, structs::ExtensionVersionCompatibility, test}; static VERSIONS: LazyLock = From d56111b401da1c215e6566ef2c97a1f5638db87a Mon Sep 17 00:00:00 2001 From: Jose Garcia <47431411+ruxwez@users.noreply.github.com> Date: Fri, 24 Oct 2025 22:26:17 +0200 Subject: [PATCH 4/6] feat: Enhance error handling and messaging in PostgreSQL extension management --- src/common.rs | 42 +++++++++++++++++++++++++++++++------- src/core.rs | 14 ++++++------- src/extensions/mod.rs | 4 +++- src/extensions/pgmq.rs | 6 +++--- src/extensions/pgvector.rs | 4 ++-- src/extensions/postgis.rs | 4 ++-- src/main.rs | 12 +++-------- src/structs.rs | 11 +++++----- src/test.rs | 12 ++++++++--- 9 files changed, 70 insertions(+), 39 deletions(-) diff --git a/src/common.rs b/src/common.rs index 0b90ad0..1f85397 100644 --- a/src/common.rs +++ b/src/common.rs @@ -1,14 +1,38 @@ use std::process::Command; +#[macro_export] +macro_rules! print_error { + ($($arg:tt)*) => {{ + eprintln!("❌ | {}", format!($($arg)*)); + std::process::exit(1); + }}; +} + +#[macro_export] +macro_rules! print_message { + ($($arg:tt)*) => {{ + println!("πŸ’  | {}", format!($($arg)*)); + }}; +} + +#[macro_export] +macro_rules! print_success { + ($($arg:tt)*) => {{ + println!("πŸ’  | {}", format!($($arg)*)); + }}; +} + pub fn run(cmd: &str) { let status = Command::new("sh") .arg("-c") .arg(cmd) .status() - .expect("Failed to execute command"); + .unwrap_or_else(|_| { + print_error!("Failed to execute command: {}", cmd); + }); if !status.success() { - panic!("Command failed: {}", cmd); + print_error!("Command failed: {}", cmd); } } @@ -19,18 +43,20 @@ pub fn run_output(cmd: &str) -> String { .arg("-c") .arg(cmd) .output() - .expect("Failed to execute command"); + .unwrap_or_else(|_| { + print_error!("Failed to execute command: {}", cmd); + }); if !output.status.success() { let stderr = String::from_utf8_lossy(&output.stderr); - panic!("Command failed: {}\nstderr: {}", cmd, stderr); + print_error!("Command failed: {}\nstderr: {}", cmd, stderr); } String::from_utf8_lossy(&output.stdout).trim().to_string() } pub fn get_current_postgres_version() -> String { - println!("πŸ”Ž Detecting PostgreSQL version from the base image (requested: latest)..."); + print_message!("πŸ”Ž Detecting PostgreSQL version from the base image (requested: latest)..."); // Try `postgres --version`. This requires that the base image already provides the postgres binary. let ver_output = run_output("postgres --version"); // Typical output: "postgres (PostgreSQL) 15.3" @@ -38,10 +64,12 @@ pub fn get_current_postgres_version() -> String { let numeric_version = ver_output .split_whitespace() .last() - .expect("Failed to parse postgres --version output") + .unwrap_or_else(|| { + print_error!("Error detecting PostgreSQL version"); + }) .to_string(); - println!("ℹ️ Detected PostgreSQL version: {}", numeric_version); + print_success!("ℹ️ Detected PostgreSQL version: {}", numeric_version); numeric_version } diff --git a/src/core.rs b/src/core.rs index 253e17d..5fa38ab 100644 --- a/src/core.rs +++ b/src/core.rs @@ -1,23 +1,23 @@ use std::sync::Arc; -use crate::{common::run, extensions}; +use crate::{common::run, extensions, print_error, print_message, print_success}; pub async fn installer(pg_version: String) { if !cfg!(unix) { - panic!("❌ The installer only supports Unix-like operating systems."); + print_error!("❌ The installer only supports Unix-like operating systems."); } let pg_version = Arc::new(pg_version); let pg_major = pg_version.split(".").next().unwrap(); - println!( + print_message!( "πŸš€ Installing PostgreSQL extensions for version {}", pg_version ); // Install necessary packages - println!("πŸ“¦ Installing build dependencies..."); + print_message!("πŸ“¦ Installing build dependencies..."); run(&format!( "apt-get update && apt-get install -y --no-install-recommends \ postgresql-contrib \ @@ -29,11 +29,11 @@ pub async fn installer(pg_version: String) { )); // Install extensions - println!("πŸ”§ Installing extensions in parallel..."); + print_message!("πŸ”§ Installing extensions in parallel..."); extensions::install(pg_version.clone()).await; // Clean up build packages to reduce image size - println!("🧹 Cleaning up to reduce image size..."); + print_message!("🧹 Cleaning up to reduce image size..."); run(&format!( "apt-get purge -y --auto-remove \ git \ @@ -52,5 +52,5 @@ pub async fn installer(pg_version: String) { pg_major )); - println!("βœ… Installation completed successfully!"); + print_success!("Installation completed successfully!"); } diff --git a/src/extensions/mod.rs b/src/extensions/mod.rs index d9c94a3..9e25ff2 100644 --- a/src/extensions/mod.rs +++ b/src/extensions/mod.rs @@ -1,5 +1,7 @@ use std::sync::Arc; +use crate::print_success; + mod pgmq; mod pgvector; mod postgis; @@ -19,5 +21,5 @@ pub async fn run_tests() { pgvector::run_test().await; pgmq::run_test().await; - println!("All extension tests passed!"); + print_success!("All extension tests passed!"); } diff --git a/src/extensions/pgmq.rs b/src/extensions/pgmq.rs index c5c7d2e..8333bcc 100644 --- a/src/extensions/pgmq.rs +++ b/src/extensions/pgmq.rs @@ -1,4 +1,4 @@ -use crate::{common::run, structs::ExtensionVersionCompatibility, test}; +use crate::{common::run, print_error, structs::ExtensionVersionCompatibility, test}; use std::{ fs, sync::{Arc, LazyLock}, @@ -15,7 +15,7 @@ static VERSIONS: LazyLock = pub fn install(pg_version: Arc) -> JoinHandle<()> { let version = match VERSIONS.get_version(&pg_version.to_owned()) { Some(v) => v, - None => panic!("Unsupported PostgreSQL version"), + None => print_error!("Unsupported PostgreSQL version"), }; tokio::task::spawn_blocking(move || { @@ -35,5 +35,5 @@ pub async fn run_test() { sqlx::query("CREATE EXTENSION pgmq") .execute(pool) .await - .expect("Error to verify postgis extension"); + .unwrap_or_else(|_| print_error!("Error to create pgmq extension")); } diff --git a/src/extensions/pgvector.rs b/src/extensions/pgvector.rs index f040abc..0184cf8 100644 --- a/src/extensions/pgvector.rs +++ b/src/extensions/pgvector.rs @@ -1,4 +1,4 @@ -use crate::{common::run, structs::ExtensionVersionCompatibility, test}; +use crate::{common::run, print_error, structs::ExtensionVersionCompatibility, test}; use std::{ fs, sync::{Arc, LazyLock}, @@ -39,5 +39,5 @@ pub async fn run_test() { sqlx::query("CREATE EXTENSION vector") .execute(pool) .await - .expect("Error to verify postgis extension"); + .unwrap_or_else(|_| print_error!("Error to create vector extension")); } diff --git a/src/extensions/postgis.rs b/src/extensions/postgis.rs index 59af2ed..d205a3b 100644 --- a/src/extensions/postgis.rs +++ b/src/extensions/postgis.rs @@ -1,6 +1,6 @@ use std::sync::{Arc, LazyLock}; -use crate::{common::run, structs::ExtensionVersionCompatibility, test}; +use crate::{common::run, print_error, structs::ExtensionVersionCompatibility, test}; static VERSIONS: LazyLock = LazyLock::new(|| ExtensionVersionCompatibility { @@ -31,5 +31,5 @@ pub async fn run_test() { sqlx::query("CREATE EXTENSION postgis") .execute(pool) .await - .expect("Error to verify postgis extension"); + .unwrap_or_else(|_| print_error!("Error to create postgis extension")); } diff --git a/src/main.rs b/src/main.rs index f24a0da..225ab12 100644 --- a/src/main.rs +++ b/src/main.rs @@ -16,15 +16,9 @@ async fn main() { return extensions::run_tests().await; } - // If user passed "latest", detect the numeric version from the installed postgres binary. - // Otherwise use the provided version string (e.g. "15.3" or "15"). - let mut pg_version = cli.pg_version; - if pg_version == "ignore" { - panic!("Error: --pg-version is required."); - } - - if pg_version.eq_ignore_ascii_case("latest") { - pg_version = common::get_current_postgres_version() + let pg_version = common::get_current_postgres_version(); + if pg_version == "" { + print_error!("Error detecting PostgreSQL version"); } core::installer(pg_version).await; diff --git a/src/structs.rs b/src/structs.rs index a652456..57d9056 100644 --- a/src/structs.rs +++ b/src/structs.rs @@ -1,5 +1,7 @@ use clap::Parser; +use crate::print_error; + pub struct ExtensionVersionCompatibility<'a> { pub v16: &'a str, pub v17: &'a str, @@ -9,7 +11,10 @@ pub struct ExtensionVersionCompatibility<'a> { impl ExtensionVersionCompatibility<'static> { pub fn get_version(&self, version: &str) -> Option { if version.contains('.') { - let major_version = version.split('.').next().unwrap(); + let major_version = version.split('.').next().unwrap_or_else(|| { + print_error!("Error extracting major version from {}", version); + }); + return self.get_version(major_version); } @@ -27,8 +32,4 @@ pub struct CLI { // Test mode #[arg(short, long, default_value_t = false)] pub test_mode: bool, - - // PG Version - #[arg(long, default_value_t = String::from("ignore"))] - pub pg_version: String, } diff --git a/src/test.rs b/src/test.rs index ebd7bb9..7699944 100644 --- a/src/test.rs +++ b/src/test.rs @@ -1,6 +1,8 @@ use sqlx::{Pool, Postgres, postgres::PgPoolOptions}; use std::sync::OnceLock; +use crate::print_error; + static POOL: OnceLock> = OnceLock::new(); pub async fn init_db_pool() { @@ -10,11 +12,15 @@ pub async fn init_db_pool() { "postgres://postgres:testmode@127.0.0.1:5432/postgres" )) .await - .unwrap(); + .unwrap_or_else(|_| { + print_error!("Failed to connect to the Postgres database"); + }); - POOL.set(pool_options).expect("Failed to set Postgres pool"); + POOL.set(pool_options) + .unwrap_or_else(|_| print_error!("Postgres Pool already initialized")); } pub fn get_pool() -> &'static Pool { - POOL.get().expect("Postgres pool not initialized") + POOL.get() + .unwrap_or_else(|| print_error!("Postgres Pool not initialized")) } From f69f288c545c0aa437004743879e13b1c4a44c32 Mon Sep 17 00:00:00 2001 From: Jose Garcia <47431411+ruxwez@users.noreply.github.com> Date: Fri, 24 Oct 2025 22:39:34 +0200 Subject: [PATCH 5/6] refactor: Improve version handling and error reporting in PostgreSQL extensions --- .github/workflows/docker-build.yml | 1 - Dockerfile | 3 +-- src/common.rs | 12 +++++++++++- src/core.rs | 7 +++++-- src/extensions/pgvector.rs | 2 +- src/extensions/postgis.rs | 11 ++++++++--- src/structs.rs | 8 +++----- 7 files changed, 29 insertions(+), 15 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index bc02708..f4feef7 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -38,7 +38,6 @@ jobs: push: ${{ github.event_name != 'pull_request' }} tags: | ${{ secrets.DOCKER_USERNAME }}/postgres:${{ matrix.postgres_version }} - ${{ secrets.DOCKER_USERNAME }}/postgres:latest build-args: | POSTGRES_VERSION=${{ matrix.postgres_version }} cache-from: type=gha diff --git a/Dockerfile b/Dockerfile index 595445a..107000f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,14 +12,13 @@ RUN cargo build --release # Final stage: only Postgres FROM postgres:${POSTGRES_VERSION} -ARG POSTGRES_VERSION ARG TEST_MODE # Copy the compiled binary COPY --from=builder /installer/target/release/install-extensions /usr/local/bin/installer # Run installer (all logic including cleanup is inside the binary) -RUN /usr/local/bin/installer --pg-version ${POSTGRES_VERSION} +RUN /usr/local/bin/installer # If TEST_MODE is true, run tests RUN if [ "${TEST_MODE}" = "false" ]; then rm /usr/local/bin/installer; fi diff --git a/src/common.rs b/src/common.rs index 1f85397..ad18328 100644 --- a/src/common.rs +++ b/src/common.rs @@ -18,7 +18,7 @@ macro_rules! print_message { #[macro_export] macro_rules! print_success { ($($arg:tt)*) => {{ - println!("πŸ’  | {}", format!($($arg)*)); + println!("βœ… | {}", format!($($arg)*)); }}; } @@ -73,3 +73,13 @@ pub fn get_current_postgres_version() -> String { numeric_version } + +pub fn get_major_version(version: &str) -> String { + version + .split('.') + .next() + .unwrap_or_else(|| { + print_error!("Error parsing PostgreSQL major version from {}", version); + }) + .to_string() +} diff --git a/src/core.rs b/src/core.rs index 5fa38ab..f98d038 100644 --- a/src/core.rs +++ b/src/core.rs @@ -1,6 +1,9 @@ use std::sync::Arc; -use crate::{common::run, extensions, print_error, print_message, print_success}; +use crate::{ + common::{get_major_version, run}, + extensions, print_error, print_message, print_success, +}; pub async fn installer(pg_version: String) { if !cfg!(unix) { @@ -9,7 +12,7 @@ pub async fn installer(pg_version: String) { let pg_version = Arc::new(pg_version); - let pg_major = pg_version.split(".").next().unwrap(); + let pg_major = get_major_version(&pg_version); print_message!( "πŸš€ Installing PostgreSQL extensions for version {}", diff --git a/src/extensions/pgvector.rs b/src/extensions/pgvector.rs index 0184cf8..cd0bf6b 100644 --- a/src/extensions/pgvector.rs +++ b/src/extensions/pgvector.rs @@ -15,7 +15,7 @@ static VERSIONS: LazyLock = pub fn install(pg_version: Arc) -> JoinHandle<()> { let version = match VERSIONS.get_version(&pg_version.to_owned()) { Some(v) => v, - None => panic!("Unsupported PostgreSQL version"), + None => print_error!("Unsupported PostgreSQL version"), }; tokio::task::spawn_blocking(move || { diff --git a/src/extensions/postgis.rs b/src/extensions/postgis.rs index d205a3b..d21283d 100644 --- a/src/extensions/postgis.rs +++ b/src/extensions/postgis.rs @@ -1,6 +1,11 @@ use std::sync::{Arc, LazyLock}; -use crate::{common::run, print_error, structs::ExtensionVersionCompatibility, test}; +use crate::{ + common::{get_major_version, run}, + print_error, + structs::ExtensionVersionCompatibility, + test, +}; static VERSIONS: LazyLock = LazyLock::new(|| ExtensionVersionCompatibility { @@ -10,11 +15,11 @@ static VERSIONS: LazyLock = }); pub fn install(pg_version: Arc) { - let pg_major = pg_version.to_owned().split('.').next().unwrap().to_owned(); + let pg_major = get_major_version(&pg_version); let ex_version = match VERSIONS.get_version(&pg_major.clone()) { Some(v) => v, - None => panic!("Unsupported PostgreSQL version"), + None => print_error!("Unsupported PostgreSQL version"), }; run(&format!( diff --git a/src/structs.rs b/src/structs.rs index 57d9056..2b75af3 100644 --- a/src/structs.rs +++ b/src/structs.rs @@ -1,6 +1,6 @@ use clap::Parser; -use crate::print_error; +use crate::{common::get_major_version, print_error}; pub struct ExtensionVersionCompatibility<'a> { pub v16: &'a str, @@ -11,11 +11,9 @@ pub struct ExtensionVersionCompatibility<'a> { impl ExtensionVersionCompatibility<'static> { pub fn get_version(&self, version: &str) -> Option { if version.contains('.') { - let major_version = version.split('.').next().unwrap_or_else(|| { - print_error!("Error extracting major version from {}", version); - }); + let major_version = get_major_version(version); - return self.get_version(major_version); + return self.get_version(&major_version); } match version.to_string().as_str() { From 7708c301fec99f5aad6d5bffa9dcd92f4705d865 Mon Sep 17 00:00:00 2001 From: Jose Garcia <47431411+ruxwez@users.noreply.github.com> Date: Fri, 24 Oct 2025 22:39:46 +0200 Subject: [PATCH 6/6] refactor: Remove unused import in structs.rs --- src/structs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/structs.rs b/src/structs.rs index 2b75af3..44a7575 100644 --- a/src/structs.rs +++ b/src/structs.rs @@ -1,6 +1,6 @@ use clap::Parser; -use crate::{common::get_major_version, print_error}; +use crate::common::get_major_version; pub struct ExtensionVersionCompatibility<'a> { pub v16: &'a str,