0

I am using the migrate/migrate to perform migrations of my postgres local database. I was using the migrations files inside a local folder and the migrations were running as expected, but I moved the migrations folder to a different repository in github.

Github repository where my migrations are located: https://github.com/guimassoqueto/db-migrations

My local compose.yml file in which I define database and migrations:

version: '3.9'

services:
  postgres:
    container_name: postgres
    image: postgres:alpine
    restart: always
    networks:
      - local
    ports:
      - "${POSTGRES_PORT}:${POSTGRES_PORT}"
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -d ${POSTGRES_DB} -U ${POSTGRES_USER}"]
      interval: 15s
      timeout: 5s
      retries: 5
      start_period: 30s
    environment:
      POSTGRES_DB: ${POSTGRES_DB}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRES_USER: ${POSTGRES_USER}

  migrate:
    container_name: migrate
    image: migrate/migrate
    networks:
      - local
    command: "-source https://github.com/guimassoqueto/db-migrations/blob/main/migrations -database postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:${POSTGRES_PORT}/${POSTGRES_DB}?sslmode=disable -verbose up"
    links:
      - postgres
    depends_on:
      postgres:
        condition: service_healthy


networks:
  local:
    name: local
    driver: bridge

I think I am making some mistake at the command key in the compose file, but I have no idea precisely what I am doing wrong.

1 Answers1

1

The answer is in the docs, I didn't pay attention:

https://github.com/golang-migrate/migrate/tree/master/source/github