@ -18,4 +18,61 @@ Unlike the Layered solution template, the Single Layer solution template does no

After the migration completes, a message will appear in the console. You can verify the success of the migration by checking the database.
After the migration completes, a message will appear in the console. You can verify the success of the migration by checking the database.
## Database Migration Service
Under the `Data` folder of the project, the `BookstoreDbMigrationService` class is responsible for database migration and seed data operations. The `MigrateAsync` method is called in the `Program` class to migrate the database when the application starts with the `--migrate-database` argument.
First, it checks if the database is created and applies the pending migrations. Then, it seeds the initial data using the `SeedAsync` method.
```csharp
public async Task MigrateAsync()
{
var initialMigrationAdded = AddInitialMigrationIfNotExist();
Logger.LogInformation("Successfully completed all database migrations.");
Logger.LogInformation("You can safely end this process...");
}
```
The `BookstoreDbSchemaMigrator` class is used in the `MigrateDatabaseSchemaAsync` method for the database migration process. It is responsible for applying migrations to the database.