Index Naming Convention
The unified naming convention is desired by developers. And the same applies to the database space. Bytebase provides this rule to unify the index naming convention.
About convention format
Index Naming Convention
uses template
format. Specifically, the template
is an extended regular expression. The rest follows the regular expression rules except the part with curly braces.
For example, ^idx_{{table}}_{{column_list}}$
is a template
where {{table}}
is the table name and {{column_list}}
is the list of the column name. So for index on user(id, name)
, the legal name is idx_user_id_name
.
How the rule works
Bytebase checks that all index names in DDL conform to the naming conventions.
Index Naming Convention
rule is only valid for index, which means it does NOT work for unique key, foreign key and primary key.
Also see unique key naming convention and foreign key naming convention.
Specifically, Bytebase checks:
CREATE TABLE
statementsALTER TABLE RENAME INDEX
statementsALTER TABLE ADD CONSTRAINT
statementsCREATE INDEX
statements
Support database engine
- MySQL
- TiDB
Support for PostgreSQL is coming soon.