Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extensions creation backward compatibility #899

Closed
gangstatracer opened this issue Jun 4, 2019 · 3 comments
Closed

Extensions creation backward compatibility #899

gangstatracer opened this issue Jun 4, 2019 · 3 comments

Comments

@gangstatracer
Copy link

@gangstatracer gangstatracer commented Jun 4, 2019

I've tried to migrate from version 2.1.2 to 2.2.4 and got following issue:
There are migration, generated by version 2.1.2 library, containing following:

public partial class InitialCreation : Migration
{
    protected override void Up(MigrationBuilder migrationBuilder)
    {
        migrationBuilder.AlterDatabase()
            .Annotation("Npgsql:PostgresExtension:uuid-ossp", "'uuid-ossp', '', ''");
    }
}

Trying to apply this migration on empty database causes postgres exception, because of invalid extention creation generated statement (from postgres log):

CREATE EXTENSION IF NOT EXISTS "uuid-ossp" VERSION " ''"

I think it's related to missing backward compatibility at annotation value parsing:
https://github.com/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL/blob/8752decb89b9a13f01d7aff920e67c367d921f2b/src/EFCore.PG/Metadata/PostgresExtension.cs#L176

@chrisvire

This comment has been minimized.

Copy link

@chrisvire chrisvire commented Jun 26, 2019

I am trying to update:

  • DotNet Core 2.1 to 2.2
  • EntityFrameworkCore 2.1.1 to 2.2.4
  • Npgsql.EntityFrameworkCore.PostgreSQL 2.1.2 to 2.2.4

When I trie to run our bootstrapping process (which runs the EFCore migration), I get this error:

Npgsql.PostgresException (0x80004005): 22023: extension "uuid-ossp" has no installation script nor update path for version " ''"

Our code (which works with 2.1.2) is:

    public class AppDbContext : DbContext
    {
        public AppDbContext(DbContextOptions<AppDbContext> options) : base(options)
        {}

        // NOTE: only one side of a relationship needs to be specified.
        //       (because each declaration on a side actually defines
        //        both sides in a single fluent builder chain)
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            modelBuilder.HasPostgresExtension("uuid-ossp");

Is there a different way to do this in 2.2.4? Is it OK to use 2.1.2 with EFCore 2.2?

@gangstatracer

This comment has been minimized.

Copy link
Author

@gangstatracer gangstatracer commented Jul 8, 2019

Hi, @chrisvire! My pull request with fix for this bug was applied, but it have not released yet. We are using EntityFrameworkCore 2.2.4 along with old Npgsql.EntityFrameworkCore.PostgreSql 2.1.2 for a month and didn't met any issues yet.

@austindrenski

This comment has been minimized.

Copy link
Member

@austindrenski austindrenski commented Jul 11, 2019

Closed via d254da1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.