Skip to content
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

[6.0] Fix to #26271 - Temporal history table name always based on entity type name, not table name #26281

Merged
merged 1 commit into from
Oct 9, 2021

Conversation

maumar
Copy link
Contributor

@maumar maumar commented Oct 8, 2021

When deciding on history table name use entityType.GetTableName() function instead of entity type name directly.

Fixes #26271

Customer impact

No impact for customers starting with RTM. For customers who were using pre-release versions of EFCore and were using the feature and were using default name for history table, we will generate a migration (history table rename) that they will have to execute to fix the model.

How found

Validating and documenting new features in EF Core 6.0.

Regression

No.

Testing

Several functional tests execute the code path, as well as testing the migration path from pre-release to RTM (assuming it contains this fix)

Risk

Low. We are changing temporal table naming pattern.

@maumar
Copy link
Contributor Author

maumar commented Oct 8, 2021

@Pilchie for 6.0 approval. Low risk - changing temporal table naming pattern. Change is in the new feature and even if someone is using the RC version, we should just generate a simple history table rename (which we have tests for already)

@maumar maumar changed the title Fix to #26271 - Temporal history table name always based on entity type name, not table name [6.0] Fix to #26271 - Temporal history table name always based on entity type name, not table name Oct 8, 2021
@maumar maumar force-pushed the fix26271 branch 2 times, most recently from 6898d78 to 52b407c Compare October 8, 2021 08:59
@@ -3858,7 +3858,7 @@ public virtual async Task History_table_schema_not_created_if_we_know_it_already
[SystemTimeStart] datetime2 GENERATED ALWAYS AS ROW START HIDDEN NOT NULL,
CONSTRAINT [PK_Orders] PRIMARY KEY ([Id]),
PERIOD FOR SYSTEM_TIME([SystemTimeStart], [SystemTimeEnd])
) WITH (SYSTEM_VERSIONING = ON (HISTORY_TABLE = [mySchema].[OrderHistory]));");
) WITH (SYSTEM_VERSIONING = ON (HISTORY_TABLE = [mySchema].[OrdersHistory]));");
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a test for renaming just the history table?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we already have it: Rename_history_table

@Pilchie
Copy link
Member

Pilchie commented Oct 8, 2021

Approved for EFCore 6.0 GA.

…pe name, not table name

When deciding on history table name use entityType.GetTableName() function instead of entity type name directly.

Fixes #26271
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Temporal history table name always based on entity type name, not table name
4 participants