Browse Source

Added: section to EF core for postgresql

Updated: regenerate initial migration
pull/1689/head
Dillan Cagnetta 7 years ago
parent
commit
d726edb283
  1. 34
      docs/en/Best-Practices/PostgreSQL-Integration.md
  2. BIN
      docs/en/Best-Practices/images/postgresql-delete-initial-migrations.png
  3. BIN
      docs/en/Best-Practices/images/postgresql-update-database.png
  4. 8
      docs/en/docs-nav.json

34
docs/en/Best-Practices/PostgreSQL-Integration.md

@ -36,26 +36,28 @@ public class Acme.BookStore.EntityFrameworkCoreModule : AbpModule
} }
```` ````
### EntityFrameworkCore.DbMigrations Project Update ### Update Connection String Settings
- **Do** update to use PostgreSQL in `BookStoreMigrationsDbContextModelSnapshot.cs` - **Do** Update the PostgreSQL connection string in all `appsettings.json` files.
import `Npgsql.EntityFrameworkCore.PostgreSQL.Metadata` by adding ### 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:
````C# > Ensure your startup project is correcty set.
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
```` #### Delete Existing Initial Migrations
replace all references ![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 ![postgresql-update-database](images/postgresql-update-database.png)
> Update the PostgreSQL connection string in all `appsettings.json` files

BIN
docs/en/Best-Practices/images/postgresql-delete-initial-migrations.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
docs/en/Best-Practices/images/postgresql-update-database.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

8
docs/en/docs-nav.json

@ -245,7 +245,13 @@
"items": [ "items": [
{ {
"text": "Entity Framework Core Integration", "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", "text": "MongoDB Integration",

Loading…
Cancel
Save