3.1 Release Notes
Version 3.1 of the Npgsql Entity Framework Core provider has been released and is available on nuget. This version works with version 3.1 of Entity Framework Core, and brings new Npgsql features in addition to the general EF Core changes.
Caution
Use these versions with care and do not deploy to production without thorough testing. Read the breaking changes section below.
The full list of issues for this release is available here.
New Features
Aside from general EF Core features new in 3.1, the Npgsql EF Core provider contains the following major new features:
- It is now possible to map POCOs to JSON columns and query them, see the docs for more info (#981)
- PostgreSQL identity columns are now the default - see breaking changes below) (#804)
- Sequence options can now be managed on identity columns (#819)
- Support has been added for the upcoming PostgreSQL 12 generated columns feature (#939)
- A plugin is now available to automatically make all your tables and columns be snake_case! See EFCore.NamingConventions.
- Index sort options (ascending/descending, null sort order...) can now be specified (#326)
- Indexes can now be created concurrently (#967)
- Views are now reverse-engineered (#878)
- Array value converters help mapping with PostgreSQL arrays (e.g. map enum arrays to integer arrays) (#1031).
Breaking changes
Default value generation strategy is now IDENTITY
Caution
This is a major change, and upgrading to 3.1 with an existing database will cause a non-trivial schema migration to be generated. Read the following carefully.
The default value generation strategy has changed from the older SERIAL columns to the newer IDENTITY columns, introduced in PostgreSQL 10.
When producing a migration with 3.1, the Npgsql provider will attempt to automatically generate SQL to alter your tables and convert serial columns to identity ones. This is a sensitive, one-time migration operation that should be done with care, and carefully tested before deployment to production.
If you wish to opt out of using IDENTITY columns and continue using SERIAL columns, set the following on your model:
protected override void OnModelCreating(ModelBuilder modelBuilder)
=> modelBuilder.UseSerialColumns();
If you are using a PostgreSQL version older than 10, setting the compatibility mode is a better way to switch the default back to SERIAL columns:
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
=> optionsBuilder.UseNpgsql("...", o => o.SetPostgresVersion(9, 6));
More information is available in the page about generated properties.
Contributors
Thank you very much to the following people who have contributed to the individual 3.x releases.
Milestone 3.1.11
Contributor | Assigned issues |
---|---|
@roji | 5 |
Milestone 3.1.7
Contributor | Assigned issues |
---|---|
@roji | 4 |
Milestone 3.1.4
Contributor | Assigned issues |
---|---|
@roji | 4 |
Milestone 3.1.3
Contributor | Assigned issues |
---|---|
@roji | 1 |
Milestone 3.1.2
Contributor | Assigned issues |
---|---|
@roji | 3 |
@grzybsonssg | 1 |
Milestone 3.1.1.2
Contributor | Assigned issues |
---|---|
@roji | 1 |
Milestone 3.1.1.1
Contributor | Assigned issues |
---|---|
@roji | 1 |
Milestone 3.1.1
Contributor | Assigned issues |
---|---|
@roji | 6 |
Milestone 3.1.0
Contributor | Assigned issues |
---|---|
@roji | 15 |
@austindrenski | 1 |
@ins0mniaque | 1 |
@MarioPrabowo | 1 |
Milestone 3.0.1
Contributor | Assigned issues |
---|---|
@roji | 1 |
Milestone 3.0.0
Contributor | Assigned issues |
---|---|
@roji | 25 |
@austindrenski | 2 |
@YohDeadfall | 1 |