⚡ Highlights
- 🔑 Support for multi-column primary keys (#413, #426)
- 🤸♂️ Support for multi-column
UNIQUE
,CHECK
andFOREIGN KEY
constraints (#487, #464, #471, #466, #459) - 📇 Support for more index types (#417, #442)
- 💧 Support dropping
DEFAULT
constraints on columns (#478) - ⚡ New CLI commands:
- 🚤 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 tostart
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 thedb
service indocker-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 topgroll
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 withcreate_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
tobool
(#496) - 491927c Change type of
Column.Pk
from*bool
tobool
(#495) - d1daf8f Change type of
Column.Unique
from*bool
tobool
(#497) - 9626c20 Configure dependabot (#421)
- 06bfebd Convert
ALTER TABLE foo ADD CONSTRAINT bar UNIQUE (a)
SQL topgroll
operation (#507) - 3512f76 Convert
ALTER TABLE foo RENAME TO bar
SQL topgroll
operation (#513) - 84661eb Convert
DROP NOT NULL
SQL to pgroll operation (#505) - d94d3b4 Convert
RENAME COLUMN
topgroll
operation (#511) - 34b623f Convert
RENAME CONSTRAINT
SQL topgroll
operation (#514) - c756988 Convert
SET DATA TYPE
SQL topgroll
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 the
create_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)