Entity framework code first migrations, sql user permissions?

 ̄綄美尐妖づ 提交于 2019-12-31 21:22:12

问题


What is the minimal permission needed on a sql server user/login for it to be able to run entity framework code first database migrations?

I naively would have thought that a user with the roles db_datareader, db_datawriter, Grant Alter on the Schema and Grant Create Table would be permissive enough.


回答1:


you need following permision on the database.

[db_datareader]
[db_datawriter]
[db_ddladmin]

For full control over database use

[db_owner]



回答2:


Clearly it depends on what your migrations are/(will be) doing. For my use case, I ended up creating a shema, and restricting the user that the migration uses to the permissions below.

GRANT ALTER, INSERT, SELECT, DELETE, UPDATE, REFERENCES ON SCHEMA::schema_name TO migration_user
GRANT CREATE TABLE TO migration_user


来源:https://stackoverflow.com/questions/29830474/entity-framework-code-first-migrations-sql-user-permissions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!