Skip to content

Releases: xataio/pgroll

v0.13.0

27 May 10:05
27f9da6
Compare
Choose a tag to compare

⚡ Highlights

  • 🦆 New command: baseline to help integrate pgroll into existing databases
  • 🦧 migrate command fails early if there is an issue in a migration file

Read the release blog post for more details: https://pgroll.com/blog/pgroll-0-13-0-update

🔴 Breaking changes

  • 🎏 --name flag is removed from pgroll convert
  • 🐰 From now on pgroll uses the filename as the migration name. This, migration name cannot be set using name attribute in migration files. You must remove the attribute name from your new, unapplied migration files.

Changelog

  • db2a61f Add missing documentation link from README badge (#828)
  • 4e909cf Add test coverage for ReadMigration (#853)
  • d4f007b Change local docker-compose setup (#824)
  • 16173dd Document new constraint type in create_constraint: primary_key (#839)
  • 99819d6 Fail early in migrate if there is an incompatible migration file (#827)
  • 9fb0548 Fix JSON example in create_constraint documentation page (#840)
  • 5c0101b Fix backfill on tables with case sensitive names (#831)
  • 1b31daa Mark hidden commands in build-cli-definition tool (#847)
  • 675bfd2 New DBAction: AlterSequenceOwnerAction (#848)
  • a149a4f New DBAction: CreateCheckConstraintAction (#837)
  • 529d721 New DBAction: CreateFKConstraintAction (#843)
  • df51a33 New DBAction: DropConstraintAction (#849)
  • cabb623 New DBAction: ValidateConstraintAction (#838)
  • cc8fa32 Refactoring of writing migrations to file (#821)
  • 052ab79 Remove --name flag from pgroll convert (#851)
  • 2982cf7 Remove redundant pgroll.internal parameter (#823)
  • 3160548 Remove support for the name field in migrations (#852)
  • 034cb1e Simplify README.md (#825)
  • 27f9da6 Stop setting name field for inferred migrations (#854)
  • 7241a55 Use DropTableAction in create_table operation (#836)
  • 2aee64f [baseline] Add pgroll baseline command (#832)
  • 4d9bc1b [baseline] Add docs for the pgroll baseline command (#844)
  • 32bfe51 [baseline] Make pgroll migrate baseline-aware (#834)
  • 149d0ce [baseline] Make pgroll pull pull only migrations after the most recent baseline (#833)
  • 50d690a [baseline] Make start and migrate fail on non-empty schema without migration histories (#835)
  • 0290c11 [baseline] Unhide the pgroll baseline comand (#846)

v0.12.0

09 May 12:56
a8ab934
Compare
Choose a tag to compare

⚡ Highlights

  • 🪐 New command: create to create migrations interactively
  • 🐃 New flag --verbose is added to migrator commands (start, complete, rollback and migrate)
  • 🎍 pull fetches only migrations that do not exist in the target migrations folder

Read the release blog post for more details: https://pgroll.com/blog/pgroll-0-12-0-update

🔴 Breaking changes

  • migrate command no longer fails if there is an ongoing migration in your database
  • pull command outputs migration files in YAML instead of JSON. If you want to stick with JSON files, set the flag --json

Thank you for reporting issues and suggesting improvements!

Changelog

  • 49bf500 Add an extra test case for missing local migrations (#818)
  • a8ab934 Add documentation for create subcommand (#820)
  • b77c05c Add logger interface for migrations and implement it (#807)
  • 34c19af Add new command: create to add new migrations (#815)
  • 9249605 Add new guide to documentation: Use pgroll with ORMs (#816)
  • 94a5e7f Add new page to documentation titled "Why use pgroll?" (#806)
  • 0acb636 Add verbose logging (#804)
  • ecdc59d Bump github.com/testcontainers/testcontainers-go from 0.36.0 to 0.37.0 (#802)
  • b74a551 Bump github.com/testcontainers/testcontainers-go/modules/postgres from 0.36.0 to 0.37.0 (#803)
  • 07c6ff7 Bump golang.org/x/tools from 0.31.0 to 0.32.0 (#792)
  • 0d3f57d Bump golang.org/x/tools from 0.32.0 to 0.33.0 (#813)
  • e028d24 Default pgroll pull to write in YAML format and add a --json flag (#810)
  • 8db5ad7 Extract Concepts to left menu (#797)
  • 481e5a7 Extract Installation to the left menu (#796)
  • fcf713e Fix formatting of log message args in verbose mode (#817)
  • f1c7805 Idempotent migrate command (#805)
  • d697c70 Implement dropping indexes as DBAction (#793)
  • 07ba13c Implement dropping tables as DBAction (#794)
  • 542db44 Make pgroll pull and pgroll migrate command able to handle incompatible migration file formats (#812)
  • dc239eb Make pgroll pull pull only migrations that don't exist in target directory (#811)
  • 7f979fe New constraint type in create_constraint: primary_key (#698)
  • 7669ae2 Remove name field from all examples (#801)
  • 02b1da7 Remove duplicated initialization checks across subcommands (#819)
  • 0044c10 Remove section about client application from front page of the docs (#808)
  • 445696d Rewrite the front page of the docs (#809)
  • 55cf3a8 Update pg_query_go dependency to fix compilation on MacOS 15.4 (#799)

v0.11.1

14 Apr 12:05
3922f45
Compare
Choose a tag to compare

⚡ Highlights

🔍 Column comments and default values are preserved when a table is created in a multi-operation migration
🛹 Valid SQL statement is generated when duplicating columns during multi-operation migrations

Changelog

  • 95d8794 Add JSON docs back with tabs (#787)
  • 3922f45 Add missing attributes to column info in virtual schema (#789)
  • 08c7e01 Pass all column attributes to new temporary column when adding a new one to the table (#788)

Full Changelog: v0.11.0...v0.11.1

v0.11.0

08 Apr 14:28
97f632f
Compare
Choose a tag to compare

⚡ Highlights

🔌 Support for YAML migrations files
🍠 name attribute in migrations are no longer required
🎻 Tables without primary key or unique column can be backfilled

Thanks to first time contributors ❤️ 🙏 :

What's Changed

  • Update to Go 1.24 by @andrew-farries in #701
  • Docs preview by @richardgill in #703
  • Improve error message during JSON unmarshalling by @andrew-farries in #705
  • Docs preview Fork fix by @richardgill in #707
  • Bump golang.org/x/tools from 0.30.0 to 0.31.0 by @dependabot in #713
  • Bump github.com/spf13/viper from 1.19.0 to 1.20.0 by @dependabot in #731
  • Fix SQL formatting by @andrew-farries in #733
  • Rename generate and format jobs by @andrew-farries in #734
  • Fix example link in the documentation by @andrew-farries in #735
  • Fix rename column docs by @andrew-farries in #736
  • Bump github.com/containerd/containerd from 1.7.20 to 1.7.27 by @dependabot in #732
  • Add link to documentation in pgroll --help command by @kvch in #738
  • Update pgroll.com docs versions on release by @andrew-farries in #737
  • Introduce DBAction interface and refactoring of column dropping by @kvch in #709
  • Add convert.mdx to docs/config.json by @andrew-farries in #743
  • Improve error messages when pgroll init has not been run by @andrew-farries in #745
  • Implement rename column actions as DBAction by @kvch in #746
  • Implement creating triggers as DBAction by @kvch in #749
  • Make name field in migration JSON optional by @andrew-farries in #744
  • Docs Previews: No auto merge creating deployment by @richardgill in #753
  • Add rename constraint action as DBAction by @kvch in #752
  • Use license-header-checker locally to add missing license headers by @kvch in #748
  • sql2pgroll: Ignore IF NOT EXISTS in CREATE TABLE statement conversion by @andrew-farries in #754
  • Implement dropping functions as DBAction by @kvch in #750
  • Add support for comments as DBAction by @kvch in #757
  • Docs Previews: /docs/ -> /docs-preview/ by @richardgill in #756
  • Convert pgroll.migrations created_at and updated_at fields to use timestamptz type by @andrew-farries in #758
  • Initialize YAML migration file support by @kvch in #755
  • sql2pgroll: Ignore IF NOT EXISTS in CREATE INDEX statement conversion by @andrew-farries in #759
  • Dont require database access to pgroll latest --local by @andrew-farries in #760
  • Set Postgres application_name for pgroll's migrator and state connections by @andrew-farries in #762
  • Delete redundant .github/Dockerfile by @andrew-farries in #763
  • Implement creating a unique index concurrently as a DBAction by @kvch in #747
  • Implement create table as a DBAction by @kvch in #764
  • Bump github.com/spf13/viper from 1.20.0 to 1.20.1 by @dependabot in #769
  • Bump github.com/testcontainers/testcontainers-go/modules/postgres from 0.35.0 to 0.36.0 by @dependabot in #767
  • Use sigs.k8s.io/yaml to parse YAML migration files by @kvch in #771
  • Replace JSON examples with YAML && use them in docs by @kvch in #772
  • Transform JSON structure descriptions and examples to YAML by @kvch in #773
  • Add new group Guides and add a guide for writing up and down expresions by @kvch in #775
  • Remove the unnecessary file parameter from the help text by @kvch in #780
  • Add callout to sql migration documentation about down migrations by @kvch in #782
  • Improve error message when start and rollack fails by @kvch in #781
  • Add fallback method for backfilling records by @kvch in #779
  • Create a separate guide for integrating pgroll into your project by @kvch in #783

New Contributors

Full Changelog: v0.10.0...v0.11.0

v0.10.0

28 Feb 14:26
bd6134d
Compare
Choose a tag to compare

⚡ Highlights

  • 🚎 Improve integration with ORMs: new subcommand convert to translate ORM SQL migrations scripts into pgroll migrations
  • 🏄 Avoid ACCESS_EXCLUSIVE table lock when adding UNIQUE columns
  • 🔓 Avoid ACCESS_EXCLUSIVE table lock when adding volatile DEFAULTs to columns

Thanks to first time contributors 🙏 ❤️ :

🔴 Breaking changes

Previously, create_index expected a list of strings in columns:

{
  "name": "10_create_index",
  "operations": [
    {
      "create_index": {
        "table": "employees",
        "columns": ["salary"]
      }
    }
  ]
}

To support advanced index field settings like sort, null, collate and opclass, columns must be a map:

{
  "name": "10_create_index",
  "operations": [
    {
      "create_index": {
        "table": "employees",
        "columns": {
          "salary": {}
        }
      }
    }
  ]
}

Changelog

  • 5410020 Add columns with volatile DEFAULTs without an ACCESS_EXCLUSIVE table lock (#694)
  • 346f7f9 Add new command convert to convert SQL migrations to pgroll operations (#685)
  • ab567b6 Add support for no_inherit on column level constraints and in create_constraint operation (#670)
  • 8791a93 Add unique column without exclusive lock (#679)
  • f3432da Alter sequence owner before dropping the column (#668)
  • 81eee8b Bump github.com/spf13/cobra from 1.8.1 to 1.9.1 (#688)
  • 1107841 Bump golang.org/x/tools from 0.29.0 to 0.30.0 (#672)
  • 9a3eaed Error out if table/column is missing (#681)
  • 331c25f Handle errors in UpdateVirtualSchema (#693)
  • 7b383dc Improve create_index operation with extra index element settings (#697)
  • d697304 Improve validation of create_table and add_column operations (#666)
  • 3e21e4d Make backfill batch selection exclude rows inserted or updated after backfill start (#652)
  • cad53be Move ConstraintSQLWriter to a separate file (#665)
  • cd19f8a Move backfill options to start and migrate command (#660)
  • bd6134d Publish convert command and add new documentation page (#700)
  • e337b62 Re-read schema in between operations during migration completion (#692)
  • 136ee5f Remove hidden command sql (#687)
  • 9dffe02 Remove the WithSQLTransformer option (#696)
  • 5158568 Rename testcases (#691)
  • bc24f9e Support parsing multiple SQL statements in sql2pgroll.Convert (#690)
  • 97dbca2 Support table and column rename operations preceding create_constraint FOREIGN KEY operations (#682)
  • 1f26ef1 Support table and column rename operations preceding create_constraint UNIQUE operations (#676)
  • 1558ef7 Support table and column rename operations preceding create_constraint operations (#674)
  • d927f3e Support table and column rename operations preceding drop_multicolumn_constraint operations (#684)
  • 2786cc2 Update Operation.Start signature to remove callbacks parameter (#675)
  • e4d2408 Use -tags=netgo,osusergo when building pgroll binary (#699)
  • cacc250 Use sql2pgroll.Convert in convert command to translate SQL statements from migration file and stdin (#695)

v0.9.0

10 Feb 14:14
53db794
Compare
Choose a tag to compare

⚡ Highlights

  • 🥇 Table level constraints are now supported in create_table operations. CHECK, UNIQUE, FOREIGN KEY, PRIMARY KEY and EXCLUDE constraints are all supported (#580)
  • 🧞 It's now possible to create GENERATED columns in create_table and add_column operations (#605)
  • 🕐 Progress updates during backfill operations now include percentage complete

🔴 Breaking changes

Previously, alter_column operations were used to rename a column, like this:

{
  "name": "13_rename_column",
  "operations": [
    {
      "alter_column": {
        "table": "employees",
        "column": "role",
        "name": "job_title"
      }
    }
  ]
}

This method of renaming a column is no longer supported; the new rename_column operation should be used instead. The same migration is now written:

{
  "name": "13_rename_column",
  "operations": [
    {
      "rename_column": {
        "table": "employees",
        "from": "role",
        "to": "job_title"
      }
    }
  ]
}

Changelog

  • 895afe4 Add OpRenameColumn for renaming columns (#602)
  • 43381e9 Add constraints option to create_table and unique constraint support (#585)
  • e35cc69 Add defer rows.Close() to getRowCount function (#614)
  • bbdb2f8 Add onUpdate and matchType to the output of analyze/read_schema (#654)
  • c451b8d Add a multi-column test case for CREATE TABLE (#563)
  • c0dc021 Add exclusion constraints to analyze/read_schema (#658)
  • 49e35c4 Add extra validation checks to OpRenameColumn (#615)
  • 957498d Add links to the docs on pgroll.com (#523)
  • baa4513 Add missing index renaming when completing a migration (#577)
  • 67f4a08 Add missing indexes to duplicated columns (#570)
  • 7478d84 Add missing match type setting to ConstraintSQLWriter (#650)
  • 53db794 Add missing options to duplicated FK constraints (#671)
  • cb0c1e2 Add pg type type info to schema (#592)
  • c237001 Add script to generate CLI structure (#629)
  • 11b6454 Add subtitles to benchmark charts. (#522)
  • e919085 Add support for CHECK constraints in create_table operation (#588)
  • f078a91 Add support for NOT VALID in constraint writer (#649)
  • 5b42f80 Add support for alter_table change type operations in multi-operation migrations (#661)
  • 0e815ec Add support for alter_table drop NOT NULL operations in multi-operation migrations (#626)
  • cec0d80 Add support for alter_table set NOT NULL operations with create_table operations (#608)
  • af0eccd Add support for alter_table set NOT NULL operations with rename_column operations (#607)
  • db8123b Add support for alter_table set NOT NULL operations with rename_table operations (#606)
  • c09619a Add support for alter_table set check operations in multi-operation migrations (#622)
  • bcb429f Add support for alter_table set default operations in multi-operation migrations (#616)
  • db21651 Add support for alter_table set references operations in multi-operation migrations (#621)
  • a9b35b5 Add support for alter_table set unique operations in multi-operation migrations (#609)
  • ee84b88 Add support for create_index operations in multi-operation migrations (#662)
  • 05ab88c Add support for exclusion constraints in create_table operation (#624)
  • b40621b Add support for foreign key constraints in create_table operation (#597)
  • 5df19ff Add support for primary key constraints in create_table operation (#594)
  • 9fedb2c Allow INITIALLY IMMEDIATE constraints in CREATE TABLE statements (#560)
  • ca094f5 Allow some named inline column constraints in CREATE TABLE statements (#559)
  • cde22df Build CGO_ENABLED binaries for supported platforms in the release job (#527)
  • 110e8e8 Bump github.com/testcontainers/testcontainers-go from 0.34.0 to 0.35.0 (#612)
  • fd074b5 Bump github.com/testcontainers/testcontainers-go/modules/postgres from 0.34.0 to 0.35.0 (#611)
  • ef07810 Bump golang.org/x/crypto from 0.25.0 to 0.31.0 (#528)
  • 0b29fcf Bump golang.org/x/tools from 0.27.0 to 0.28.0 (#519)
  • e6e2ee5 Bump golang.org/x/tools from 0.28.0 to 0.29.0 (#569)
  • 1038bc2 Change CREATE TABLE DEFAULT constraint handling (#561)
  • 95f9eb2 Convert ADD COLUMN SQL into pgroll operations (#544)
  • 4a31b06 Convert ADD CONSTRAINT SQL into OpCreateConstraint operations for foreign keys (#531)
  • e6e4523 Convert CREATE INDEX SQL into pgroll operation (#551)
  • d1db25d Convert DROP COLUMN SQL to pgroll operation (#521)
  • f4c17ff Convert DROP CONSTRAINT SQL into OpDropMultiColumnConstraint operations (#536)
  • ac222a4 Convert DROP INDEX SQL to pgroll operation (#524)
  • 51b2641 Convert DROP TABLE SQL to pgroll operation (#529)
  • 5450d7a Convert SQL CREATE TABLE inline CHECK constraints (#552)
  • be145b1 Convert ALTER TABLE ... ADD CONSTRAINT ... CHECK SQL to pgroll operation (#538)
  • 6dd898a Convert column DEFAULTs in CREATE TABLE statements (#553)
  • b65d850 Convert column FOREIGN KEYs in CREATE TABLE (#554)
  • e1ba0af Convert schema-qualified CREATE TABLE statements (#557)
  • 09e2fd4 Expose foreign key constraint options in inline FK definition and in create_constraint (#653)
  • 3d0b93f Fall back to SQL for unconvertible column constraint options in CREATE TABLE statements (#550)
  • 627b64e Fall back to raw SQL for GENERATED columns in CREATE TABLE statements (#555)
  • 783d282 Fix ALTER TABLE ADD COLUMN default nullability (#558)
  • 3c1a5fa Fix sql2pgroll conversion of string DEFAULT expressions (#532)
  • 177de22 Fix adding extra unique constraint to columns that are already unique (#579)
  • 52d3c95 Fix diagram images (#543)
  • 747f9d4 Fix previous_version: Take inferred migrations into account (#631)
  • d141492 Forbid adding generated columns to existing tables (#637)
  • c64edc6 Handle DEFERRABLE and NOT DEFERRABLE constraints in CREATE TABLE statements (#556)
  • b727101 Handle more unconvertible CREATE TABLE statements (#547)
  • d507dbe Handle unconvertible CREATE TABLE column defintions (#548)
  • a849534 Handle unconvertible CREATE TABLE statements (#546)
  • d933a4f Handle unconvertible CREATE TABLE table constraints (#549)
  • 5c44365 Make migrations_test.go tests consistent with other tests in pkg/migrations (#568)
  • 5e8c6db Move backfill code from pkg/migrations to new pkg/backfill package (#627)
  • 4156bc6 Multi-operation migration support for add_column operations (#590)
  • e689a12 Multi-operation migration support for alter_column rename operations (#593)
  • 9a37ea8 Multi-operation migration support for create_table operations (#596)
  • 9118345 Multi-operation migration support for drop_column operations (#591)
  • 5a6f508 Multi-operation migration support for drop_table operations (#587)
  • de56b35 New option for columns: generated (#605)
  • bbe471d Pin Goreleaser version to 2.5.1 (#617)
  • 829586e Reduce duplication between CREATE TABLE and ADD COLUMN SQL conversion (#562)
  • f801b7f Remove ElseExpr and TestExpr from trigger templates (#651)
  • 3657bb5 Remove the ability to rename columns with alter_column operations (#603)
  • f270169 Rename ForeignKeyReferenceOnDelete to ForeignKeyAction (#639)
  • 070e388 Retry creating unique index (#613)
  • 9ebb691...
Read more

v0.8.0

10 Dec 08:28
12acbde
Compare
Choose a tag to compare

⚡ Highlights

  • 🔑 Support for multi-column primary keys (#413, #426)
  • 🤸‍♂️ Support for multi-column UNIQUE, CHECK and FOREIGN KEY constraints (#487, #464, #471, #466, #459)
  • 📇 Support for more index types (#417, #442)
  • 💧 Support dropping DEFAULT constraints on columns (#478)
  • ⚡ New CLI commands:
    • pgroll migrate: apply outstanding migrations to the target database (#465)
    • pgroll latest: display the most recent schema version in the target database or local migrations directory (#469)
    • pgroll pull: pull the migration history from a target database and dump it to disk. (#463)
  • 🚤 Performance benchmarks, see them here (#472, #412)

Read the full release notes on the pgroll.com blog

🔴 Breaking changes

The format of the drop_constraint operation has changed to remove the column field. Column names should no longer be specified when dropping a constraint. This means that migrations like this must be updated to remove the column field:

{
  "name": "23_drop_check_constraint",
  "operations": [
    {
      "drop_constraint": {
        "table": "posts",
        "column": "title",     <-- should be removed
        "name": "title_length",
        "column": "title",
        "up": "title",
        "down": "(SELECT CASE WHEN length(title) <= 3 THEN LPAD(title, 4, '-') ELSE title END)"
      }
    }
  ]
}

Changelog

  • 0992c8d Add --skip-validation flag to start command (#448)
  • 85e917c Add pgroll migrate subcommand (#465)
  • b6fff69 Add a .ledger file which is built by make examples (#445)
  • 9c9518b Add a drop_multicolumn_constraint operation (#487)
  • 5a49929 Add a healthcheck to the db service in docker-compose.yml (#452)
  • eaaabf9 Add a pgroll latest command (#469)
  • 30d131e Add a pgroll pull subcommand (#463)
  • 1f6f49b Add a sql2pgroll package to convert SQL to pgroll migrations (#502)
  • 481f1c6 Add a benchmark for read_schema (#472)
  • fd94011 Add a config.json file for docs website (#500)
  • 86e02c5 Add and use a table cleanup assertion function (#493)
  • b6f76c7 Add backfill benchmarks (#412)
  • 898bd84 Add enum column examples (#444)
  • 68578f2 Add missing group by (#456)
  • 12ae369 Add support for composite keys in create table statements (#413)
  • d231ee0 Add support for creating CHECK constraints with create_constraint (#464)
  • a9b2048 Add support for creating foreign key constraints using create_constraint (#471)
  • ac1dd85 Add support for creating unique indexes (#442)
  • 171f5a2 Allow adding a column to a table created in the same migration (#449)
  • c677bbe Allow adding an index to a table created in the same migration (#451)
  • 1650210 Allow adding indexes to columns created in the same migration (#454)
  • 929ea27 Always surround up and down clauses in parentheses (#481)
  • 3c7b74b Avoid running all CI steps twice (#433)
  • 860f5a9 Build static HTML page using the latest benchmark results (#467)
  • 06d651b Bump github.com/pterm/pterm from 0.12.69 to 0.12.79 (#424)
  • 43a6d97 Bump github.com/pterm/pterm from 0.12.79 to 0.12.80 (#501)
  • 74a6fb5 Bump github.com/stretchr/testify from 1.9.0 to 1.10.0 (#486)
  • 388d0b5 Bump github.com/testcontainers/testcontainers-go/modules/postgres from 0.33.0 to 0.34.0 (#422)
  • 4468211 Bump golang.org/x/tools from 0.21.1-0.20240508182429-e35e4ccd0d2d to 0.26.0 (#425)
  • 0e34f78 Bump golang.org/x/tools from 0.26.0 to 0.27.0 (#460)
  • 0a282a2 Change SQL fomatting tool to pgformatter (#477)
  • e02c4a2 Change type of Column.Nullable from *bool to bool (#496)
  • 491927c Change type of Column.Pk from *bool to bool (#495)
  • d1daf8f Change type of Column.Unique from *bool to bool (#497)
  • 9626c20 Configure dependabot (#421)
  • 06bfebd Convert ALTER TABLE foo ADD CONSTRAINT bar UNIQUE (a) SQL to pgroll operation (#507)
  • 3512f76 Convert ALTER TABLE foo RENAME TO bar SQL to pgroll operation (#513)
  • 84661eb Convert DROP NOT NULL SQL to pgroll operation (#505)
  • d94d3b4 Convert RENAME COLUMN to pgroll operation (#511)
  • 34b623f Convert RENAME CONSTRAINT SQL to pgroll operation (#514)
  • c756988 Convert SET DATA TYPE SQL to pgroll operation (#506)
  • 7849864 Defer close of migration file (#430)
  • 96e50f9 Don't add series for missing row count (#474)
  • 5d63a7f Duplicate unique and check constraints correctly (#466)
  • 6ff198b Expand operation reference docs (#516)
  • f628060 Explicitly add Postgres 17 checks before merge into main (#415)
  • 88cc975 Extract initialisation SQL into separate file (#435)
  • 0b08a1d Fix read_schema function for multi-column foreign key constaints (#476)
  • eef4a9b Fix ledger file in examples folder (#447)
  • 8469bad Fix some command short descriptions (#470)
  • 6d48386 Handle scan and close errors in SchemaHistory (#482)
  • db74779 List enum types when reading schema (#443)
  • 5b7980d Make ALTER TABLE foo ALTER COLUMN a SET DATA TYPE text options unrepresentable (#508)
  • 2f637c3 Make check-ledger job required for release (#517)
  • 01ff6ac Move pkg/testutils and pkg/jsonschema into internal (#418)
  • b03cef2 Move validation testcases for op_create_constraint to a separate test (#494)
  • 7130506 New command: bootstrap (#414)
  • a5fb72e New operation: create_constraint and support unique constraints with multiple columns (#459)
  • e044c56 Persist benchmark results in CI (#461)
  • 7c01085 Quote schema when running ReadSchema (#419)
  • 06e69c2 Refactor docs (#510)
  • 999a299 Remove Column field from DropConstraint (#431)
  • 358c6c6 Remove pgroll sql subcommand (#515)
  • f85bca4 Remove unused operation names (#503)
  • a7f3e3c Remove unused parameter (#483)
  • 3b8c56e Rename and move test variables relating to sql2pgroll (#512)
  • 813b0a1 Respect context cancellation when backing off (#437)
  • ddd44bb Respect context deadline during batch backfill (#438)
  • 12acbde Run the build workflow on tag push (#520)
  • 7bc6eb8 Small cleanups (#484)
  • 1279b7d Small docs change to thecreate_constraint operation (#488)
  • fdebf23 Split docs/README.md into multiple files (#499)
  • e2f1740 Support creating different index types (#417)
  • 81dd0a7 Support dropping default for a column (#478)
  • b02c324 Support multiple PKs during backfilling (#426)
  • c35070a Tweak Makefile (#436)
  • 2d2b4a0 Up not required when adding serial columns (#432)
  • 434cf36 Update docs with deprecation notice (#498)
  • 416fb7a Update schema during add column validation (#457)
  • d656387 Update schema during create table validation (#455)
  • 0d3e17d Update tutorial with new sections (#509)
  • 7655f53 Use ubuntu 24.04 as the runner in all workflows (#518)
  • 515dd54 Use filepath.Glob in bootstrap (#416)
  • 0b5646d Validate check name is unique (#429)
  • 37a7232 Validate maximum identifier length (#439)
  • 9922e5f Validate that FK constraint name is unique (#428)
  • d00dd1e Validate that unique constraint name is unique (#427)
  • 4f484fc deps: Upgrade cobra and viper (#420)

v0.7.0

16 Oct 15:03
7d88c25
Compare
Choose a tag to compare

⚡ Highlights

💻 Add support for Postgres 17 (#387)
🚤 Improve backfill performance by up to 80% (#389)
📦 Allow configuration of the batch size during backfills with the --backfill-batch-size flag (#406)
🐢 Allow configuration of a delay between each batch during backfills with the --backfill-batch-delay flag (#410)
🧩 Add support for creating partial indexes in create_index operations (#404)
💭 Capture CREATE / DROP schema statements as inferred migrations (#359)
⏫ Use of pgroll as a Go module now requires Go 1.23 (#397)
🔍 Distinguish inferred migrations by timestamp for statements within the same transaction (#362)
❓ Add a WithNoVersionSchemaForRawSQL Go module option to control creating version schemas for raw SQL migrations (#365)
🔎 Add a WithSearchPath Go module option to allow widening the Postgres search path during migration execution (#380)

Thanks to first time contributors 🙏 ❤️ :

Changelog

v0.6.0

17 May 13:43
a87fa36
Compare
Choose a tag to compare

⚡ Highlights

🪝 Add support for 'hooks' so that users using pgroll as a Go module can customize its behaviour (#290, #335)
🚥 Backoff and retry DDL and DML operations on lock_timeout errors (#353)
🔗 Run all DDL operations before running any DML (data backfills) during migration start (#289)
✖️ Support changing multiple column properties in one alter_column operation (#338)
🖊️ Support rewriting or rejecting user-defined SQL using transformers when using pgroll as a Go module (#329, #332).
🫱 Allow changing column default values (#346)
📛 Support for renaming constraints. (#293)
✅ Allow raw SQL migrations to be run on migration completion instead of start (#280).
🔑 Allow setting the ON DELETE behaviour of foreign key constraints (#297)

Changelog

  • 63d5a7f Add CI step to validate examples against the JSON schema (#301)
  • 58fa7ae Add SQL onComplete flag, allow sql migration to run with others (#280)
  • 0f75224 Add Roll.Schema method (#299)
  • 8ed5799 Add WithRawSQLURL to configure an optional URl for raw sql operations (#315)
  • 577870c Add rename_constraint operation (#293)
  • eda936f Add rename_constraint operation to PgRollOperation JSON schema definition (#300)
  • 4fbfdf7 Add a 'set comment' sub-operation to 'alter column' (#344)
  • afad3d8 Add a 'set default' sub-operation to 'alter column' (#346)
  • cc8c2d3 Add a WithSQLTransformer option to rewrite user-defined SQL in up and down triggers (#329)
  • d5d4bea Add complete phase hooks (#335)
  • fb05aec Add extra validation for the rename_constraint operation (#303)
  • 431b951 Add testcase to ensure new columns can't be used as the the identity column in a backfill. (#298)
  • c08ef70 Add two new options to help with replication control (#290)
  • 7d8460f Allow rename-only 'alter-column' operations on unbackfillable columns (#341)
  • def08e2 Allow setting the ON DELETE behaviour of foreign key constraints (#297)
  • 51de6d4 Bump golangci-lint action to v4 (#287)
  • 3e49151 Bump github.com/docker/docker from 24.0.7+incompatible to 24.0.9+incompatible (#324)
  • 37d2c28 Bump golang.org/x/net from 0.20.0 to 0.23.0 (#343)
  • 14a2217 Bump google.golang.org/protobuf from 1.31.0 to 1.33.0 (#319)
  • 2932ea3 Disallow unknown fields in migration JSON (#334)
  • 4c1bc6a Dont duplicate CHECK constraints and DEFAULTs when altering column type (#349)
  • 162bd06 Fix duplicate inferred migrations when dropping columns outside of a migration (#305)
  • 0aebb50 Fix error message of column rename (#292)
  • 161fde6 Fix hardcoded pgroll schema in state initialization (#284)
  • 52fb532 Format schema.json on generate (#294)
  • 4d3faeb Make down SQL in rename column operations use the new name of the column (#354)
  • 6e4ee68 Make name not required in PgRollMigration (#282)
  • b4e3044 Make state initialization concurrency safe (#285)
  • f5d09d5 Move example schema validation to its own job (#318)
  • 79566b0 Preserve comments on column duplication (#323)
  • 547ac3e Preserve foreign key ON DELETE attributes when FK columns are duplicated (#314)
  • d4445bb Refactor alter column suboperations (#337)
  • 16377ca Relax add_column requirements on pk (#286)
  • 937f65c Relax backfill requirements so it works with unique columns (#288)
  • 297dd38 Remove BeforeBackfill hook (#312)
  • f6cacf7 Respect foreign key ON DELETE in add column and create table operations (#308)
  • a444723 Restrict state connection search path (#342)
  • 5c1aef2 Retry on lock_timeout errors (#353)
  • 944ebed Revert: Add WithRawSQLURL to configure an optional URl for raw sql operations (#333)
  • 6334cb4 Rewrite column DEFAULTs using the SQL transformer (#332)
  • 0673b1b Rewrite raw SQL operations using a SQL transformer (#330)
  • 631d642 Rollback on backfill failure (#317)
  • 0746ba6 Separate DDL operations from DML (backfills) on migration start (#289)
  • 130f451 Strengthen SQL transformation tests (#331)
  • a87fa36 Support create/drop index with uppercase names (#356)
  • a4222d8 Support multiple 'alter column' sub operations (#338)
  • 4f0a715 Support setting table and column comments to NULL (#345)
  • c88c060 Track foreign key ON DELETE setting in the internal schema representation (#311)
  • a7d5095 Update banner images and logo colors (#307)
  • 099a443 Update documentation for foreign key options (#310)
  • cf66d1f Update operation types to set a default of "" for up and down SQL (#325)

v0.5.0

09 Feb 13:00
889946b
Compare
Choose a tag to compare
  • ❌ Extend the alter_column operation to allow dropping NOT NULL constraints from columns [docs]
  • 💬 Add support for adding comments to tables and columns at creation time [docs]
  • 🔑 Correctly preserve column constraints when duplicating columns for backfilling [issue]
  • 🐛 Ensure that the drop_column operation works for tables and columns with reserved words as names
  • 🦺 Update the JSON schema for migration operations to more accurately reflect required and optional fields

Changelog

  • f1757f3 Add CI check for up-to-date type generation (#225)
  • d00d804 Add JSON schema tests (#263)
  • eed4e4e Add JSON schema validation tests for 'sql' operations (#266)
  • 70a7c8e Add CHECK constraints to pgroll's internal schema representation (#241)
  • 994a1aa Add UNIQUE constraints to pgroll's internal schema representation (#242)
  • f798ba5 Add a CI check for unreachable code using deadcode (#251)
  • 73c2016 Add a way to set postgres role when executing migrations (#226)
  • b9e7819 Add drop NOT NULL operation to remove NOT NULL from a column (#258)
  • 9d25159 Add fields to GROUP BY clauses in read_schema function (#255)
  • 025a38f Add missing comment to field (#229)
  • 61cc53a Add support for creating tables and columns with comments (#224)
  • dde27eb Add test: check column DEFAULTs preserved on set NOT NULL (#235)
  • 66ccf91 Add unique & FK constraints info to the schema (#218)
  • 83b5d76 Allow to disable version schemas (#233)
  • 4450862 Bump actions/checkout to v4 (#272)
  • 72cc155 Bump github.com/containerd/containerd from 1.7.3 to 1.7.11 (#217)
  • c5a3dbd Bump github.com/opencontainers/runc from 1.1.5 to 1.1.12 (#260)
  • 4b124b0 Change Complete method signature (#231)
  • 355ac20 Correctly quote table and column names in the drop column operation (#254)
  • 14e3d1b Ensure constraint existence as part of validation for the drop constraint operation (#252)
  • 7e65cda Fix inferred migrations format (#259)
  • c10dabf Fix pgroll migration definition (#216)
  • bb79eec Fix raw SQL migrations spec in schema.json (#264)
  • 7a38e1f Identify duplicated foreign key constraints by prefix (#245)
  • b2e93a9 Improve MustNotInsert test assertions (#243)
  • 7b5fafd Improve constraint assertions (#240)
  • 908485f Include key columns for an index in the internal schema representation (#248)
  • c95bc78 Parameterize schema in which migration tests run via PGROLL_TEST_SCHEMA env var (#276)
  • 68c5fbf Preserve CHECK constraints on duplication (#244)
  • 7c1167a Preserve NOT NULL attributes on column duplication (#246)
  • 9e9eeaf Preserve UNIQUE constraints on column duplication (#250)
  • ddb91d1 Preserve column properties on add CHECK constraint operation (#236)
  • 4928cf1 Preserve column properties on add FOREIGN KEY constraint operation (#238)
  • 7b7caa0 Preserve column properties on add UNIQUE constraint operation (#237)
  • 04de471 Preserve column properties on drop constraint operation (#253)
  • d803689 Preserve default on column duplication when changing column type (#234)
  • b81c42c Preserve foreign key constraints on columns duplicated for backfilling (#230)
  • fc7370f Preserve foreign key constraints when changing a column's type (#232)
  • 4bee7ac Record index uniqueness in pgroll's internal schema representation (#247)
  • 7fd8c7c Remove RAISE NOTICE statements (#256)
  • 82b7937 Remove unused function (#228)
  • 7404ddf Run go-jsonschema container with --rm (#267)
  • 889946b Run migration tests in a non-public schema as part of CI (#279)
  • 5686ddc Strengthen assertions for tests that check preservation of UNIQUE constraints (#277)
  • e906da7 Strip schema from index names in internal schema representation (#278)
  • a5cf473 Take go version from go mod version in buid workflow (#271)
  • d06a0af Update JSON schema to specify that not all Column fields are required (#265)
  • 5a6a83a Update schema.json to correctly describe the 'alter column' operation (#261)
  • 9586b44 Update state command to avoid returning nulls (#274)
  • 0cc62c1 docs/readme: broken code syntax (#270)