我在我的WEB Api项目中使用了Entity Framework。我使用代码优先迁移。
事情是:进行初始迁移并尝试更新数据库后,出现此错误
不正确使用空间/全文/哈希索引和显式索引顺序
这是由更新数据库中的此SQL命令引起的:
create table `Articles`
(
`articleId` int not null auto_increment ,
`title` longtext not null ,
`digest` longtext,
`content` longtext not null ,
`imgLink` longtext not null ,
`releaseDate` datetime,
`userId` int not null ,
primary key ( `articleId`)
) engine=InnoDb auto_increment=0
CREATE index `IX_userId` on `Articles` (`userId` DESC) using HASH
SQL命令是从迁移中的以下代码生成的:
CreateTable(
"dbo.Articles",
c => new
{
articleId = c.Int(nullable: false, identity: true),
title = c.String(nullable: false, unicode: false),
digest = c.String(unicode: false),
content = c.String(nullable: false, unicode: false),
imgLink = c.String(nullable: false, unicode: false),
releaseDate = c.DateTime(precision: 0),
userId = c.Int(nullable: false),
})
.PrimaryKey(t => t.articleId)
.ForeignKey("dbo.Users", t => t.userId, cascadeDelete: true)
.Index(t => t.userId);
似乎在创建索引时出现DESC和HASH会导致此错误。关于如何更改生成的sql索引创建的任何想法,使其与简单的索引一起使用?或者只是简单地绕过此错误,以便我的更新数据库可以通过?谢谢 !
阿晨1998
相关分类