Update PostgreSQL Integration document.

pull/1701/head
maliming 6 years ago
parent 82767d9a0c
commit fec447a4e7

@ -23,5 +23,5 @@ Also, this guide is mostly usable for general **application development**.
* [Data Transfer Objects](Data-Transfer-Objects.md) * [Data Transfer Objects](Data-Transfer-Objects.md)
* Data Access * Data Access
* [Entity Framework Core Integration](Entity-Framework-Core-Integration.md) * [Entity Framework Core Integration](Entity-Framework-Core-Integration.md)
* [MongoDB Integration](MongoDB-Integration.md) * [MongoDB Integration](MongoDB-Integration.md)

@ -6,23 +6,22 @@
- In `Acme.BookStore.EntityFrameworkCore` project replace package `Volo.Abp.EntityFrameworkCore.SqlServer` with `Volo.Abp.EntityFrameworkCore.PostgreSql` - In `Acme.BookStore.EntityFrameworkCore` project replace package `Volo.Abp.EntityFrameworkCore.SqlServer` with `Volo.Abp.EntityFrameworkCore.PostgreSql`
- Update to use PostgreSQL in `BookStoreEntityFrameworkCoreModule`. - 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` #### Delete Existing Migrations
2. **Do** Replace the `options.UseSqlServer()` with the `options.UsePostgreSql()`
### Update Connection String Settings Delete all existing migration files (including `DbContextModelSnapshot`)
- **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) ![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 PM> Add-Migration Initial
```` ````
@ -34,4 +33,3 @@ PM> Update-Database
```` ````
![postgresql-update-database](images/postgresql-update-database.png) ![postgresql-update-database](images/postgresql-update-database.png)

@ -246,7 +246,7 @@
{ {
"text": "Entity Framework Core Integration", "text": "Entity Framework Core Integration",
"path": "Entity-Framework-Core.md", "path": "Entity-Framework-Core.md",
"items": [ "items": [
{ {
"text": "PostgreSQL Integration", "text": "PostgreSQL Integration",
"path": "Best-Practices/PostgreSQL-Integration.md" "path": "Best-Practices/PostgreSQL-Integration.md"

Loading…
Cancel
Save