Added: section to EF core for postgresql

Updated: regenerate initial migration
pull/1689/head
Dillan Cagnetta 5 years ago
parent 63b8d82069
commit d726edb283

@ -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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

@ -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",

Loading…
Cancel
Save