Releases: fmguerreiro/pgmold
Releases · fmguerreiro/pgmold
v0.11.1
Bug Fixes
- Fix round-trip parsing for baseline tests
- Strip quotes from parsed identifiers (trigger names, policy names, OWNED BY parts)
- Normalize function return types to lowercase
- Normalize view queries and function bodies whitespace
- Normalize column defaults to lowercase cast types
- Add support for parsing ALTER TABLE ADD CONSTRAINT for foreign keys
- Fix function key format in introspection to use qualified names
- Handle circular foreign key dependencies in topological sort
Internal
- Add
normalize_sql_whitespaceutility function - Fix baseline tests using multi-statement SQL with sqlx::raw_sql
v0.11.0
What's New
PARTITION OF Support
- Full support for PostgreSQL table partitioning with
PARTITION OFsyntax - Parse partition tables into
schema.partitionswith bound types:FOR VALUES FROM ... TO ...(Range)FOR VALUES IN (...)(List)FOR VALUES WITH (MODULUS ..., REMAINDER ...)(Hash)DEFAULT
- Generate
CREATE TABLE ... PARTITION OF ... FOR VALUES ...SQL - Proper dependency ordering (partitions created after parent tables)
sqlparser Upgrade
- Upgraded from sqlparser 0.52 to forked 0.60 with PARTITION OF parsing support
- Uses fmguerreiro/datafusion-sqlparser-rs
partition-of-supportbranch
Note
This release uses a forked sqlparser and cannot be published to crates.io. Install from source:
cargo install --git https://github.com/fmguerreiro/pgmoldv0.10.0
What's New
Partitioned Tables Support (Phase 1)
- Parser: Parse
PARTITION BY RANGE/LIST/HASHfrom SQL files - Introspection: Extract partition info from
pg_partitioned_tableandpg_inheritscatalogs - SQL Generation: Generate
PARTITION BYclause inCREATE TABLEstatements - Model: New types
PartitionStrategy,PartitionKey,PartitionBound,Partition
Limitations
PARTITION OFsyntax (child partition creation) not yet supported in parser (sqlparser 0.52 limitation)- Tracked in pgmold-32
Full Changelog
v0.9.0
- Add baseline command module for adopting existing databases
- Includes unsupported object detection (materialized views, domains, partitioned tables, etc.)
- Round-trip verification and zero-diff guarantees
- Text and JSON report formats
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.