简体   繁体   中英

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?

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. Core Microsoft SqlClient Data Provider: CREATE TABLE permission denied in database 'xxxx'.

You have two options:

  1. You give the user the db_ddladmin role

  2. You add the create table grant to the user, like GRANT CREATE TABLE TO Joe AS dbo

I think the second one is what you are looking for.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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