As this is such a common thing to do, and so easy to do, I'll write out the steps to follow here:
- Uninstall the
Microsoft.EntityFrameworkCore.SqlServer
package. You're not going to need this one. - Install the
Npgsql.EntityFrameworkCore.PostgreSQL
package.
- Install the
Npgsql
package.
- Update your
application.json
file to provide a PostgresSQL connection string instead of a SQL Server one.
- In Program.cs, change
options.UseSqlServer
to options.UseNpgsql
in the AddDbContext
operation.
- Delete the existing migrations
- Run
dotnet ef migrations add CreateIdentity
to create your new migrations.
- Run
dotnet ef database update
to create the tables inside Postgres.
You can now run your application and create users/log in as needed.