简体   繁体   English

实体框架核心 - Database.Migration()

[英]Entity Framework Core - Database.Migration()

I would like to ask you if it is possible to proceed (in entity framework core):我想问你是否可以继续(在实体框架核心):

context.Database.Migrate();

using database user without ddladmin permissions?使用没有 ddladmin 权限的数据库用户?

What I would like to achieve:我想达到的目标:

User without permission should not update migrations (without errors).未经许可的用户不应更新迁移(无错误)。 However users with those kinds of permissions should be able to make migrations.但是,具有这些权限的用户应该能够进行迁移。

Currently, I am getting this kind of errors:目前,我收到这种错误:

System.Private.CoreLib: Exception while executing function: xxx. System.Private.CoreLib:执行 function 时出现异常:xxx。 Core Microsoft SqlClient Data Provider: CREATE TABLE permission denied in database 'xxxx'.核心 Microsoft SqlClient 数据提供程序:数据库“xxxx”中的 CREATE TABLE 权限被拒绝。

You have two options:你有两个选择:

  1. You give the user the db_ddladmin role你给用户db_ddladmin角色

  2. You add the create table grant to the user, like GRANT CREATE TABLE TO Joe AS dbo您向用户添加create table授权,例如GRANT CREATE TABLE TO Joe AS dbo

I think the second one is what you are looking for.我认为第二个是您正在寻找的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM