EF Core Migrations with Multiple DB Schemas

后端 未结 1 981
借酒劲吻你
借酒劲吻你 2021-02-14 14:37

EF Core 1.1 and SQL Server 2016

We are running a microservice application with some microservices having independent few tables. One of the solutions to have many tables

1条回答
  •  我在风中等你
    2021-02-14 15:35

    builder.HasDefaultSchema() is used to set schema for model. MigrationHistory table is configured bit differently. You can read more about it here

    From the link,

    The simplest scenario is when you just want to change the table name or schema. This can be done using the MigrationsHistoryTable method in OnConfiguring (or ConfigureServices on ASP.NET Core). Here is an example.

    protected override void OnConfiguring(DbContextOptionsBuilder options)
        => options.UseSqlServer(
            connectionString,
            x => x.MigrationsHistoryTable("__MyMigrationsHistory", "mySchema"));
    

    0 讨论(0)
提交回复
热议问题