Names that keep themselves

By hand, every key, constraint and index name is typed, then kept up to date with every change. In ERDsmith you write the convention once, and every name follows the design.

-- dbo.MenuItem
PK__MenuItem__8943F72234CBA807
UQ__MenuItem__737584F69DF98684
CK__MenuItem__Price__534D60F1
-- dbo.OrderItem
PK__OrderIte__7C8B12149FBD3F90
FK__OrderItem__Table__5629CD9C
FK__OrderItem__MenuI__571DF1D5
DF__OrderItem__Quant__5812160E
SQL Server's names. Constraints created without a name, from one run on SQL Server: part of the table name and a hex number that differs in every database.
-- dbo.MenuItem
PK_MenuItem
AK_MenuItem_Name
CK_MenuItem_Price
-- dbo.OrderItem
PK_OrderItem
FK_OrderItem_TableOrder_TableOrderId
FK_OrderItem_MenuItem_MenuItemId
DF_OrderItem_Quantity
ERDsmith's names. The same constraints under the default templates, such as AK_{Table}_{Columns} and FK_{Table}_{ParentTable}_{Columns}.

01 · Templates

Write the convention once

A template is text with tokens in braces, like PK_{Table} or FK_{Table}_{ParentTable}_{Columns}. Each kind of name has one in the project settings, with a real name from your project previewed under it. A preset fills them all: ERDsmith (IDEF1X keys), the default, or EF Core, which names foreign key columns the way Entity Framework Core expects.

The project settings of makerspace, Naming: Preset ERDsmith (IDEF1X keys), then New key column {Table}Id, Primary key PK_{Table}, Alternate key AK_{Table}_{Columns} and Foreign key FK_{Table}_{ParentTable}_{Columns}, each with a preview from dbo.Member such as PK_Member.

02 · Changes

Names follow the design

Rename Workshop to Course and its key, its check, its default and the foreign key that points at it are renamed too, each one listed in the Output. Add a column to a key and the key’s name takes it in: AK_Member_Email becomes AK_Member_Email_DisplayName.

The Output: Table Workshop renamed to Course, 4 names follow: PK_Workshop to PK_Course, CK_Workshop_Capacity to CK_Course_Capacity, DF_Workshop_Category to DF_Course_Category, and in shop.Session FK_Session_Workshop_WorkshopCode to FK_Session_Course_WorkshopCode.

03 · Conventions

Change the convention in one step

Change a template and apply it, and every name that follows it is renamed at once; one undo puts them all back. Names you set yourself stay as they are, and the Output counts both: 4 names renamed, 1 set by you kept.

The Output: Primary key template PK_{Table} to PK_{Table}_{Columns}, 4 names renamed, 1 set by you kept; PK_Member to PK_Member_MemberId, PK_MemberNote to PK_MemberNote_MemberNoteId, PK_Booking to PK_Booking_WorkshopCode_SessionNo_MemberId and 1 more.

04 · Your names

Your names stay yours

Type a name of your own and it stays through renames and template changes, marked by an orange broken link at the end of its field. A click on the link hands the name back to its template. A generated name over 128 characters is cut to 128 characters, the last one ~, while Shorten long names is on. A name already taken in its scope gets the next free number, and when it is one you typed, the Output says so.

The key editor of shop.Session, Primary key PK_Session_Main: the Name field ends in an orange broken link, the mark of a name written by you.

By hand or by template

By handIn ERDsmith
Naming a new keytyped, then checked against the guidelinenamed from its template as you add it
Renaming a tableevery name built from it found and editednames follow, each one listed
Changing the conventionevery name in the schema retypedone step and one undo; your own names kept
A clash or a name over 128found when the script failsnumbered; a long generated name cut to fit

More on this