In the article you describe: < In this version, ABP Framework provides base classes and events to migrate the database schema and seed the database on application startup. This system works compatibly with multi-tenancy and whenever a new tenant is created or a tenant's database connection string has been updated, it checks and applies database migrations for the new tenant state.
This system is especially useful to migrate databases for microservices. In this way, when you deploy a new version of a microservice, you don't need to manually migrate its database.
You need to take the following actions to use the database migration system:
Create a class that derives from EfCoreRuntimeDatabaseMigratorBase class, override and implement its SeedAsync method. And lastly, execute the CheckAndApplyDatabaseMigrationsAsync method of your class in the OnPostApplicationInitializationAsync method of your module class. Create a class that derives from DatabaseMigrationEventHandlerBase class, override and implement its SeedAsync method. Then, whenever a new tenant is created or a tenant's connection string is changed then the SeedAsync method will be executed. >
I like to see a practcal implementation how to implement the described steps in a MVC application.
I know, however, in the post mentioned above you describe the new feature "In this version, ABP Framework provides base classes and events to migrate the database schema and seed the database on application startup. This system works compatibly with multi-tenancy and whenever a new tenant is created or a tenant's database connection string has been updated, it checks and applies database migrations for the new tenant state."
I like to have an practical example here how to implement it :)
You describe the new database migration system here: https://blog.abp.io/abp/ABP.IO-Platform-7-4-RC-Has-Been-Published I like to auto migrate my application on startup, however, the description is not total clear for me. Can you please bring an example how to implement it in a normal MVC application?
When running the "Update all ABP packages" I see that you install jquery from a version of 2018. This versions have a lot of known vulnerabilities. Could you please ensure that the latest javascript frontends are used?
Hi,
ok, bit of a shame that I have to rewrite all the tests now.
2 more questions:
Hi, Thanks this works for me. However, for my real project, I have a lot of seed methods. Is there any other way than adding the if condition to every insert statement now? In addition: In my project I have tests like following which fail with the same error. What should I do here?
[Fact]
public async Task CreateAsync()
{
// Arrange
var input = new CustomerCreateDto
{
Name = "bf64c99897834",
Street = "30b28c8ff57b464d9bc2f5618f15be1c75930a933aa140cb80f614f124bb3f0461f45",
Postcode = "aa2e0879154b4a2bbf78597283eb7e57",
City = "5f4242b5aa61476a97c3e5af411cf498521949a2ad2c47edbbbe",
Country = "c83c88797e63411f882bdd48759e99e87679b076e154472482c6e885b56830cf82abbd257b894cd0a8588a73ad277e3c7c6d",
VATNo = "d6d31592918a4f0f96ee23ad51a87e0ab5b0f1b49ccb41acbf85136106af9ba445de4a676ed14b4db27c63267679c6d8def4",
Status = default,
State = "76d47ce8de444b898aa5565717a4f154c746171559174f87a9fff21f832690097571c7457c7544b3a3041662529c371a881e"
};
// Act
var serviceResult = await _customersAppService.CreateAsync(input);
// Assert
var result = await _customerRepository.FindAsync(c => c.Id == serviceResult.Id);
result.ShouldNotBe(null);
result.Name.ShouldBe("bf64c99897834");
result.Street.ShouldBe("30b28c8ff57b464d9bc2f5618f15be1c75930a933aa140cb80f614f124bb3f0461f45");
result.Postcode.ShouldBe("aa2e0879154b4a2bbf78597283eb7e57");
result.City.ShouldBe("5f4242b5aa61476a97c3e5af411cf498521949a2ad2c47edbbbe");
result.Country.ShouldBe("c83c88797e63411f882bdd48759e99e87679b076e154472482c6e885b56830cf82abbd257b894cd0a8588a73ad277e3c7c6d");
result.VATNo.ShouldBe("d6d31592918a4f0f96ee23ad51a87e0ab5b0f1b49ccb41acbf85136106af9ba445de4a676ed14b4db27c63267679c6d8def4");
result.Status.ShouldBe(default);
result.State.ShouldBe("76d47ce8de444b898aa5565717a4f154c746171559174f87a9fff21f832690097571c7457c7544b3a3041662529c371a881e");
}
If you're creating a bug/problem report, please include followings:
I updated to abp v7.0.0. I can run my application, however, when running the unit tests I receive following errors randomly for the tests.
Message: Volo.Abp.AbpInitializationException : An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor phase of the module TestProjectDb.TestProjectDbTestBaseModule, TestProjectDb.TestBase, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: SqliteConnection does not support nested transactions.. See the inner exception for details. ---- System.InvalidOperationException : SqliteConnection does not support nested transactions.
Stack Trace:
ModuleManager.InitializeModules(ApplicationInitializationContext context)
AbpApplicationBase.InitializeModules()
AbpApplicationWithExternalServiceProvider.Initialize(IServiceProvider serviceProvider)
AbpIntegratedTest1.ctor() TestProjectDbTestBase
1.ctor()
TestProjectDbApplicationTestBase.ctor()
I found https://support.abp.io/QA/Questions/2176/Regarding-Unit-test-issue and replaced the service as described, however, this does not fix my problem. I do understand the problem but dont know how to fix this or what changed between my last v6.0.0 and this version?
Hello,
in our company we run all projects through the well-known tool snyk.io to find vulnerabilities. Thereby we noticed some vulnerabilities, which come into the project through abp.io. To fix them we think it is important that you update the abp.io packages and provide a new version. Since abp.io is already used by many companies it would be good if you regularly use synk or a similar tool yourself and update the dependencies within your abp.io modules.
In the attachment some examples: