Skip to content

Tags: xataio/pgroll

Tags

v0.16.2

Toggle v0.16.2's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Update Golang to v1.26.3 (#1031)

v0.16.1

Toggle v0.16.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Eliminate multiple connection leaks (#1022)

This PR eliminates multiple connections leaks during `migrate`:

1. 2 leaked connections every time we backfilled a table
2. 1 leaked connection when checking if an index was valid
3. 1 leaked connection when looking up schema history

Closes #1020

v0.16.0

Toggle v0.16.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Fix `create_index` operation column ordering (#1009)

Change the `create_index` operation to take the columns on which the
index should be defined as an list rather than a map.

This ensures that the ordering of the columns in in the index is fixed
to the same order as they appear in the migration file.

**old format**

```yaml
# foo
operations:
  - create_index:
      name: some-index
      table: tickets
      columns:
        column1: {}
        column2: {}
```

**new format**

```yaml
operations:
- create_index:
    name: some-index
    table: tickets
    columns:
    - column: column1
      # options
    - column: column2
      # options
```

The changes in this PR are taken from
reve-ai#5 🙏

⚠️ This is a breaking change to the migration format ⚠️ 

We also modify the `pgroll update` command in this PR so that operations
in the old format can be migrated to the new format (although for
multi-column indexes the user will still have to ensure that the column
order in the updated migration is what they expected).

Fixes #1001

v0.15.0

Toggle v0.15.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Add `--expect-one` flag to `migrate` command (#1005)

Add an `--expect-one` flag to the `pgroll migrate` command to allow the
command to fail if there is more than one outstanding migration.

From the documentation added in this PR:

--- 

By default, `pgroll migrate` will apply all unapplied migrations.
However, it may sometimes be desirable to only apply a single migration
to ensure that an existing version schema is not removed by a sequence
of migrations. In this case, running:

```
$ pgroll migrate examples/ --expect-one
```

will cause the command to fail if more than one unapplied migration is
detected.

v0.14.3

Toggle v0.14.3's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Stop storing column defaults for `GENERATED` columns (#979)

Ensure that generated columns do not have `DEFAULT` values stored in
`pgroll`'s internal state representation.

Storing default values for generated columns causes breakage when column
defaults are applied to versioned views, because the expressions used by
generated columns are invalid as column defaults because they typically
reference other columns in the same table.

Postgres catalogs `pg_attribute` and `pg_attrdef` (where `pgroll` gets
column information from when introspecting the database.) **do** store a
generated column's expression as a default values for the column,
however the higher level system view `information_schema.columns` then
filters out default values for generated columns:

```sql
SELECT definition
    FROM pg_views
    WHERE schemaname = 'information_schema'
    AND viewname = 'columns';
```

```sql
# Postgres 17.5
SELECT (current_database())::information_schema.sql_identifier AS table_catalog,
  ...
   (
       CASE
           WHEN (a.attgenerated = ''::"char") THEN pg_get_expr(ad.adbin, ad.adrelid)
           ELSE NULL::text
       END)::information_schema.character_data AS column_default,
   )
  ...
```

This PR makes `pgroll` behave the same way by not storing `DEFAULT`
values for generated columns.

Add missing test coverage for generated columns and ensure that tables
with generated columns do not break subsequent migrations.

Relates to #965

Fixes the regression introduced into `pgroll` `v0.14.0` by
#860

v0.14.2

Toggle v0.14.2's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Update init.sql placeholder references (#969)

Seems to fix #947 for me.

Sorry if this isn't the correct approach or wrong! Just seemed to work
for me.

At the very least this could help illustrate the issue.

v0.14.1

Toggle v0.14.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Recreate event trigger first in `init.sql` (#948)

Move event trigger creation to be the first thing that happens (after
`pgroll` schema creation) in `init.sql`.

Previous versions of `pgroll` used an event trigger that was
incompatible with the latest version, causing errors on the upgrade path
to `pgroll 0.14`. By moving event trigger creation to happen first
during `init`, we ensure that the old event trigger installed by an
older version of `pgroll` can't fire during the `init` of the new
version.

v0.14.0

Toggle v0.14.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Combine the return values of `Start` into a single data class (#945)

New data structure holds the return value of `Start` function of
operations.

```golang
type StartOperation struct {
    Actions []DBAction
    BackfillTask *backfill.Task
}
```

v0.13.0

Toggle v0.13.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Stop setting `name` field for inferred migrations (#854)

The name field is no longer supported as of #852.

Follow up to #852.

v0.12.0

Toggle v0.12.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Add documentation for `create` subcommand (#820)

This PR adds documentation for the new subcommand `create`.

![Screenshot 2025-05-09 at 09-42-35 pgroll - Zero-downtime reversible
schema changes for
PostgreSQL](https://github.com/user-attachments/assets/1ad4426b-87c4-4969-b307-a80265b515bd)