Details

Configure PostgreSQL

The first step to configuring PostgreSQL is installing the Npgsql.EntityFrameworkCore.PostgreSQL  NuGet package

Create the ApplicationDbContext class and add necessary entity tables

Configure the database context in the Program.cs file as follows

builder.Services.AddDbContext<ApplicationDbContext>(options =>
   options.UseNpgsql(builder.Configuration.GetConnectionString("Default")));

Then add the database connection string in appsettings.json

"Default": "Host=localhost;Database=DATABASE;Username=USERNAME;Password=PASSWORD"

Run the initial migration and the update the database.