Primary source code migrations, sql user permissions?

What is the minimum permission required for a user / login for a sql server user to be able to run primary migrations of an entity database?

I would naively think that a user with the roles db_datareader, db_datawriter, Grant Alter in the schema and Grant Create Table would be quite permissive.

+6
source share
2 answers

you need the following permission for the database.

[db_datareader] [db_datawriter] [db_ddladmin] 

For complete database management

 [db_owner] 
+15
source

Clearly, this depends on what kind of migrations you will be doing (will be). In my use case, I finished creating shema and limited the user to the fact that the migration uses the permissions below.

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

Source: https://habr.com/ru/post/985810/


All Articles