As I developed my projects github action workflow for using pgschema plan/apply I noticed with the go install it would not use the .pgschemaignore when running plan or apply. With the AMD package release it works as expected.
I first followed https://www.pgschema.com/workflow/gitops and https://github.com/pgplex/pgschema-github-actions-example when writing the github actions yml file; both of which use the go install methods.
My .pgschemaignore contains:
[views]
patterns = ["pg_stat_statements", "pg_stat_statements_info", "pg_stat_statements_reset"]
[functions]
patterns = ["pg_stat_statements_reset"]
The go install steps:
steps:
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version: "stable"
cache: false
- name: Install pgschema
run: go install github.com/pgplex/pgschema@latest
The AMD install step:
steps:
- name: Install pgschema
run: |
echo "Downloading pgschema..."
curl -LO https://github.com/pgplex/pgschema/releases/download/v1.9.0/pgschema_1.9.0_amd64.deb
echo "Installing pgschema..."
sudo dpkg -i pgschema_1.9.0_amd64.deb
And the complete yaml that works as expected and I'm currently using succesfully:
name: pgschema migration
on:
push:
branches:
- main
paths:
- "database_schema/**"
permissions:
contents: read
jobs:
plan-apply:
runs-on: ubuntu-latest
environment: focused-rejoicing / production
env:
PGPASSWORD: ${{ secrets.PGPASSWORD }}
PGHOST: ${{ secrets.PGHOST }}
PGPORT: ${{ secrets.PGPORT }}
PGDATABASE: ${{ secrets.PGDATABASE }}
PGUSER: ${{ secrets.PGUSER }}
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install pgschema
run: |
echo "Downloading pgschema..."
curl -LO https://github.com/pgplex/pgschema/releases/download/v1.9.0/pgschema_1.9.0_amd64.deb
echo "Installing pgschema..."
sudo dpkg -i pgschema_1.9.0_amd64.deb
- name: Generate migration plan
run: |
echo "Producing migration plan..."
pgschema plan --schema public --file database_schema/main.sql --output-json plan.json --output-human stdout
- name: Apply migration
run: |
echo "Applying migration plan..."
pgschema apply --schema public --plan plan.json --auto-approve
Wanted to let you and others know that this issue exists (if you see something I did incorrectly and caused it let me know). For users it's a simple fix to switch to installing the AMD/ARM install if Go isn't working for you.
I'll finish with letting you know how awesome I think this tool is. Trying to define and migrate schemas using orm's (at least in python) is a really bad time. Being able to use the actual sql commands is both faster and clearer.
As I developed my projects github action workflow for using pgschema plan/apply I noticed with the go install it would not use the
.pgschemaignorewhen runningplanorapply. With the AMD package release it works as expected.I first followed https://www.pgschema.com/workflow/gitops and https://github.com/pgplex/pgschema-github-actions-example when writing the github actions yml file; both of which use the go install methods.
My
.pgschemaignorecontains:The go install steps:
The AMD install step:
And the complete yaml that works as expected and I'm currently using succesfully:
Wanted to let you and others know that this issue exists (if you see something I did incorrectly and caused it let me know). For users it's a simple fix to switch to installing the AMD/ARM install if Go isn't working for you.
I'll finish with letting you know how awesome I think this tool is. Trying to define and migrate schemas using orm's (at least in python) is a really bad time. Being able to use the actual sql commands is both faster and clearer.