Skip to content

[CMCSMACD-4253] Run each migration in its own transaction#8

Merged
hundt-corbalt merged 1 commit into
mainfrom
hundt-tx
Sep 4, 2025
Merged

[CMCSMACD-4253] Run each migration in its own transaction#8
hundt-corbalt merged 1 commit into
mainfrom
hundt-tx

Conversation

@hundt-corbalt
Copy link
Copy Markdown
Contributor

Some types of changes (like adding new enum values) cannot be used until after the transaction including them is committed.[0]

As part of this change, the verification program is updated to:

  • include a migration that fails if it is included in the same transaction as the previous migration
  • call Migrate() on all migrations once before calling it on each one individually which reproduces the error that this change fixes.

[0] https://www.postgresql.org/docs/16/sql-altertype.html

PR Checklist

  • New automated tests have been written to the extent possible.
  • The code has been checked for structural/syntactic validity.
    • AMI/application: a build was performed
    • terraform changes: "terraform plan" checked on every affected environment
  • (If applicable) the code has been manually tested on our infrastructure.
    • AMI/application: deployed an a test or dev environment
    • terraform changes: applied to test or dev environment
    • script: run against test or dev environment
  • Likely failure points and new functionality have been identified and tested manually.
    Examples:
    • Application manually run in a way that triggers any new branches
    • AMI logged into and changes verified from login shell
  • Pull request description includes a description of all the manual steps performed to accomplish the above.

To provide feedback on this template, visit https://docs.google.com/document/d/1YfTv7Amyop5G_8w1c2GJ_Mu-70L0KkZHhm9f9umDi3U/edit

Some types of changes (like adding new enum values) cannot be
used until after the transaction including them is committed.[0]

As part of this change, the verification program is updated to:
- include a migration that fails if it is included in the same
  transaction as the previous migration
- call Migrate() on all migrations once before calling it on
  each one individually
which reproduces the error that this change fixes.

[0] https://www.postgresql.org/docs/16/sql-altertype.html
@hundt-corbalt hundt-corbalt requested a review from jonahb September 4, 2025 14:59
@jonahb jonahb self-assigned this Sep 4, 2025
Copy link
Copy Markdown

@jonahb jonahb left a comment

Choose a reason for hiding this comment

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

Looks good!

@jonahb jonahb assigned hundt-corbalt and unassigned jonahb Sep 4, 2025
@hundt-corbalt hundt-corbalt merged commit 21bcde6 into main Sep 4, 2025
1 check passed
@hundt-corbalt hundt-corbalt deleted the hundt-tx branch September 4, 2025 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants