Entityframework.docs: Provide more details on customizing the Migrations history table

Created on 9 Jan 2020  Â·  3Comments  Â·  Source: dotnet/EntityFramework.Docs

Hello

Pleas add an example on how to use the MigrationsHistoryTable Method in .NET Core.
Preferably not only with SQL Database (we are using PostgreSQL).

This would be greatly appreciated.

Kind regards, Mike


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

closed-question

Most helpful comment

services.AddDbContext<ApplicationDbContext>(options =>
    options.UseNpgsql(
        Configuration.GetConnectionString("DefaultConnection"),
        x => x.MigrationsHistoryTable("__MyMigrationsHistory", "not-public")));

All 3 comments

@mjehle82 Can you give some more details of what you mean by "use the MigrationsHistoryTable"? Use in what way?

I would like to have the MigrationsHistoryTable in a specific database schema.
As I am using PostgreSQL, currently the Table is placed in the public schema.

I am referring to this part of the page: "You can change the schema and table name using the MigrationsHistoryTable() method in OnConfiguring() (or ConfigureServices() on ASP.NET Core). Here is an example using the SQL Server EF Core provider."

There is only an example for the usage in the OnConfiguringMethod. An example for the usage in ConfigureServices would be appreciated, since I am using ASP.NET Core.

Additionally, it would be great, to have this documented not only for SQL Server but also for other database providers such as PostgreSQL.

Kind regards, Mike

services.AddDbContext<ApplicationDbContext>(options =>
    options.UseNpgsql(
        Configuration.GetConnectionString("DefaultConnection"),
        x => x.MigrationsHistoryTable("__MyMigrationsHistory", "not-public")));
Was this page helpful?
0 / 5 - 0 ratings

Related issues

joakimriedel picture joakimriedel  Â·  3Comments

jpeckham picture jpeckham  Â·  3Comments

CubeSpark picture CubeSpark  Â·  3Comments

MCcoder52 picture MCcoder52  Â·  3Comments

CeciAc picture CeciAc  Â·  4Comments