ABP 框架使用postgresql数据库

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

研究了好久了

1. 在“*.EntityFramework”和“*.Web”两个项目安装npgsql和npgsql 的entityframework支持

Install-Package Npgsql
Install-Package EntityFramework6.Npgsql

2. web.config配置


    
    
      
      
    


    
      
      
    


    
    

3.  删除“*.EntityFramework”项目中 Migrations 路径下除 "Seed"文件夹和“Configuration.cs”文件的其他文件

4. 修改“*.EntityFramework”项目中 Migrations 路径下的“Configuration.cs”文件

public Configuration()
{
    AutomaticMigrationsEnabled = false;
    ContextKey = "AbpZeroTemplate";
    SetSqlGenerator("Npgsql", new Npgsql.NpgsqlMigrationSqlGenerator()); //添加
}

5. 将“*.Web”项目设为启动项目,打开 程序包管理器控制台,将“*.EntityFramework”项目设置 程序包管理器控制台的默认项目,开始数据库迁移

Add-Migration "AbpZero_Installed"

6. 运行上诉命令后,在“*.EntityFramework”项目中Migrations 路径下生成了“********_Installed.cs”的文件。打开此文件检查如下内容maxLength是否超过10485760,若大于10485760,则修改为10485760

搜索 AbpBackgroundJobs 的 JobArgs

搜索 AbpLanguageTexts  的 Value

搜索 AbpNotifications   的 Data,UserIds,enantIds,ExcludedUserIds

搜索 AbpTenantNotifications      的 Data

搜索 AppBinaryObjects          的 Bytes

搜索 AppChatMessages     的 Message

搜索 AppFriendships         的 FriendTenancyName

 7. 打开 程序包管理器控制台,运行 Update-Database

Update-Database

 

转载于:https://my.oschina.net/u/138005/blog/758706

你可能感兴趣的:(ABP 框架使用postgresql数据库)