These days you can just add the following to your .editorconfig file:
.editorconfig
# Do not apply code styles to generated migration files [**/Migrations/*.cs] generated_code = true