- ABP Framework version: v4.4.0
- UI type: MVCr
- DB provider: EF Core / PostreSQL
- Tiered (MVC) or Identity Server Separated (Angular): yes
- Exception message and stack trace:
* This exception was originally thrown at this call stack:
SELECT a."Id", a."Name", a."ProviderKey", a."ProviderName", a."Value"
FROM "AbpSettings" AS a
WHERE (a."ProviderName" = @__providerName_0) AND (a."ProviderKey" IS NULL)
[13:07:11 ERR] An exception occurred while iterating over the results of a query for context type 'Volo.Abp.SettingManagement.EntityFrameworkCore.SettingManagementDbContext'.
Npgsql.PostgresException (0x80004005): 42P01: relation "AbpSettings" does not exist
at Npgsql.NpgsqlConnector.<ReadMessage>g__ReadMessageLong|194_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)
at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
at Npgsql.NpgsqlCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable`1.AsyncEnumerator.InitializeReaderAsync(DbContext _, Boolean result, CancellationToken cancellationToken)
at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable`1.AsyncEnumerator.MoveNextAsync()
Exception data:
Severity: ERROR
SqlState: 42P01
MessageText: relation "AbpSettings" does not exist
Position: 77
File: parse_relation.c
Line: 1373
Routine: parserOpenTable
Npgsql.PostgresException (0x80004005): 42P01: relation "AbpSettings" does not exist
at Npgsql.NpgsqlConnector.<ReadMessage>g__ReadMessageLong|194_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)
at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
at Npgsql.NpgsqlCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable`1.AsyncEnumerator.InitializeReaderAsync(DbContext _, Boolean result, CancellationToken cancellationToken)
at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable`1.AsyncEnumerator.MoveNextAsync()
at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken)
Exception data:
Severity: ERROR
SqlState: 42P01
MessageText: relation "AbpSettings" does not exist
Position: 77
File: parse_relation.c
Line: 1373
Routine: parserOpenTable
- Steps to reproduce the issue: using ABP suite I creat new solution. MVC, DB PostgreSQL, Seperated tenant schema with tiered option. I manually add the first migration (because there are 2 contexts in the dbmigrator project) and then run the dbmigrator project to apply the migration and seed the data. I get the above message.
In my OnModelCreating method of the *DbContextBase.cs file I have the following code to remove the 'abp' prefix from the table names.
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
/* Include modules to your migration db context */
builder.ConfigurePermissionManagement(options => { options.TablePrefix = ""; });
builder.ConfigureSettingManagement(options => { options.TablePrefix = ""; });
builder.ConfigureBackgroundJobs(options => { options.TablePrefix = ""; });
builder.ConfigureAuditLogging(options => { options.TablePrefix = ""; });
builder.ConfigureIdentityPro(options => { options.TablePrefix = ""; });
builder.ConfigureIdentityServer(options => { options.TablePrefix = ""; });
builder.ConfigureFeatureManagement(options => { options.TablePrefix = ""; });
builder.ConfigureLanguageManagement(options => { options.TablePrefix = ""; });
builder.ConfigureSaas(options => { options.TablePrefix = ""; });
builder.ConfigureTextTemplateManagement(options => { options.TablePrefix = ""; });
builder.ConfigureBlobStoring(options => { options.TablePrefix = ""; });
/* Configure your own tables/entities inside here */
//builder.Entity<YourEntity>(b =>
//{
// b.ToTable(MVCTierdSepSchemaConsts.DbTablePrefix + "YourEntities", MVCTierdSepSchemaConsts.DbSchema);
// b.ConfigureByConvention(); //auto configure for the base class props
// //...
//});
//if (builder.IsHostDatabase())
//{
// /* Tip: Configure mappings like that for the entities only available in the host side,
// * but should not be in the tenant databases. */
//}
}
9 Answer(s)
-
0
Have you tried to add Host and Tenant migrations both?
-
0
i have yes and while it creates the schema it fails on seeding the data. i get the same error message regardless.
-
0
Can you share your command that creates the migrations?
-
0
- Add-Migration "HostMigration" -Context MVCTierdSepSchemaDbContext
- Then I run dbmigrator and receive the error message
- Add-Migration "TenantMigration" -Context MVCTierdSepSchemaTenantDbContext -OutputDir TenantMigrations
- Then I run dbmigrator and receive the error message
-
0
-
0
Now when I run the dbmigrator project it gives the following message "The string argument 'value' cannot be empty." string
Here is the stack trace
at Microsoft.EntityFrameworkCore.Utilities.Check.NullButNotEmpty(String value, String parameterName) at Microsoft.EntityFrameworkCore.RelationalEntityTypeExtensions.SetSchema(IMutableEntityType entityType, String value) at Microsoft.EntityFrameworkCore.RelationalEntityTypeBuilderExtensions.ToTable[TEntity](EntityTypeBuilder`1 entityTypeBuilder, String name, String schema) at Volo.Abp.PermissionManagement.EntityFrameworkCore.AbpPermissionManagementDbContextModelBuilderExtensions.<>c__DisplayClass0_0.<ConfigurePermissionManagement>b__0(EntityTypeBuilder`1 b) at Microsoft.EntityFrameworkCore.ModelBuilder.Entity[TEntity](Action`1 buildAction) at Volo.Abp.PermissionManagement.EntityFrameworkCore.AbpPermissionManagementDbContextModelBuilderExtensions.ConfigurePermissionManagement(ModelBuilder builder, Action`1 optionsAction) at MVCTierdSepSchema.EntityFrameworkCore.MVCTierdSepSchemaDbContextBase`1.OnModelCreating(ModelBuilder builder) in C:\Source Code\My Recent\MVCTieredTenantSchema\src\MVCTierdSepSchema.EntityFrameworkCore\EntityFrameworkCore\MVCTierdSepSchemaDbContextBase.cs:line 32 at MVCTierdSepSchema.EntityFrameworkCore.MVCTierdSepSchemaDbContext.OnModelCreating(ModelBuilder builder) in C:\Source Code\My Recent\MVCTieredTenantSchema\src\MVCTierdSepSchema.EntityFrameworkCore\EntityFrameworkCore\MVCTierdSepSchemaDbContext.cs:line 19 at Microsoft.EntityFrameworkCore.Infrastructure.ModelCustomizer.Customize(ModelBuilder modelBuilder, DbContext context) at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.CreateModel(DbContext context, IConventionSetBuilder conventionSetBuilder, ModelDependencies modelDependencies) at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.GetModel(DbContext context, IConventionSetBuilder conventionSetBuilder, ModelDependencies modelDependencies) at Microsoft.EntityFrameworkCore.Internal.DbContextServices.CreateModel() at Microsoft.EntityFrameworkCore.Internal.DbContextServices.get_Model() at Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkServicesBuilder.<>c.<TryAddCoreServices>b__7_3(IServiceProvider p) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider) at Microsoft.EntityFrameworkCore.DbContext.get_DbContextDependencies() at Microsoft.EntityFrameworkCore.DbContext.get_InternalServiceProvider() at Microsoft.EntityFrameworkCore.DbContext.Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<System.IServiceProvider>.get_Instance() at Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade.Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<System.IServiceProvider>.get_Instance() at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.GetRelationalService[TService](IInfrastructure`1 databaseFacade) at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.MigrateAsync(DatabaseFacade databaseFacade, CancellationToken cancellationToken) at MVCTierdSepSchema.EntityFrameworkCore.EntityFrameworkCoreMVCTierdSepSchemaDbSchemaMigrator.<MigrateAsync>d__2.MoveNext() in C:\Source Code\My Recent\MVCTieredTenantSchema\src\MVCTierdSepSchema.EntityFrameworkCore\EntityFrameworkCore\EntityFrameworkCoreMVCTierdSepSchemaDbSchemaMigrator.cs:line 33 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at MVCTierdSepSchema.Data.MVCTierdSepSchemaDbMigrationService.<MigrateDatabaseSchemaAsync>d__10.MoveNext() in C:\Source Code\My Recent\MVCTieredTenantSchema\src\MVCTierdSepSchema.Domain\Data\MVCTierdSepSchemaDbMigrationService.cs:line 95 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at MVCTierdSepSchema.Data.MVCTierdSepSchemaDbMigrationService.<MigrateAsync>d__9.MoveNext() in C:\Source Code\My Recent\MVCTieredTenantSchema\src\MVCTierdSepSchema.Domain\Data\MVCTierdSepSchemaDbMigrationService.cs:line 52 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at MVCTierdSepSchema.DbMigrator.DbMigratorHostedService.<StartAsync>d__3.MoveNext() in C:\Source Code\My Recent\MVCTieredTenantSchema\src\MVCTierdSepSchema.DbMigrator\DbMigratorHostedService.cs:line 39 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult() at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>d__9.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult() at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.<RunAsync>d__4.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.<RunAsync>d__4.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at MVCTierdSepSchema.DbMigrator.Program.<Main>d__0.MoveNext() in C:\Source Code\My Recent\MVCTieredTenantSchema\src\MVCTierdSepSchema.DbMigrator\Program.cs:line 30
-
0
hi
Sorry, I was wrong, Can you change the
DbTablePrefix
instead ofDbSchema
? -
0
now I get this error. I don't want any ABP framework table prefixes on any of the tables created whether it be the host or tenant tables.
SELECT EXISTS ( SELECT 1 FROM "SaasEditions" AS s WHERE (@__ef_filter__p_0 OR NOT (s."IsDeleted")) AND (s."DisplayName" = @__UtyMGa29B_0)) [10:22:17 ERR] An exception occurred while iterating over the results of a query for context type 'Volo.Saas.EntityFrameworkCore.SaasDbContext'. Npgsql.PostgresException (0x80004005): 42P01: relation "SaasEditions" does not exist at Npgsql.NpgsqlConnector.<ReadMessage>g__ReadMessageLong|194_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable
1.AsyncEnumerator.InitializeReaderAsync(DbContext _, Boolean result, CancellationToken cancellationToken) at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func
4 operation, Func4 verifySucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable
1.AsyncEnumerator.MoveNextAsync() Exception data: Severity: ERROR SqlState: 42P01 MessageText: relation "SaasEditions" does not exist Position: 41 File: parse_relation.c Line: 1373 Routine: parserOpenTable Npgsql.PostgresException (0x80004005): 42P01: relation "SaasEditions" does not exist at Npgsql.NpgsqlConnector.<ReadMessage>g__ReadMessageLong|194_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable1.AsyncEnumerator.InitializeReaderAsync(DbContext _, Boolean result, CancellationToken cancellationToken) at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func
4 operation, Func4 verifySucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable
1.AsyncEnumerator.MoveNextAsync() at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleAsync[TSource](IAsyncEnumerable`1 asyncEnumerable, CancellationToken cancellationToken) Exception data: Severity: ERROR SqlState: 42P01 MessageText: relation "SaasEditions" does not exist Position: 41 File: parse_relation.c Line: 1373 Routine: parserOpenTable -
0
Applying the following code in the DbMigratorHostedService.cs seemed to have resolved all the errors I was getting.
AbpPermissionManagementDbProperties.DbTablePrefix = string.Empty; AbpSettingManagementDbProperties.DbTablePrefix = string.Empty; AbpCommonDbProperties.DbTablePrefix = string.Empty; SaasDbProperties.DbTablePrefix = string.Empty; AbpIdentityServerDbProperties.DbTablePrefix = string.Empty;