Skip to content

Latest commit

 

History

History
54 lines (40 loc) · 1.36 KB

File metadata and controls

54 lines (40 loc) · 1.36 KB

Databases

SQL

https://gvwilson.github.io/sql-tutorial/

PostgreSQL

Docker compose

  postgres_db:
    image: postgres
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=some_password
      - POSTGRES_DB=my_db_name
    ports:
      - 5432:5432
    volumes:
      - ./path_to_migration_scripts:/docker-entrypoint-initdb.d/  # this will run all scripts in the folder
    healthcheck:
      test: ["CMD", "pg_isready", "-U", "postgres"]
      interval: 1s
      timeout: 3s
      retries: 30

In the container, run:

psql postgresql://"$POSTGRES_USER":"$POSTGRES_PASSWORD"@"$POSTGRES_HOST":5432/"$POSTGRES_DB"

From outside the container, run:

psql postgresql://postgres:some_password@postgres_db:5432/my_db_name

UUID

UUID as primary key:

Links