2

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

2
  • I don't understand your question. You want to avoid the Migration if the user don't have the permission? Commented Apr 20, 2021 at 9:58
  • 1
    If user does not have ddladmin permission he gets "Create Table permission" error. Commented Apr 20, 2021 at 10:01

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Note that migrations entail more than just table creation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.