azuremycry
azuremycry

Reputation: 122

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'.

Upvotes: 2

Views: 663

Answers (1)

Sean Stayns
Sean Stayns

Reputation: 4244

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.

Upvotes: 1

Related Questions