dotnet / dotnet/efcore

When using SQL server replication when renaming a column the migration uses `sp_rename` which fails on db update.

Open
#37,662 5 comments 0 reactions 0 assignees View on GitHub
area-migrations area-sqlserver customer-reported
Dominant language
C#
Stars
14.8k
Forks
3.4k
PR merge metrics
PR metrics pending

Description

### What problem are you trying to solve?

Just had the following case:

Replication db setup in /prod/ not in /dev/ environment using mssql.
Applying the migration to /dev/ works but fails for /prod/ with the following message:

```
Microsoft.Data.SqlClient.SqlException (0x80131904): Cannot rename the table because it is published for replication.
```

### Describe the solution you'd like

I'd like to be able to mark my context as 'being replicated'.
Then migrations should not use the RenameColumn method in the generated migration.
It should either fault or generate an delete update.

Also a mention of this on the docs pages would be helpful:
https://learn.microsoft.com/en-us/ef/core/managing-schemas/migrations/managing?tabs=dotnet-core-cli#column-renames

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.