I've upgraded our solution from ABP 3.3.2 to 4.3.0.
Everything was more or less smoothly, but now I discovered a problem: some new ABP tables are missing from migration scripts! How come? What am I supposed to do now?
Please have a look at the migration classes autogenerated for 3.3.2 and 4.3.0. https://1drv.ms/u/s!AhWdpZddvifTtizt4xjre044i7B8?e=0xuBUs
Here is the list of ABP-prefixed tables created from test solution (autogenerated in ABP Suite) using DbMigrator
project in local MS SQL server DB - all the tables are at place:
Here is the list of tables in our ORACLE DB created using standard update-database
command and DbMigrator
afterwards to seed data - make a note some tables are missing (for instance, AbpBlobContainers, AbpTextTemplateContents). How it's possible?? How to easily find out what is missing and add it?
The missing table has been identified while trying to use "Forgot password" functionality: it appeared this functionality now needs to access AbpTextTemplateContents table.
So please advice how to make Forgot password work having AbpTextTemplateContents at place. Also make a note: I need to intercept change password functionality (override Identity Account Service?) - I need to change password for all users with the same loginname at other tenants!
And if I get it right - ABP documentation needs to be updated here. Now:
How to Install Text Template Management module is pre-installed in the startup templates. So, no need to manually install it.
To be changed to:
How to Install If you are using ABP version 4.x.x (where this module appeared?) Text Template Management module is pre-installed in the startup templates. So, no need to manually install it. If you are using ABP version 3.x.x - you have to ....
10 Answer(s)
-
0
hi
I suggest you check all migration guides first. There are lot of changes.
https://docs.abp.io/en/abp/latest/Migration-Guides/Index https://docs.abp.io/en/commercial/latest/migration-guides/index
-
0
@maliming
Thank you. But as I've already mentioned in GitHub item, I have already made migration. And I did read the manual - I run
update-database
and I did data seeding for IdentityServer. I re-read those migration guides, however I cannot find anything related to my issue.So please help me to resolve it.
-
0
hi
You can create a new project via CLI. then compare the code.
eg:
xxxMigrationsDbContext
xxxEntityFrameworkCoreModule
-
0
I already did such a compare, but it did not help me. Because a new project does not have previous migration classes - from version 3.3.2, as in my case. So I cannot figure out what went wrong when I was doing
update-database
. To provide you the details, I've attached two migration classes (see in my first message): previous one, version 3.3.2 and current one, version 4.3.0. Obviously, some tables have not been created which are now required for ABP 4.3.0 to function properly.From your documentation I cannot understand how to have those missing tables created and how to make "Forgot password" functionality function properly now (when it needs AbpTextTemplateContents table which has not been created during migration).
-
0
hi
Please share the code of
xxxMigrationsDbContext
andxxxEntityFrameworkCoreModule
. -
0
Please find below:
using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using System.IO; using Volo.Abp.AuditLogging.EntityFrameworkCore; using Volo.Abp.BackgroundJobs.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.FeatureManagement.EntityFrameworkCore; using Volo.Abp.Identity.EntityFrameworkCore; using Volo.Abp.IdentityServer.EntityFrameworkCore; using Volo.Abp.LanguageManagement.EntityFrameworkCore; using Volo.Abp.PermissionManagement.EntityFrameworkCore; using Volo.Abp.SettingManagement.EntityFrameworkCore; using Volo.Saas.EntityFrameworkCore; namespace AbxEps.CentralTools.EntityFrameworkCore { /* This DbContext is only used for database migrations. * It is not used on runtime. See CentralToolsDbContext for the runtime DbContext. * It is a unified model that includes configuration for * all used modules and your application. */ public class CentralToolsMigrationsDbContext : AbpDbContext<CentralToolsMigrationsDbContext> { public CentralToolsMigrationsDbContext(DbContextOptions<CentralToolsMigrationsDbContext> options) : base(options) { } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { var configuration = BuildConfiguration(); optionsBuilder.UseOracle( configuration.GetConnectionString("Default"), default(System.Action<Devart.Data.Oracle.Entity.OracleDbContextOptionsBuilder>)); } protected override void OnModelCreating(ModelBuilder builder) { var config = Devart.Data.Oracle.Entity.Configuration.OracleEntityProviderConfig.Instance; config.Workarounds.DisableQuoting = true; config.CodeFirstOptions.UseNonLobStrings = true; config.CodeFirstOptions.UseNonUnicodeStrings = true; base.OnModelCreating(builder); /* Include modules to your migration db context */ builder.ConfigurePermissionManagement(); builder.ConfigureSettingManagement(); builder.ConfigureBackgroundJobs(); builder.ConfigureAuditLogging(); builder.ConfigureIdentityPro(); builder.ConfigureIdentityServer(); builder.ConfigureFeatureManagement(); builder.ConfigureLanguageManagement(); builder.ConfigureSaas(); /* Configure your own tables/entities inside the ConfigureCentralTools method */ //builder.ConfigureCentralTools(); } private static IConfigurationRoot BuildConfiguration() { var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: false); return builder.Build(); } } } using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Volo.Abp.AuditLogging.EntityFrameworkCore; using Volo.Abp.BackgroundJobs.EntityFrameworkCore; using Volo.Abp.BlobStoring.Database.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.FeatureManagement.EntityFrameworkCore; using Volo.Abp.Identity.EntityFrameworkCore; using Volo.Abp.IdentityServer.EntityFrameworkCore; using Volo.Abp.LanguageManagement.EntityFrameworkCore; using Volo.Abp.Modularity; using Volo.Abp.PermissionManagement.EntityFrameworkCore; using Volo.Abp.SettingManagement.EntityFrameworkCore; using Volo.Abp.TextTemplateManagement.EntityFrameworkCore; using Volo.Saas.EntityFrameworkCore; using AbxEps.CT.Batch.EntityFrameworkCore; using AbxEps.Abp.EF.Oracle.Extensions.Interceptors; using AbxEps.CT.Core.EntityFrameworkCore; using Volo.Abp.Auditing; using AbxEps.CentralTools.Images.Handlers; namespace AbxEps.CentralTools.EntityFrameworkCore { [DependsOn( typeof(CentralToolsDomainModule), typeof(AbpIdentityProEntityFrameworkCoreModule), typeof(AbpIdentityServerEntityFrameworkCoreModule), typeof(AbpPermissionManagementEntityFrameworkCoreModule), typeof(AbpSettingManagementEntityFrameworkCoreModule), typeof(AbpBackgroundJobsEntityFrameworkCoreModule), typeof(AbpAuditLoggingEntityFrameworkCoreModule), typeof(AbpFeatureManagementEntityFrameworkCoreModule), typeof(LanguageManagementEntityFrameworkCoreModule), typeof(SaasEntityFrameworkCoreModule), typeof(TextTemplateManagementEntityFrameworkCoreModule), typeof(BlobStoringDatabaseEntityFrameworkCoreModule), typeof(CoreEntityFrameworkCoreModule), typeof(BatchEntityFrameworkCoreModule) )] public class CentralToolsEntityFrameworkCoreModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) { CentralToolsEfCoreEntityExtensionMappings.Configure(); } public override void ConfigureServices(ServiceConfigurationContext context) { context.Services.AddAbpDbContext<CentralToolsDbContext>(options => { /* Remove "includeAllEntities: true" to create * default repositories only for aggregate roots */ options.AddDefaultRepositories(includeAllEntities: true); }); context.Services.AddTransient<IAuditPropertySetter, Abp.DataExtensions.Entities.LogAuditPropertySetter>(); context.Services.AddTransient<IImageHandler, ImageHandler>(); Configure<AbpDbContextOptions>(options => { options.PreConfigure(abpDbContextConfigurationContext => { abpDbContextConfigurationContext.DbContextOptions.UseLoggerFactory( LoggerFactory.Create(loggingBuilder => loggingBuilder.AddConsole())); abpDbContextConfigurationContext.DbContextOptions.AddInterceptors(new RemoveQuotesInterceptor()); abpDbContextConfigurationContext.DbContextOptions.EnableSensitiveDataLogging(); }); options.UseOracle(); }); } } }
-
0
-
0
Thank you. I have added those configuring methods. I already had corresponding modules included into
DependsOn
on all layers. So I run DbMigrator expecting it would create missing tables now. However, this did not happen - the tables are still missing. What do I do? -
0
I have added those configuring methods. I already had corresponding modules included into DependsOn on all layers.
You need add new migration file before run DbMigrator.
-
0
Oh, right. Yes - after adding migration class I can see missing table creation code is there. And migration now added missing tables. Eventually "Forgot password" functionality now is OK, no exceptions anymore - e-mail is sent as expected.
Thank you!