Skip to content

add PostgreSQL preview schema setup and teardown actions - #7

Merged
stplasim merged 8 commits into
mainfrom
feat/setup-and-teatdown-preview-database
Feb 20, 2026
Merged

add PostgreSQL preview schema setup and teardown actions#7
stplasim merged 8 commits into
mainfrom
feat/setup-and-teatdown-preview-database

Conversation

@stplasim

Copy link
Copy Markdown
Contributor

No description provided.

@stplasim
stplasim requested review from ThoSap and alexlanz February 19, 2026 14:47
@stplasim
stplasim marked this pull request as ready for review February 19, 2026 14:49

@alexlanz alexlanz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice job!

restartPolicy: Never
containers:
- name: prepare-schema-preview
image: postgres:18

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this configurable with good defaults?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we can.

spec:
restartPolicy: Never
containers:
- name: prepare-schema-preview

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- name: prepare-schema-preview
- name: prepare-preview-schema

I would switch the words since you have it also in other places.

@stplasim

stplasim commented Feb 19, 2026

Copy link
Copy Markdown
Contributor Author

@alexlanz I made a few more small improvements. Using sed got quite annoying.

Comment on lines +38 to +45
envsubst '
$JOB_NAME
$CONFIGMAP_NAME
$SECRET_NAME
$PREVIEW_SCHEMA_NAME
$POSTGRES_IMAGE
$BASE_SCHEMA
' < ${{ github.action_path }}/job-template.yml > job-setup-schema.yml

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I did not know this. That is something I will add to my tooling

@stplasim
stplasim merged commit 5929e95 into main Feb 20, 2026
@stplasim
stplasim deleted the feat/setup-and-teatdown-preview-database branch February 20, 2026 08:18

@ThoSap ThoSap left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have nothing to add, very clean refactoring and cleanup of https://github.com/aboutbits/boilerplate-api/pull/177 🔥

Comment on lines +23 to +28
if psql -t -A -c "SELECT 1 FROM information_schema.schemata WHERE schema_name = '${PREVIEW_SCHEMA_NAME}'" | grep -q 1; then
echo "Schema ${PREVIEW_SCHEMA_NAME} already exists. Skipping setup."
echo "Script finished successfully!"
echo "### END $(date --iso-8601=seconds) ###"
exit 0
fi

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that you added this check 💪🏼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants