Question

We are using EF4.3 and Code First.

Our DBAs are keen to reduce the permissions developers have on the development database. But we've had many situations where we've been unable to create the database after it's been dropped when we call DropCreateDatabaseIfModelChanges

What are the minimum database permissions required for a user to be able to call both DropCreateDatabaseIfModelChanges and DropCreateDatabaseAlways?

Do these require different permissions?

Is there any documentation that I can refer our DBA's to that will help explain what is required?

Was it helpful?

Solution

Both initializers need permissions for dropping and creating database. These operations require very different permissions:

  • Database can be dropped by its owner - this permission is localized to the database (db_owner in SQL Server).
  • Database can be created only by the user with global server permission to create database - that is usually permission provided only to highly privileged users (dbcreator role in SQL Server)

You also need read access on Master database.

Btw. if this is related to development environment you should use your own local database server instead.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top