8000 Multi-operation migration support for `add_column` operations by andrew-farries · Pull Request #590 · xataio/pgroll · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Multi-operation migration support for add_column operations #590

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jan 14, 2025

Conversation

andrew-farries
Copy link
Collaborator
@andrew-farries andrew-farries commented Jan 14, 2025

Ensure that add_column operations can be used as part of multi-operation migrations:

Add testcases for:

  • create table, add column
  • rename table, add column
  • add column, add column validation

Theses changes help ensure that add_column operations can be used as part of multi-operation migrations.

Part of #239

@andrew-farries andrew-farries marked this pull request as ready for review January 14, 2025 08:24
@andrew-farries andrew-farries changed the title Multi-operation migration support for add_column migrations Multi-operation migration support for add_column operations Jan 14, 2025
Base automatically changed from support-create-drop-create-table to main January 14, 2025 15:40
Ensure that it's possible to create a table and add a column to it in
the same migration.
Remove this test because it is similar to the parent commit. The test in
the parent commit subsumes this one and forces a test failure; this one
passes as written.
Make `OpCreateTable` add the details of the new table's primary key to
the virtual schema.

This allows subsequent `Start` or `Validate` methods of operations in
the same migration to reference the table's primary key.

For example, this change allows the `OpAddColumn.Validate` operation to
know that if the new table has a primary key that can be used for a
backfill.
Ensure that it's possible to add a column to a table that was renamed by
a previous operation in the same migration.
When creating the trigger take the table name from the schema instead of
the operation. This is because a preceding rename table operation may
have renamed the table, so looking the name up in the schema accounts
for any indirections that may have occurred.
When rolling back the operation, take the name of the table from the
schema instead of the operation. A preceding rename table operation may
have renamed the table, so looking up the table by name in the schema
accounts for any indirections.
Ensure that the a column with the same name can't be added to the same
table twice in one migration.
@andrew-farries andrew-farries force-pushed the op-add-column-multi-op-tests branch from a0c5c62 to 2733675 Compare January 14, 2025 15:43
@andrew-farries andrew-farries merged commit 4156bc6 into main Jan 14, 2025
28 checks passed
@andrew-farries andrew-farries deleted the op-add-column-multi-op-tests branch January 14, 2025 15:47
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
0