Skip to content

maevsi/sqitch

Repository files navigation

Sqitch

Sqitch

Sqitch is maevsi's database migration tool.

The src directory in this repository contains a sqitch executable that you can use to interact with the migrations residing in the directory's subdirectories. For example, run ./sqitch deploy to fill the database with structure like tables, types and policies.

In case you want to be able to simple call sqitch deploy without ./ instead, add an alias sqitch="./sqitch" to your shell configuration (~/.bashrc, ~/.zshrc, ...).

Database Diagram

This diagram shows the structure of maevsi's database.

Graph

You can create this file as follows:

  1. configure maevsi_stack by adding a portforward of 5432:5432 to the postgres service

  2. start maevsi_stack

  3. run docker run -v /run/postgresql/:/run/postgresql/ --network=host --name schemacrawler --rm -i -t --user=0:0 --entrypoint=/bin/bash schemacrawler/schemacrawler

  4. connect as user schcrwlr to the now running schemacrawler container, e.g. using Portainer

  5. as schcrwlr run schemacrawler --server=postgresql --database=maevsi --user=postgres --password=postgres --command=schema --info-level=maximum --output-format=png --output-file=graph.png --schemas=maevsi.*

  6. as root install curl using apk update && apk add curl

  7. still as root upload the graph image by running curl -i -F file="@graph.png" "https://tmpfiles.org/api/v1/upload"

  8. click the link in the output and download the image that pops up!