diff --git a/docs/en/Entity-Framework-Core-Other-DBMS.md b/docs/en/Entity-Framework-Core-Other-DBMS.md index d9190df844..8c9078583d 100644 --- a/docs/en/Entity-Framework-Core-Other-DBMS.md +++ b/docs/en/Entity-Framework-Core-Other-DBMS.md @@ -62,20 +62,18 @@ MySQL connection strings are different than SQL Server connection strings. So, c You typically will change the `appsettings.json` inside the `.DbMigrator` and `.Web` projects, but it depends on your solution structure. -## Change the Migrations DbContext +## DBMS restrictions MySQL DBMS has some slight differences than the SQL Server. Some module database mapping configuration (especially the field lengths) causes problems with MySQL. For example, some of the the [IdentityServer module](Modules/IdentityServer.md) tables has such problems and it provides an option to configure the fields based on your DBMS. -The startup template contains a *YourProjectName*MigrationsDbContext which is responsible to maintain and migrate the database schema. This DbContext basically calls extension methods of the depended modules to configure their database tables. - -Open the *YourProjectName*MigrationsDbContext and change the `builder.ConfigureIdentityServer();` line as shown below: +The module may provide some built-in solutions. You can configure it via `ModelBuilder`. eg: `Identity Server` module. -````csharp +```csharp builder.ConfigureIdentityServer(options => { options.DatabaseProvider = EfCoreDatabaseProvider.MySql; }); -```` +``` Then `ConfigureIdentityServer()` method will set the field lengths to not exceed the MySQL limits. Refer to related module documentation if you have any problem while creating or executing the database migrations. @@ -83,8 +81,8 @@ Then `ConfigureIdentityServer()` method will set the field lengths to not exceed The startup template uses [Entity Framework Core's Code First Migrations](https://docs.microsoft.com/en-us/ef/core/managing-schemas/migrations/). EF Core Migrations depend on the selected DBMS provider. So, changing the DBMS provider will cause the migration fails. -* Delete the Migrations folder under the `.EntityFrameworkCore.DbMigrations` project and re-build the solution. -* Run `Add-Migration "Initial"` on the Package Manager Console (select the `.DbMigrator` (or `.Web`) project as the startup project in the Solution Explorer and select the `.EntityFrameworkCore.DbMigrations` project as the default project in the Package Manager Console). +* Delete the Migrations folder under the `.EntityFrameworkCore` project and re-build the solution. +* Run `Add-Migration "Initial"` on the Package Manager Console (select the `.DbMigrator` (or `.Web`) project as the startup project in the Solution Explorer and select the `.EntityFrameworkCore` project as the default project in the Package Manager Console). This will create a database migration with all database objects (tables) configured. @@ -94,16 +92,4 @@ Run the `.DbMigrator` project to create the database and seed the initial data. It is ready. Just run the application and enjoy coding. -## DBMS restrictions - -Different DBMS may have some restrictions, such as the maximum length of field names, index length, etc. -The module may provide some built-in solutions. You can configure it via `ModelBuilder`. eg: `Identity Server` module. - -```csharp -builder.ConfigureIdentityServer(options => -{ - options.DatabaseProvider = EfCoreDatabaseProvider.MySql; -}); -``` - Related discussions: https://github.com/abpframework/abp/issues/1920 \ No newline at end of file