Releases: fmguerreiro/pgmold
Releases · fmguerreiro/pgmold
v0.9.0
v0.8.0
- Add REFERENCING transition tables support for triggers (OLD TABLE, NEW TABLE)
v0.7.0
- Add trigger ENABLE/DISABLE state support (Origin, Disabled, Replica, Always)
- Parser handles ALTER TABLE ... ENABLE/DISABLE/ENABLE REPLICA/ENABLE ALWAYS TRIGGER
- Introspection reads tgenabled from pg_trigger catalog
- Diff emits AlterTriggerEnabled when only enabled state differs
- SQL generation for trigger enable/disable statements
v0.6.0
Breaking Changes
- Renamed
Trigger.table_schema→target_schema - Renamed
Trigger.table→target_name - Renamed
MigrationOp::DropTriggerfields similarly
This fixes semantic accuracy: INSTEAD OF triggers target views (not tables), so "target" is more appropriate than "table".
Upgrading
Update any code that:
- Constructs
Triggerstructs directly - Matches on
MigrationOp::DropTriggervariants - Accesses
trigger.tableortrigger.table_schemafields
v0.5.0
What's New
Schema Dump Command
New pgmold dump command to export database schemas to SQL DDL files.
# Dump schema to stdout
pgmold dump --database db:postgres://localhost/mydb
# Dump to file with specific schemas
pgmold dump --database db:postgres://localhost/mydb --target-schemas auth,api,public --output schema.sqlFeatures:
- Exports all schema objects (tables, indexes, foreign keys, enums, sequences, functions, views, triggers, policies)
- Dependency-ordered output (tables before foreign keys, etc.)
- Multi-schema support
- Optional header with metadata
Installation
cargo install pgmoldv0.4.0
Features
- SERIAL column support: Automatically expand
SERIAL,BIGSERIAL, andSMALLSERIALcolumns to their underlying integer type + sequence - Sequence support: Full support for
CREATE SEQUENCEincluding parsing, introspection, diff, and SQL generation - Sequence lint rules: Added warnings for destructive sequence operations (DROP SEQUENCE, RESTART)
Improvements
- Stricter error handling: Removed silent fallbacks in favor of explicit errors for:
- Unknown referential action codes from PostgreSQL
- Unknown sequence data types
- Missing function return types or bodies
- Invalid UTF-8 paths
- Missing tables during RLS introspection
Testing
- Added integration tests for sequence roundtrip and alterations
- Added parser tests for SERIAL variants with schema qualifiers
v0.3.1
- Fix function body comparison producing false diffs due to dollar-quote delimiters.
v0.3.0
- Add views support (CREATE VIEW, materialized views)
v0.2.0
What's New
- Multi-file schema support: Load SQL schemas from multiple files, directories, and glob patterns
--schema ./schema/loads all*.sqlfiles recursively--schema "schema/**/*.sql"supports glob patterns- Multiple
--schemaflags can be combined - Duplicate object detection with clear error messages
Usage
# Directory
pgmold apply --schema ./schema/ --database $DB_URL
# Glob pattern
pgmold apply --schema "schema/**/*.sql" --database $DB_URL
# Multiple sources
pgmold apply --schema types.sql --schema "tables/*.sql" --database $DB_URLv0.1.1
- Add whitespace-insensitive comparison for SQL function bodies
- Apply clippy fixes