Normalize all constraints’ & indices’ names

Constraints that are created by SSMA or by user via SSMS tend to have ugly names. Worse, auto-generated names are not stable across backups. Meaning if you restore a new database based on a copy of another database, the constraint names will change. That create huge problems during migrations because scripts that references constraint will fail. This script helps us clean up all non-standard naming and use our own naming convention uniformly.

Default Constraints

Foreign Key Constraints

Check Constraints

Primary Key Constraints

Unique Constraints

Unique Index