Last active
September 7, 2015 08:11
-
-
Save tompazourek/6b9a7ff9e4c24701d9f8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- When renaming tables or moving schemas in Entity Framework, EF doesn't rename all related things (like FKs and PKs) | |
-- This might help to locate those database objects: | |
-- selects FKs and PKs with schema 'Core.' in their name | |
SELECT s.name, o.name FROM sys.objects AS o | |
INNER JOIN sys.schemas AS s ON s.schema_id = o.schema_id | |
WHERE o.name LIKE '%Slug%' OR o.name LIKE '%PageMetadata%' | |
-- performs renaming | |
sp_rename '[Inventory].[FK_Inventory.BaseProduct_Core.PageMetadata_PageMetadata_Id]', 'FK_Inventory.BaseProduct_Navigation.PageMetadata_PageMetadata_Id' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment