1.8 KiB
1.8 KiB
Development Workflow
Version Management
This extension uses a single-source version approach:
- Version source of truth:
pg_morbac.control(thedefault_versionfield) - Development file:
pg_morbac.sql(unversioned, for daily work) - Release files:
pg_morbac--X.Y.Z.sql(generated, git-ignored)
Daily Development
- Edit: Work on
pg_morbac.sql(no version numbers in the file) - Test: Run
make testto test changes in a temporary database - Commit: Commit
pg_morbac.sqlto git regularly
Release Process
When ready to release a new version:
-
Update version: Edit
pg_morbac.controland changedefault_versiondefault_version = '1.1.0' -
Create release: Run
make release- Reads version from
.controlfile - Copies
pg_morbac.sqltopg_morbac--X.Y.Z.sql
- Reads version from
-
Test: Run
make testwith the versioned file -
Tag in git:
git add pg_morbac.control pg_morbac--X.Y.Z.sql git commit -m "Release vX.Y.Z" git tag vX.Y.Z git push origin main --tags
Upgrade Scripts
For version migrations, create upgrade scripts:
# Example: upgrade from 1.0.0 to 1.1.0
touch pg_morbac--1.0.0--1.1.0.sql
These contain only the ALTER/ADD statements needed for the upgrade.
Make Targets
make test: Test with development file (temporary database)make test: Full test with persistent databasemake release: Generate versioned file from development filemake install: Create release and install in PostgreSQLmake cleanup: Drop test databasemake help: Show all targets
Benefits
- No version numbers scattered in code
- Clean git diffs (only one file changes during development)
- Versioned files only created at release time
- Git tags provide version history
- Single source of truth for version number