⚡ Highlights
- 🥇 Table level constraints are now supported in
create_table
operations.CHECK
,UNIQUE
,FOREIGN KEY
,PRIMARY KEY
andEXCLUDE
constraints are all supported (#580) - 🧞 It's now possible to create
GENERATED
columns increate_table
andadd_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 tocreate_table
andunique
constraint support (#585) - e35cc69 Add
defer rows.Close()
togetRowCount
function (#614) - bbdb2f8 Add
onUpdate
andmatchType
to the output ofanalyze
/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 increate_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
dropNOT NULL
operations in multi-operation migrations (#626) - cec0d80 Add support for
alter_table
setNOT NULL
operations withcreate_table
operations (#608) - af0eccd Add support for
alter_table
setNOT NULL
operations withrename_column
operations (#607) - db8123b Add support for
alter_table
setNOT NULL
operations withrename_table
operations (#606) - c09619a Add support for
alter_table
setcheck
operations in multi-operation migrations (#622) - bcb429f Add support for
alter_table
setdefault
operations in multi-operation migrations (#616) - db21651 Add support for
alter_table
setreferences
operations in multi-operation migrations (#621) - a9b35b5 Add support for
alter_table
setunique
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 inCREATE TABLE
statements (#560) - ca094f5 Allow some named inline column constraints in
CREATE TABLE
statements (#559) - cde22df Build
CGO_ENABLED
binaries for supported platforms in therelease
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
inlineCHECK
constraints (#552) - be145b1 Convert
ALTER TABLE ... ADD CONSTRAINT ... CHECK
SQL topgroll
operation (#538) - 6dd898a Convert column
DEFAULT
s inCREATE TABLE
statements (#553) - b65d850 Convert column
FOREIGN KEY
s inCREATE 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 inCREATE TABLE
statements (#555) - 783d282 Fix
ALTER TABLE ADD COLUMN
default nullability (#558) - 3c1a5fa Fix
sql2pgroll
conversion of stringDEFAULT
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
andNOT DEFERRABLE
constraints inCREATE 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 inpkg/migrations
(#568) - 5e8c6db Move backfill code from
pkg/migrations
to newpkg/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
andADD COLUMN
SQL conversion (#562) - f801b7f Remove
ElseExpr
andTestExpr
from trigger templates (#651) - 3657bb5 Remove the ability to rename columns with
alter_column
operations (#603) - f270169 Rename
ForeignKeyReferenceOnDelete
toForeignKeyAction
(#639) - 070e388 Retry creating unique index (#613)
- 9ebb691 Reuse table level foreign key references in
create_constraint
fromcreate_table
(#640) - 6c5ee62 Rollback migration operations in reverse order (#586)
- 952fb23 Show completion estimate during backfill (#567)
- 9204268 Simplify fetching rows with composite primary keys during backfill (#595)
- 40b2991 Simplify percentage callback logic (#573)
- eadef66 Stop using pointers for
OpCreateIndex
fields (#565) - 5ec28da Support
create_table
,drop_table
,create_table
sequence of operations (#589) - ac10ab4 Test cross platform
pgroll
builds in the CI workflow (#525) - 5cff353 Unify table level foreign key conversion in
sql2pgroll
(#628) - 97ff17d Update
pg query go
dependency (#564) - e04850e Update docs for the
create_index
operation (#566) - 03879fe Use
omissis/go-jsonschema
image for type generation (#545) - 92244d9 Use
pg_query_go
to deparseTypeName
AST nodes (#542) - cf50739 Use
text/template
for backfill query generation (#632) - de49197 Use
xataio
fork ofpg_query_go
package (#534) - 91f65ea Use a helper function to get a fully qualified relation name (#540)
- 694d935 Use expression deparsing to convert column
DEFAULT
expressions (#535) - 0d88089 Use gofumpt in the
make format
rule (#541) - 1214e52 Use official
goreleaser/goreleaser-cross
image (#619) - 936391f Use official
goreleaser/goreleaser-cross
image for cross-platform builds (#604) - c4cd645 Use options pattern to configure backfill (#630)
- bd0fa1c Use original table name without prefix when processing create table (#572)
- daba767 Use pointers for
schema
andTable
struct fields (#574) - f429ee2 sql2pgroll: Support set and drop column defaults (#526)