Entity Framework Core PostgreSQL Integration
See Entity Framework Core Integration document for the basics of the EF Core integration.
EntityFrameworkCore Project Update
- In
Acme.BookStore.EntityFrameworkCore
project replace packageVolo.Abp.EntityFrameworkCore.SqlServer
withVolo.Abp.EntityFrameworkCore.PostgreSql
- Update to use PostgreSQL in
BookStoreEntityFrameworkCoreModule
- Replace the
AbpEntityFrameworkCoreSqlServerModule
with theAbpEntityFrameworkCorePostgreSqlModule
- Replace the
options.UseSqlServer()
with theoptions.UsePostgreSql()
- Replace the
- In other projects update the PostgreSQL connection string in necessary
appsettings.json
files
Delete Existing Migrations
Delete all existing migration files (including DbContextModelSnapshot
)
Regenerate Initial Migration & Update the Database
Set the correct startup project (usually a web project),
Open the Package Manager Console (Tools -> Nuget Package Manager -> Package Manager Console), select the Acme.BookStore.EntityFrameworkCore.DbMigrations
as the Default project and execute the following command:
Run Add-Migration
command.
PM> Add-Migration Initial
Then execute the Update-Database
command to update the database schema:
PM> Update-Database