Skip to content

Instantly share code, notes, and snippets.

View crbelaus's full-sized avatar

Cristian Álvarez Belaustegui crbelaus

View GitHub Profile
@mxgrn
mxgrn / audit-logs.sql
Created December 9, 2024 10:13
Track Postgres table changes in audit_logs
-- Step 1: Create the audit logs table
CREATE TABLE audit_logs (
id SERIAL PRIMARY KEY,
table_name TEXT NOT NULL,
operation TEXT NOT NULL,
json_diff JSONB,
inserted_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Step 2: Create the trigger function
@jgould22
jgould22 / Dockerfile
Last active February 6, 2026 05:15
Postgres 18 - Alpine - pg_partman with pg_jobmon
FROM postgres:18-alpine
LABEL maintainer="Jordan Gould <jordangould@gmail.com>"
# Based on https://github.com/andreaswachowski/docker-postgres/blob/master/initdb.sh
# pg_jobmon 1.5.0
# They never cut a release for 1.5.0 (https://github.com/omniti-labs/pg_jobmon/commit/b9d49e6d4603f2670b3a2d512c31fc7cd5e9a334)
ENV PG_JOBMON_VERSION=b9d49e6d4603f2670b3a2d512c31fc7cd5e9a334
ENV PG_PARTMAN_VERSION=v5.3.1
# Install pg_jobmon