Skip to content

Releases: fmguerreiro/pgmold

v0.11.1

08 Dec 10:05

Choose a tag to compare

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_whitespace utility function
  • Fix baseline tests using multi-statement SQL with sqlx::raw_sql

v0.11.0

08 Dec 08:48

Choose a tag to compare

What's New

PARTITION OF Support

  • Full support for PostgreSQL table partitioning with PARTITION OF syntax
  • Parse partition tables into schema.partitions with 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

Note

This release uses a forked sqlparser and cannot be published to crates.io. Install from source:

cargo install --git https://github.com/fmguerreiro/pgmold

v0.10.0

08 Dec 05:28

Choose a tag to compare

What's New

Partitioned Tables Support (Phase 1)

  • Parser: Parse PARTITION BY RANGE/LIST/HASH from SQL files
  • Introspection: Extract partition info from pg_partitioned_table and pg_inherits catalogs
  • SQL Generation: Generate PARTITION BY clause in CREATE TABLE statements
  • Model: New types PartitionStrategy, PartitionKey, PartitionBound, Partition

Limitations

  • PARTITION OF syntax (child partition creation) not yet supported in parser (sqlparser 0.52 limitation)
  • Tracked in pgmold-32

Full Changelog

v0.9.0...v0.10.0

v0.9.0

05 Dec 10:12

Choose a tag to compare

  • 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

05 Dec 09:50

Choose a tag to compare

  • Add REFERENCING transition tables support for triggers (OLD TABLE, NEW TABLE)

v0.7.0

05 Dec 09:24

Choose a tag to compare

  • 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

05 Dec 07:41

Choose a tag to compare

Breaking Changes

  • Renamed Trigger.table_schematarget_schema
  • Renamed Trigger.tabletarget_name
  • Renamed MigrationOp::DropTrigger fields 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 Trigger structs directly
  • Matches on MigrationOp::DropTrigger variants
  • Accesses trigger.table or trigger.table_schema fields

v0.5.0

05 Dec 06:48

Choose a tag to compare

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.sql

Features:

  • 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 pgmold

v0.4.0

05 Dec 06:11

Choose a tag to compare

Features

  • SERIAL column support: Automatically expand SERIAL, BIGSERIAL, and SMALLSERIAL columns to their underlying integer type + sequence
  • Sequence support: Full support for CREATE SEQUENCE including 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

02 Dec 06:00

Choose a tag to compare

  • Fix function body comparison producing false diffs due to dollar-quote delimiters.