Base solution for your next web application

Activities of "geowikiapps"

Question

Hi,

I'm trying to get AspnetZero working with Postgres.

What I have done.

1)Uninstall the package Microsoft.EntityFrameworkCore.SqlServer 2)add Npgsql.EntityFrameworkCore.PostgreSQL & Npgsql.EntityFrameworkCore.PostgreSQL.Design 3)Modified the DbContext Configure method to use UseNpgsql 4)Added fix for max char error

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
    base.OnModelCreating(modelBuilder);

    foreach (var entityType in modelBuilder.Model.GetEntityTypes())
    {
        foreach (var property in entityType.GetProperties())
        {
            // max char length value in sqlserver
            if (property.GetMaxLength() == 67108864)
                // max char length value in postgresql
                property.SetMaxLength(10485760);
        }
    }
}
  1. changed the connection string in appsettings.json

When I ran the migration it fails.

PM> Update-Database
Applying migration '20170623075109_AspNetZero_V4_1_Changes'.
Failed executing DbCommand (18ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
UPDATE AbpEditions SET Discriminator = 'SubscribableEdition'
Npgsql.PostgresException (0x80004005): 42P01: relation "abpeditions" does not exist

any help is appreciated.

Showing 1 to 1 of 1 entries