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

Temporal history table name always based on entity type name, not table name #26271

Closed
ajcvickers opened this issue Oct 7, 2021 · 1 comment · Fixed by #26281
Closed

Temporal history table name always based on entity type name, not table name #26271

ajcvickers opened this issue Oct 7, 2021 · 1 comment · Fixed by #26281
Assignees
Labels
area-model-building area-sqlserver area-temporal-tables closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. Servicing-approved type-bug
Milestone

Comments

@ajcvickers
Copy link
Member

For example:

    public DbSet<Person> People { get; set; }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder
            .Entity<Person>()
            .ToTable(b => b.IsTemporal());
    }

Results in PersonHistory not PeopleHistory:

.Annotation("SqlServer:TemporalHistoryTableName", "PersonHistory")

Likewise:

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder
            .Entity<Person>()
            .ToTable("Humans", b => b.IsTemporal());
    }

Still results in PersonHistory:

migrationBuilder.RenameTable(
    name: "People",
    newName: "Humans")
    .Annotation("SqlServer:IsTemporal", true)
    .Annotation("SqlServer:TemporalHistoryTableName", "PersonHistory")
    .Annotation("SqlServer:TemporalHistoryTableSchema", null);
@ajcvickers
Copy link
Member Author

/cc @maumar

@ajcvickers ajcvickers added this to the 6.0.0 milestone Oct 7, 2021
maumar added a commit that referenced this issue Oct 8, 2021
…pe name, not table name

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

Fixes #26271
maumar added a commit that referenced this issue Oct 8, 2021
…pe name, not table name

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

Fixes #26271
maumar added a commit that referenced this issue Oct 8, 2021
…pe name, not table name

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

Fixes #26271
maumar added a commit that referenced this issue Oct 8, 2021
…pe name, not table name

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

Fixes #26271
@maumar maumar closed this as completed in 92354b2 Oct 9, 2021
@ajcvickers ajcvickers added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Oct 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-model-building area-sqlserver area-temporal-tables closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. Servicing-approved type-bug
Projects
None yet
2 participants