From fec447a4e7b1ee74272db131c620635781c46ce7 Mon Sep 17 00:00:00 2001 From: maliming Date: Fri, 30 Aug 2019 17:34:08 +0800 Subject: [PATCH] Update PostgreSQL Integration document. --- docs/en/Best-Practices/Index.md | 2 +- .../Best-Practices/PostgreSQL-Integration.md | 22 +++++++++---------- docs/en/docs-nav.json | 2 +- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/docs/en/Best-Practices/Index.md b/docs/en/Best-Practices/Index.md index f3f626ca63..1a48c6b46b 100644 --- a/docs/en/Best-Practices/Index.md +++ b/docs/en/Best-Practices/Index.md @@ -23,5 +23,5 @@ Also, this guide is mostly usable for general **application development**. * [Data Transfer Objects](Data-Transfer-Objects.md) * Data Access * [Entity Framework Core Integration](Entity-Framework-Core-Integration.md) - * [MongoDB Integration](MongoDB-Integration.md) + * [MongoDB Integration](MongoDB-Integration.md) diff --git a/docs/en/Best-Practices/PostgreSQL-Integration.md b/docs/en/Best-Practices/PostgreSQL-Integration.md index f4fe71fdb9..93c178d07c 100644 --- a/docs/en/Best-Practices/PostgreSQL-Integration.md +++ b/docs/en/Best-Practices/PostgreSQL-Integration.md @@ -6,23 +6,22 @@ - In `Acme.BookStore.EntityFrameworkCore` project replace package `Volo.Abp.EntityFrameworkCore.SqlServer` with `Volo.Abp.EntityFrameworkCore.PostgreSql` - Update to use PostgreSQL in `BookStoreEntityFrameworkCoreModule`. +- Replace the `AbpEntityFrameworkCoreSqlServerModule` with the `AbpEntityFrameworkCorePostgreSqlModule` +- Replace the `options.UseSqlServer()` with the `options.UsePostgreSql()` +- In other projects update the PostgreSQL connection string in necessary `appsettings.json` files. -1. **Do** Replace the `AbpEntityFrameworkCoreSqlServerModule` with the `AbpEntityFrameworkCorePostgreSqlModule` -2. **Do** Replace the `options.UseSqlServer()` with the `options.UsePostgreSql()` +#### Delete Existing Migrations -### 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 +Delete all existing migration files (including `DbContextModelSnapshot`) ![postgresql-delete-initial-migrations](images/postgresql-delete-initial-migrations.png) -Then create a new migration class inside the `Migrations` folder. +#### Regenerate Initial Migration & Update the Database +Set the correct startup project (usually a web project), +Open the **Package Manager Console** (Tools -> Nuget Package Manager -> Package Manager Console), select the `Acme.BookStore.EntityFrameworkCore.DbMigrations` as the **Default project** and execute the following command: + +Run `Add-Migration` command. ```` PM> Add-Migration Initial ```` @@ -34,4 +33,3 @@ PM> Update-Database ```` ![postgresql-update-database](images/postgresql-update-database.png) - diff --git a/docs/en/docs-nav.json b/docs/en/docs-nav.json index 84ae0d99e3..fdb4a7797c 100644 --- a/docs/en/docs-nav.json +++ b/docs/en/docs-nav.json @@ -246,7 +246,7 @@ { "text": "Entity Framework Core Integration", "path": "Entity-Framework-Core.md", - "items": [ + "items": [ { "text": "PostgreSQL Integration", "path": "Best-Practices/PostgreSQL-Integration.md"