I have been using a connection string like this to connect my website to my database:
I finally solved this by adding the website_staging_migrations user to the db_datareader and db_datawriter roles as well as the db_ddladmin role.
The user obviously needs to read the data in the __MigrationHistory table. What threw me was that EF doesn't report the failure to access the table as an error and instead I got this error when it tried to run the initial migration:
There is already an object named '----' in the database.
And the user also needs to write to the __MigrationHistory table. I got this error until I added the user to the db_datawriter role:
The INSERT permission was denied on the object '__MigrationHistory',
database 'Staging', schema 'dbo'.