myesn

myEsn2E9

hi
github

ABP Database Architecture Migration and Seed Data Generation

Database Structure Changes#

After modifying the database entities, the following steps need to be taken to update the changed content in the database:

  1. Right-click on the *.Web project in Visual Studio, select "Set as StartUp Project," which means using the database connection string in this project.
  2. Open the console in the directory of the *.EntityFrameworkCore project and execute the following command to generate a database migration file:
    dotnet ef migrations add Created_Book_Entity
    
  3. Run the *.DbMigrator project to apply the migration file. Alternatively, execute the following command in the same console to only apply the contents of the migration file to the database:
    dotnet ef database update
    

Reference

Seed Data Changes#

  1. Modify the content of *.Domain\DataSender\*DataSeederContributor to change the seed data:
    public class IDCloudDataSeedContributor : IDataSeedContributor, ITransientDependency {}
    
  2. Run the *.DbMigrator project to migrate the database schema and generate seed data in development and production environments.

Admin Login Password Changes#

Open XXW.XXX.Domain/Data/XXDbMigrationService.cs, find the SeedDataAsync function, where you can modify the login password for the default admin account:

await _dataSeeder.SeedAsync(new DataSeedContext(tenant?.Id)
    .WithProperty(IdentityDataSeedContributor.AdminEmailPropertyName, IdentityDataSeedContributor.AdminEmailDefaultValue)
    .WithProperty(IdentityDataSeedContributor.AdminPasswordPropertyName, "Set the default password for the admin account initialization here")//IdentityDataSeedContributor.AdminPasswordDefaultValue
);
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.