Skip to content

postgres: streamline migrations#1749

Merged
github-actions[bot] merged 1 commit intoquay:mainfrom
hdonnay:hack/connection-types
Feb 27, 2026
Merged

postgres: streamline migrations#1749
github-actions[bot] merged 1 commit intoquay:mainfrom
hdonnay:hack/connection-types

Conversation

@hdonnay
Copy link
Member

@hdonnay hdonnay commented Feb 4, 2026

This should make it easier to run the migrations and make sure that no connections from before the migrations are run could possibly be around to be used by accident.

See-also: https://issues.redhat.com/browse/CLAIRDEV-232

@hdonnay hdonnay requested a review from BradLugo February 4, 2026 20:47
@hdonnay hdonnay requested a review from a team as a code owner February 4, 2026 20:47
@hdonnay hdonnay requested review from crozzy and removed request for a team February 4, 2026 20:47
@BradLugo
Copy link
Contributor

BradLugo commented Feb 4, 2026

What'd you think about making changes here as well?

if pgErr.Code == "42704" { // OK: "no such type"
break
}

My first thought was to log that we hit this condition to help debug this situation when it comes up, but now I'm wondering... should we return this error anyway?

@BradLugo
Copy link
Contributor

BradLugo commented Feb 5, 2026

The current changes will still have Postgres produce the following log:

ERROR:  type "versionrange" does not exist

I think this might be confusing for admins looking through database logs.

@hdonnay
Copy link
Member Author

hdonnay commented Feb 23, 2026

I'm against returning an error, as it makes everything more complicated for little gain: the user should know if the database types have been created.

I've added an attempt to log (in the PostgreSQL log) that the error is expected.

@hdonnay hdonnay force-pushed the hack/connection-types branch 2 times, most recently from e530459 to 0ebc5e6 Compare February 24, 2026 20:18
@hdonnay hdonnay changed the title postgres: reset pool after running migrations postgres: streamline migrations Feb 24, 2026
@hdonnay hdonnay force-pushed the hack/connection-types branch 5 times, most recently from a2efc1e to e0b6d71 Compare February 25, 2026 20:53
Copy link
Contributor

@BradLugo BradLugo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor detail. Everything else looks good.

Copy link
Contributor

@BradLugo BradLugo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor detail. Everything else looks good.

@hdonnay hdonnay force-pushed the hack/connection-types branch from e0b6d71 to 5585470 Compare February 27, 2026 18:47
This change adds dedicated functions to run migrations using a
wholly-owned connection, then update the normal "Init" flow to reset any
connections created prior to the migrations running. This should make
sure that no connections from before the migrations are run could
possibly be around to be used by accident.

Signed-off-by: Hank Donnay <[email protected]>
See-also: https://issues.redhat.com/browse/CLAIRDEV-232
@hdonnay hdonnay force-pushed the hack/connection-types branch from 5585470 to fed5975 Compare February 27, 2026 18:48
@hdonnay hdonnay requested a review from BradLugo February 27, 2026 18:52
@hdonnay
Copy link
Member Author

hdonnay commented Feb 27, 2026

/fast-forward

@github-actions github-actions bot merged commit fed5975 into quay:main Feb 27, 2026
7 checks passed
@hdonnay hdonnay deleted the hack/connection-types branch February 27, 2026 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants