From ed0229d0b4ac5b7bb5aad4f089e776b995a1bd02 Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Mon, 10 Nov 2025 23:28:57 -0500 Subject: [PATCH] fix: rm docker approach to dbmate migration creation --- migrations/Dockerfile.dbmate | 23 ----------------- migrations/README.md | 17 ------------- migrations/docker-compose.yaml | 46 ---------------------------------- 3 files changed, 86 deletions(-) delete mode 100644 migrations/Dockerfile.dbmate delete mode 100644 migrations/docker-compose.yaml diff --git a/migrations/Dockerfile.dbmate b/migrations/Dockerfile.dbmate deleted file mode 100644 index 29c80e6e5..000000000 --- a/migrations/Dockerfile.dbmate +++ /dev/null @@ -1,23 +0,0 @@ -FROM debian:bullseye-slim - -RUN apt-get update && apt-get install -y curl wget gnupg2 lsb-release - -RUN ARCH=$(dpkg --print-architecture); \ - case ${ARCH} in \ - amd64) DBMATE_ARCH="linux-amd64" ;; \ - arm64) DBMATE_ARCH="linux-arm64" ;; \ - *) echo "Unsupported architecture: ${ARCH}"; exit 1 ;; \ - esac && \ - curl -fsSL -o /usr/local/bin/dbmate \ - https://github.com/amacneil/dbmate/releases/latest/download/dbmate-${DBMATE_ARCH} && \ - chmod +x /usr/local/bin/dbmate - -RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - -RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list -RUN apt-get update && apt-get install -y postgresql-client-%VERSION% - -ENV PATH="/usr/lib/postgresql/%VERSION%/bin:${PATH}" - -RUN dbmate --version - -ENTRYPOINT ["dbmate"] diff --git a/migrations/README.md b/migrations/README.md index ae26f4289..03d7bdd80 100644 --- a/migrations/README.md +++ b/migrations/README.md @@ -112,23 +112,6 @@ dbmate --no-dump-schema --migrations-dir="migrations/db/migrations" -u "postgres Note: Migrations are applied using the `supabase_admin` superuser role, as specified in the "How it was Created" section above. -### Adding a migration with docker-compose - -dbmate can optionally be run locally using docker: - -```shell -# Start the database server -docker-compose up - -# create a new migration -docker-compose run --rm dbmate new '' -``` - -Then, populate the migration at `./db/migrations/xxxxxxxxx_` and make sure it execute sucessfully with - -```shell -docker-compose run --rm dbmate up -``` ### Updating schema.sql for each major version After making changes to migrations, you should update the schema.sql files for each major version of PostgreSQL: diff --git a/migrations/docker-compose.yaml b/migrations/docker-compose.yaml deleted file mode 100644 index 1b3e8b143..000000000 --- a/migrations/docker-compose.yaml +++ /dev/null @@ -1,46 +0,0 @@ -# Usage -# Start: docker-compose up -# Stop: docker-compose down -v - -version: "3.8" - -services: - db: - image: supabase_postgres - restart: "no" - healthcheck: - test: pg_isready -U postgres -h localhost - interval: 2s - timeout: 2s - retries: 10 - environment: - POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} - - pg_prove: - image: horrendo/pg_prove - depends_on: - db: - condition: service_healthy - dbmate: - condition: service_completed_successfully - environment: - PGHOST: db - PGUSER: supabase_admin - PGDATABASE: postgres - PGPASSWORD: ${POSTGRES_PASSWORD} - volumes: - - ./tests:/tests - command: pg_prove /tests/test.sql - - dbmate: - build: - context: . - dockerfile: Dockerfile.dbmate - depends_on: - db: - condition: service_healthy - volumes: - - ./schema.sql:/db/schema.sql - environment: - DATABASE_URL: postgres://postgres:${POSTGRES_PASSWORD}@db/postgres?sslmode=disable - command: dump