diff --git a/docs/en/Best-Practices/PostgreSQL-Integration.md b/docs/en/Best-Practices/PostgreSQL-Integration.md index 82d3cc9421..77db54f957 100644 --- a/docs/en/Best-Practices/PostgreSQL-Integration.md +++ b/docs/en/Best-Practices/PostgreSQL-Integration.md @@ -36,26 +36,28 @@ public class Acme.BookStore.EntityFrameworkCoreModule : AbpModule } ```` -### EntityFrameworkCore.DbMigrations Project Update -- **Do** update to use PostgreSQL in `BookStoreMigrationsDbContextModelSnapshot.cs` - -import `Npgsql.EntityFrameworkCore.PostgreSQL.Metadata` by adding - -````C# -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -```` - -replace all references +### Update Connection String Settings +- **Do** Update the PostgreSQL connection string in all `appsettings.json` files. + +### Regenerate Initial igration & Update the Database +Open the **Package Manager Console (PMC)** (under the *Tools/Nuget Package Manager* menu), select the `Acme.BookStore.EntityFrameworkCore.DbMigrations` as the **default project** and execute the following command: +> Ensure your startup project is correcty set. + +#### Delete Existing Initial Migrations + +![postgresql-delete-initial-migrations](images/postgresql-delete-initial-migrations.png) + +Then create a new migration class inside the `Migrations` folder. + ```` -.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); +PM> Add-Migration Initial ```` - to +Then execute the `Update-Database` command to update the database schema: -````C# -.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn); +```` +PM> Update-Database ```` -### Update Connection String Settings -> Update the PostgreSQL connection string in all `appsettings.json` files +![postgresql-update-database](images/postgresql-update-database.png) diff --git a/docs/en/Best-Practices/images/postgresql-delete-initial-migrations.png b/docs/en/Best-Practices/images/postgresql-delete-initial-migrations.png new file mode 100644 index 0000000000..39d9e6dedf Binary files /dev/null and b/docs/en/Best-Practices/images/postgresql-delete-initial-migrations.png differ diff --git a/docs/en/Best-Practices/images/postgresql-update-database.png b/docs/en/Best-Practices/images/postgresql-update-database.png new file mode 100644 index 0000000000..02b61ef6a3 Binary files /dev/null and b/docs/en/Best-Practices/images/postgresql-update-database.png differ diff --git a/docs/en/docs-nav.json b/docs/en/docs-nav.json index 6773c81079..84ae0d99e3 100644 --- a/docs/en/docs-nav.json +++ b/docs/en/docs-nav.json @@ -245,7 +245,13 @@ "items": [ { "text": "Entity Framework Core Integration", - "path": "Entity-Framework-Core.md" + "path": "Entity-Framework-Core.md", + "items": [ + { + "text": "PostgreSQL Integration", + "path": "Best-Practices/PostgreSQL-Integration.md" + } + ] }, { "text": "MongoDB Integration",