Skip to main content

object-name-length

Why?#

Database vendors vary in what length of object (table, column, constraint etc) names they support. If your project works across multiple vendors, you might find a script could fail on some databases when it has already run successfully on some others, due to the object name length. This then requires manual intervention to fix, which is prone to further mistakes.

For example:

This rule will fail if the given maximum length is exceeded by the name for any:

  • Table
  • Column
  • View
  • Primary key
  • Foreign key constraint
  • Unique constraint
  • Index

Options#

  • maxLength - (number) the maximum length of the name of any schema object to be created

Example Usage#

{
"rules": {
"object-name-length": {
"maxLength": 63
}
}
}