Files
computer-playbook/roles/web-app-mobilizon/files/Dockerfile
kevinveenbirkenbachandClaude Opus 5.5 7595d150a7 fix(web-app-mobilizon): patch four migrations for PostgreSQL 18
Every fresh Mobilizon deploy on PostgreSQL 18 died in migration
20190806131306. Four migrations drop the integer id column, add a uuid id
without NOT NULL and declare it the primary key in the same ALTER TABLE.
PostgreSQL 18 rejects that with 42P16 "primary key column "id" is not
marked NOT NULL", PostgreSQL 17 accepted it. The container exited 1 and
restarted in a loop, in compose and in swarm.

Upstream fixed it for 5.3.0 by adding null: false to that line in the four
migrations. No published image carries the fix yet, so the role builds its
own image on top of the pinned upstream one and applies the same one-line
change to the same four files.

The build fails once a base image no longer contains the unfixed line and
names the migration, so the patch cannot outlive its reason unnoticed.
TODO.md lists what to delete then.

Closes #779

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-04 16:57:26 +02:00

19 lines
931 B
Docker

ARG MOBILIZON_IMAGE
ARG MOBILIZON_VERSION
FROM ${MOBILIZON_IMAGE}:${MOBILIZON_VERSION}
RUN set -eu; \
cd /lib/mobilizon-*/priv/repo/migrations; \
for migration in \
20190806131306_add_url_to_follows_and_move_to_uuid.exs \
20190813160207_add_url_and_uuid_to_participants.exs \
20200218170232_move_member_id_to_uuid.exs \
20200721131521_add_url_to_conversation.exs; \
do \
if ! grep -q 'add(:id, :uuid, primary_key: true)$' "${migration}"; then \
echo "${migration} no longer contains 'add(:id, :uuid, primary_key: true)': the base image ships the PostgreSQL 18 migration fix (framagit.org/kaihuri/mobilizon merge request 1683). Drop this Dockerfile and the custom build of web-app-mobilizon." >&2; \
exit 1; \
fi; \
sed -i 's/add(:id, :uuid, primary_key: true)$/add(:id, :uuid, primary_key: true, null: false)/' "${migration}"; \
done