Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: update sql review locales (#5202)
boojack1e03b37d8203
diff --git a/frontend/src/components/SQLReview/components/SQLRuleTable.vue b/frontend/src/components/SQLReview/components/SQLRuleTable.vueindex 86fc86d320..a78ceb0515 100644--- a/frontend/src/components/SQLReview/components/SQLRuleTable.vue+++ b/frontend/src/components/SQLReview/components/SQLRuleTable.vue@@ -79,6 +79,14 @@{{ editable ? $t("common.edit") : $t("common.view") }}</button></div>+ <div+ v-if="getRuleLocalization(rule.type).description"+ class="bb-grid-cell col-span-full pl-24 border-t-0"+ >+ <p class="w-full text-left pl-2 text-gray-500 -mt-2 mb-1">+ {{ getRuleLocalization(rule.type).description }}+ </p>+ </div></template></BBGrid></template>diff --git a/frontend/src/locales/sql-review/en-US.json b/frontend/src/locales/sql-review/en-US.jsonindex b3964e8fdb..730df4849c 100644--- a/frontend/src/locales/sql-review/en-US.json+++ b/frontend/src/locales/sql-review/en-US.json@@ -25,20 +25,20 @@},"rule": {"engine-mysql-use-innodb": {- "title": "Use Innodb",- "description": "Require InnoDB as the storage engine for MySQL."+ "title": "Enforce InnoDB storage engine",+ "description": "InnoDB is the default storage engine for MySQL that provides transaction support. It also provides better performance for high-concurrency and low-latency scenarios, and supports online data backup and recovery. It is the preferred choice for OLTP businesses. Suggestion error level: Error"},"table-require-pk": {- "title": "Require primary key",- "description": "Require the table to have a primary key."+ "title": "Enforce inclusion of primary key in a table",+ "description": "In addition to carry business meaning, primary key are also beneficial for high-concurrency queries in MySQL. Various data synchronization, comparison, and rollback tools often require tables to have primary key. Suggestion error level: Error"},"table-no-foreign-key": {- "title": "No foreign key",- "description": "Disallow the foreign key in the table."+ "title": "Prohibit using foreign key constraints",+ "description": "The advantages and disadvantages of foreign key are highly controversial. Using foreign key may significantly increase the difficulty of database changes, scalability (such as sharding), etc. And may even prevent the use of some tools. Therefore, another option is to implement foreign key constraints at the application layer. Suggestion error level: Warning"},"table-drop-naming-convention": {- "title": "Drop table with naming convention",- "description": "Only tables named with specific patterns can be deleted. The requires users to do a rename before dropping the table. The table name must have \"_del\" suffix by default.",+ "title": "Restrict the naming format of tables to be deleted",+ "description": "For example, by requring the \"_del\" suffix, it can effectively prevent accidental deletions. Suggestion error level: Error","component": {"format": {"title": "Table name format (regex)"@@ -46,8 +46,8 @@}},"table-disallow-partition": {- "title": "Disallow partition",- "description": ""+ "title": "Prohibit using partition table",+ "description": "In some database engines, partitioned tables are not mature, and the use and maintenance are inconvenient. Therefore, it is more inclined to use manual data partitioning methods such as database and table sharding. Suggestion error level: Warning"},"table-comment": {"title": "Comment convention",@@ -62,8 +62,8 @@}},"naming-table": {- "title": "Table naming check",- "description": "Enforce the table name format and length limit. Default snake_lower_case with 63 characters.",+ "title": "Enforce table naming format",+ "description": "The default format is all lowercase letters, separated by underscores between words, and no more than 63 characters long, such as \"abc\" and \"abc_def\". Suggestion error level: Warning","component": {"format": {"title": "Table name format (regex)"@@ -74,8 +74,8 @@}},"naming-column": {- "title": "Column naming check",- "description": "Enforce the column name format and length limit. Default snake_lower_case with 63 characters.",+ "title": "Enforce column naming format",+ "description": "The default format is all lowercase letters, separated by underscores between words, which is no more than 63 characters long, such as \"abc\" and \"abc_def\". Suggestion error level: Warning","component": {"format": {"title": "Column name format (regex)"@@ -86,8 +86,8 @@}},"naming-index-uk": {- "title": "Unique key naming check",- "description": "Enforce the unique key name format and length limit. Default uk_<table_name>_<column_list> or empty within 63 characters.",+ "title": "Enforce unique key naming format",+ "description": "The name is allowed to be empty and named by the database. If not empty, the default format is \"uk_<table name>_<unique key column name combination>\", which is no more than 63 characters long, such as \"uk_my_table_id_name\". Suggestion error level: Warning","component": {"format": {"title": "Unique key name format",@@ -102,8 +102,8 @@}},"naming-index-pk": {- "title": "Primary key naming check",- "description": "Enforce the primary key name format and length limit. Default pk_<table_name>_<column_list> or empty within 63 characters.",+ "title": "Enforce primary key naming format",+ "description": "The name is allowed to be empty and named by the database. If not empty, the default format is \"pk_<table name>_<unique key column name combination>\", which is no more than 63 characters long, such as \"pk_my_table_id_name\". Suggestion error level: Warning","component": {"format": {"title": "Primary key name format",@@ -118,8 +118,8 @@}},"naming-index-fk": {- "title": "Foreign key naming check",- "description": "Enforce the foreign key name format and length limit. Default fk_<referencing_table>_<referencing_column>_<referenced_table>_<referenced_column> or empty within 63 characters.",+ "title": "Enforce foreign key naming format",+ "description": "The name is allowed to be empty and named by the database. If not empty, the default format is \"fk_<table name>_<unique key column name combination>\", which is no more than 63 characters long, such as \"fk_my_table_id_name\". Suggestion error level: Warning","component": {"format": {"title": "Foreign key name format",@@ -136,8 +136,8 @@}},"naming-index-idx": {- "title": "Index naming check",- "description": "Enforce the index name format and length limit. Default idx_<table_name>_<column_list> or empty within 63 characters.",+ "title": "Enforce index naming format",+ "description": "The name is allowed to be empty and named by the database. If not empty, the default format is \"idx_<table name>_<unique key column name combination>\", which is no more than 63 characters long, such as \"idx_my_table_id_name\". Suggestion error level: Warning","component": {"format": {"title": "Index name format",@@ -152,8 +152,8 @@}},"naming-column-auto-increment": {- "title": "Auto-increment column naming check",- "description": "Enforce the auto-increment column name format and length limit. Default id within 63 characters.",+ "title": " Enforce auto-increment column naming format",+ "description": "The default column name is \"ID\", and is no more than 63 characters long.","component": {"format": {"title": "Auto-increment column name format (regex)"@@ -164,8 +164,8 @@}},"column-required": {- "title": "Required columns",- "description": "Enforce the required columns in each table.",+ "title": "Enforce the inclusion of specific columns in a table",+ "description": "Some common columns are helpful for better application maintenance. For example, adding a business-independent \"ID\" column as the primary key avoids primary key conflicts caused by business changes (such as business mergers), and in some scenarios can also bring better data insertion performance. Suggested error level: Warning","component": {"list": {"title": "Required column names"@@ -173,8 +173,8 @@}},"column-type-disallow-list": {- "title": "Type disallow list",- "description": "Set the disallow list for column type.",+ "title": "Prohibit the use of certain column data types",+ "description": "Abusing column types can have serious negative effects on system maintainability and performance. For example, using \"LOB\" column to store large amounts of audio and video data may cause database performance to decrease, backup and recovery times to lengthen, and data synchronization tools incompatible. Suggested error level: Error","component": {"list": {"title": "Disallow list"@@ -182,40 +182,40 @@}},"column-no-null": {- "title": "Disallow NULL",+ "title": "Enforce \"NOT NULL\" constraints on columns","description": "Columns cannot have NULL value."},"column-disallow-set-charset": {- "title": "Disallow set charset",- "description": "Disallow set charset for column."+ "title": "Prohibit defining character set in column properties",+ "description": "It is recommended to set the charset at the database level or table level. Setting the charset at finer granularity can bring unnecessary complexities. Suggested error level: Error."},"column-disallow-change-type": {- "title": "Disallow changing type",- "description": "Disallow change column type."+ "title": "Prohibit modifying column types",+ "description": "Modifying column types may affect system performance, maintainability, and even lead to data loss. Suggested error level: Warning"},"column-disallow-change": {- "title": "Disallow \"CHANGE COLUMN\" statement",- "description": ""+ "title": "Prohibit using \"CHANGE COLUMN\" statement",+ "description": "\"CHANGE COLUMN\" is unique to MySQL syntax and can be used to modify column names and other properties at the same time. However, it may cause the column name to be mistakenly changed when modifying properties. It is recommended to still use standard \"RENAME\" and \"MODIFY\" statements to distinguish between the two types of changes. Suggested error level: Error"},"column-disallow-changing-order": {- "title": "Disallow changing order",- "description": "Disallow changing column order."+ "title": "Prohibit changing the order of columns in a table",+ "description": "Modifying the order of columns may cause some applications or views that depend on the default order of the original table to produce unexpected results, such as \"select *\". Suggested error level: Warning"},"column-set-default-for-not-null": {- "title": "Set default value for NOT NULL column",- "description": "Require default value for not NULL column."+ "title": "Enforce default value on \"NOT NULL\" columns",+ "description": "Existing NULL data will be incompatible with this rule, and the legacy application code inserting NULL value will throw error. Suggested error level: Error"},"column-auto-increment-must-integer": {- "title": "Use integer for auto-increment column",- "description": "Auto-increment column requires integer type."+ "title": "Enforce the use of \"INTEGER\" data type for auto-increment columns",+ "description": "MySQL's auto-increment column are generally used as business-independent primary key. Using integer types occupies less storage space and makes the primary key index structure more compact, bringing better query and DML performance. Suggested error level: Error"},"column-auto-increment-must-unsigned": {- "title": "Set unsigned attribute on auto-increment column",- "description": "Auto-increment column must be the UNSIGNED type."+ "title": "Enforce the use of \"UNSIGNED\" data type for auto-increment columns",+ "description": "Unsigned types do not store negative numbers, and the range of values that can be stored by the same type is doubled, which can avoid auto-increment columns overflow. Suggested error level: Warning"},"column-comment": {- "title": "Comment convention",- "description": "Configure whether the column requires comments and the maximum comment length.",+ "title": "Enforce adding comments to columns",+ "description": "Adding comments to columns is a good development practice, but excessively long comments can decrease the readability of the schema.Suggested error level: Warning","component": {"required": {"title": "Require comment"@@ -226,8 +226,8 @@}},"column-maximum-character-length": {- "title": "Maximum CHAR length",- "description": "Force to change CHAR to VARCHAR if maximum length is reached.",+ "title": "Restrict the length of \"CHAR\" data type",+ "description": "\"CHAR\" is a fixed-length type. For example, the CHAR(20) column will occupy 20 character spaces even if only one character is stored, causing waste. When the string is too long and the length is not fixed, consider using VARCHAR for MySQL and using TEXT for PostgreSQL. Suggestion error level: Error","component": {"number": {"title": "Maximum length"@@ -235,8 +235,8 @@}},"column-auto-increment-initial-value": {- "title": "Auto-increment initial value",- "description": "Set initial value for auto-increment column.",+ "title": "Restrict the initial value of auto-increment columns",+ "description": "based on management requirements to limit the initial value of the auto-increment column. Suggestion error level: Warning","component": {"number": {"title": "Initial value"@@ -244,52 +244,52 @@}},"column-current-time-count-limit": {- "title": "Limit the count of current time columns",- "description": "Limit the count of NOW(), CURRENT_TIME() and CURRENT_TIMESTAMP() columns."+ "title": "Restrict the number of columns in the table that acquire system time",+ "description": "Only columns recording the creation time of the record with \"DEFAULT NOW()\" and recording the update time of the record with \"DEFAULT NOW() ON UPDATE\" need to call function to get system time. It is meaningless and will increase resource overhead to record system time in other columns. Suggestion error level: Error"},"column-require-default": {- "title": "Require column default value",- "description": ""+ "title": "Enforce setting default value on columns",+ "description": "Setting default values that satisfy business logic can effectively improve the data quality of downstream analytical pipeline. This rule does not check \"PRIMARY KEY\", \"JSON\", \"BLOB\", \"TEXT\", \"GEOMETRY\", \"AUTO_INCREMENT\", \"GENERATED\" types. Suggestion error level: Warning"},"statement-select-no-select-all": {- "title": "Disallow \"SELECT *\"",- "description": "Disallow 'SELECT *' statement."+ "title": "Prohibit using \"SELECT *\"",+ "description": "SELECT * to fetch entire row data may cause unnecessary resource overhead and may also cause unexpected results in applications once the table adds or removes columns. Suggestion error level: Error"},"statement-where-require": {- "title": "Require \"WHERE\"",- "description": "Require 'WHERE' clause."+ "title": "Enforce the presence of \"WHERE\" condition in statements",+ "description": "Queries without WHERE clause may cause huge uncessary resource overhead, and DMLs may cause massive accidental data loss. Suggestion error level: Error"},"statement-where-no-leading-wildcard-like": {- "title": "Disallow leading wildcard like",- "description": "Disallow leading '%' in LIKE, e.g. LIKE foo = '%x' is not allowed."+ "title": "Prohibit using leading wildcard in filter conditions",+ "description": "When using leading wildcard, such as \"LIKE '%ABC'\", the database optimizer cannot use fast index scan, and fallback to full table scan or full index scan, which may cause serious performance impact. Suggestion error level: Error"},"statement-disallow-commit": {- "title": "Disallow commit",- "description": "Disallow using commit in the issue."+ "title": "Prohibit explicit \"COMMIT\" statement",+ "description": "In some cases, multiple statements are required to be included in a transaction committed by the system, in order to quickly rerun in case of partial failure. Therefore, explicit \"COMMIT\" is not allowed. Suggestion error level: Warning"},"statement-disallow-limit": {- "title": "Disallow \"LIMIT\"",- "description": "Disallow \"LIMIT\" for \"INSERT\", \"UPDATE\", \"DELETE\" statement."+ "title": "Prohibit using \"LIMIT\" clause in DML statements",+ "description": "If LIMIT is used in DML statements without an ORDER BY clause, the affected rows order are not fixed, which may cause data inconsistency between the primary and replica databases in some replication modes. Suggestion error level: Error"},"statement-disallow-order-by": {- "title": "Disallow \"ORDER BY\"",- "description": "Disallow \"ORDER BY\" for \"UPDATE\", \"DELETE\" statement."+ "title": "Prohibit using \"ORDER BY\" clause in \"UPDATE\" and \"DELETE\" statements",+ "description": "Sorting operations are extremely resource-intensive, so for update and delete operations, it is recommended to use a deterministic filtering condition as much as possible instead of using ORDER BY and LIMIT. Suggestion error level: Error"},"statement-merge-alter-table": {- "title": "Merge \"ALTER TABLE\"",- "description": "Disallow using multiply \"ALTER TABLE\" statement for same table."+ "title": "Prohibit issuing multiple independent changes on the same table",+ "description": "Every change to a table may cause a table-level lock and consume a large amount of resources. If there are multiple changes to the same table, they should be merged into a single change statement. Suggestion error level: Error"},"statement-insert-must-specify-column": {- "title": "\"INSERT\" statement must specify column",- "description": "Must specify the column to insert. For example, \"INSERT INTO t (id,name) VALUES(...)\"."+ "title": "Enforce specifying column names in \"INSERT\" statements",+ "description": "The \"INSERT INTO table VALUES (...)\" statement does not explicit list column names. Once the column order changes or columns are added or dropped, the statement may faile or generate unexpected data. Suggestion error level: Error"},"statement-insert-disallow-order-by-rand": {- "title": "Disallow \"ORDER BY rand()\" statement",- "description": ""+ "title": "Prohibit using \"ORDER BY rand()\" in \"INSERT\" statement",+ "description": "Randomly sorting the data to be inserted is meaningless and will only consume uncessary resources. Suggestion error level: Error"},"statement-insert-row-limit": {- "title": "Insert row limit",- "description": "",+ "title": "Restrict the maximum number of inserted rows",+ "description": "Reveal the number of rows to be inserted can help determine whether the statement meets business expectations. Suggestion error level: Warning","component": {"number": {"title": "Maximum insert amount"@@ -297,8 +297,8 @@}},"statement-affected-row-limit": {- "title": "Affected row limit",- "description": "Limit the \"DELETE\" and \"UPDATE\" affected row",+ "title": "Restrict the maximum number of updated or deleted rows.",+ "description": "Reveal the number of rows to be updated or deleted can help determine whether the statement meets business expectations. Suggestion error level: Warning","component": {"number": {"title": "Maximum affected rows"@@ -306,44 +306,44 @@}},"statement-dml-dry-run": {- "title": "Dry run DML statements",- "description": "Dry run DML statements by EXPLAIN."+ "title": "Validate the executability of DML statements",+ "description": "When the syntax is correct, but the table name is incorrect or the permission is insufficient, it can be discovered by dry run before the actual execution. Suggestion error level: Warning"},"statement-disallow-add-column-with-default": {- "title": "Disallow add column with default",- "description": "The PostgreSQL will lock the table and rewrite the whole table when you adding column with default value. You can separate the adding column, setting default value and backfilling all existing rows."+ "title": "Restrict adding columns with default values to a table",+ "description": "Before PostgreSQL 11, adding a column with a default value cause table locking and unable to read and write, which may cause business interruption. In PostgreSQL 11 and above, this issue has been optimized and there is no need to pay attention to this rule. Suggestion error level: Warning"},"statement-add-check-not-valid": {- "title": "Add CHECK constraints with NOT VALID option",- "description": "Adding CHECK constraints without NOT VALID can cause downtime because it blocks reads and writes. You can manually verify all rows and validate the constraint after creating."+ "title": "Enforce including \"NOT VALID\" option when adding \"CHECK\" constraints",+ "description": "Before PostgreSQL 11, adding a CHECK constraint need to verify the existing data and lock the table. This blocks read and write, which may cause business interruption. It is recommended to add the \"NOT VALID\" option to validate new data and manually validate existing data after the change is completed. In PostgreSQL 11 and above, this issue has been optimized and there is no need to pay attention to this rule. Suggestion error level: Warning"},"statement-disallow-add-not-null": {- "title": "Disallow add NOT NULL constraints to an existing column",- "description": "It can cause downtime because it blocks reads and writes. You can add CHECK constraints with NOT VALID option to avoid this."+ "title": "Restrict adding \"NOT NULL\" constraint to existing columns",+ "description": "Before PostgreSQL 11, adding a NOT NULL constraint need to verify the existing data. This blocks read and write, which may cause business interruption. In PostgreSQL 11 and above, this issue has been optimized and there is no need to pay attention to this specification. Suggestion error level: Warning"},"schema-backward-compatibility": {- "title": "Backward compatibility",- "description": "MySQL and TiDB support checking whether the schema change is backward compatible."+ "title": "Check application backward compatibility",+ "description": "Some changes may affect running applications, such as modifying the name of database object, adding new constraints, etc. This rule can avoid careless changes that lead to the failure of existing application. Suggestion error level: Warning"},"database-drop-empty-database": {- "title": "Drop database restriction",- "description": "Can only drop the database if there's no table in it."+ "title": "Prohibit deleting non-empty database",+ "description": "Deletion is only allowed when there are no tables in the database, which can greatly avoid accidental deletion. Suggested error level: Error"},"index-no-duplicate-column": {- "title": "Disallow duplicate column",- "description": ""+ "title": "Prohibit indexes containing duplicate columns",+ "description": "Creating an index with duplicate columns will result in failure. Suggestion error level: Error"},"index-type-no-blob": {- "title": "Disallow BLOB",- "description": "Disallow using BLOB type column in index."+ "title": "Prohibit creating indexes on \"BLOB\" and \"TEXT\" data type columns",+ "description": "The \"BLOB\" type is usually used to store binary data and should not be used as a query condition. If an index is created on this column type by mistake, it will consume a lot of resources and cause serious performance impact. Suggestion error level: Error"},"index-pk-type-limit": {"title": "Primary key type limit","description": "Enforce the primary key type to be INT or BIGINT."},"index-key-number-limit": {- "title": "Column count limit in index",- "description": "Limit the related row count in a single index.",+ "title": "Restrict the number of columns in a single index",+ "description": "A composite index with over 5 columns does not significantly improve query performance, but it occupies a lot of space and reduces DML performance. Suggestion error level: Warning","component": {"number": {"title": "Maximum column count"@@ -351,8 +351,8 @@}},"index-total-number-limit": {- "title": "Index count limit",- "description": "",+ "title": "Restrict the number of indexes on a single table",+ "description": "Although indexes can improve query performance, they also occupy a lot of space and reduce DML performance. Therefore, it is not recommended to create more than 5 indexes in a table. Suggestion error level: Warning","component": {"number": {"title": "Maximum index count"@@ -360,8 +360,8 @@}},"index-primary-key-type-allowlist": {- "title": "Primary key type allow list",- "description": "",+ "title": "Allowable list of primary key types",+ "description": "The appropriate primary key type can optimize storage structure, reduce space usage, and beneficial for insert and query performance. Suggestion error level: Warning","component": {"list": {"title": "Allow list"@@ -369,12 +369,12 @@}},"index-create-concurrently": {- "title": "Create indexes concurrently",- "description": "Creating indexes blocks writes (but not reads) on the table until it's done. Use CONCURRENTLY when creates indexes can allow writes to continue."+ "title": "Enforce concurrent index creation",+ "description": "In PostgreSQL 11 and above, using the standard statement to create an index will cause table locking and unable to write. Using the \"CONCURRENTLY\" mode can avoid this problem. Suggestion error level: Warning"},"system-charset-allowlist": {- "title": "Charset allow list",- "description": "",+ "title": "Allowable list of Charset",+ "description": "The character set determines which characters can be stored in the table. Using the wrong character set may result in certain characters in the application being unable to be stored and displayed correctly, such as CJK and Emoji. Suggested error level: Error","component": {"list": {"title": "Allow list"@@ -382,8 +382,8 @@}},"system-collation-allowlist": {- "title": "Collation allow list",- "description": "",+ "title": "Allowable list of Collation",+ "description": "The collation determines the rules for character comparison and sorting. For example, when using a case-insensitive collation, \"ABC\" and \"abc\" will be treated as the same string in queries. Suggested error level: Error","component": {"list": {"title": "Allow list"@@ -391,7 +391,7 @@}},"system-comment-length": {- "title": "Comment length limit",+ "title": "Restrict the length of comments","description": "","component": {"number": {diff --git a/frontend/src/locales/sql-review/zh-CN.json b/frontend/src/locales/sql-review/zh-CN.jsonindex cf9c5e996b..e3be89467a 100644--- a/frontend/src/locales/sql-review/zh-CN.json+++ b/frontend/src/locales/sql-review/zh-CN.json@@ -26,20 +26,20 @@},"rule": {"engine-mysql-use-innodb": {- "title": "使用 InnoDB 作为储存引擎",- "description": "强制要求使用 InnoDB 作为 MySQL 的储存引擎。"+ "title": "强制使用 InnoDB 存储引擎",+ "description": "InnoDB 是 MySQL 默认的存储引擎,能够确保事务一致性,同时对高并发低延迟的场景有更好的性能表现,还可以支持在线数据备份与恢复,是 OLTP 业务的首选。建议错误等级:错误"},"table-require-pk": {- "title": "强制主键",- "description": "要求每张表必须有一个主键。"+ "title": "强制表包含主键",+ "description": "主键除了有业务上的价值,在 MySQL 中还对高并发查询有益,同时各种数据同步、比对、回滚的工具往往也要求表有主键。建议错误等级:错误"},"table-no-foreign-key": {- "title": "禁止外键",- "description": "禁止给表创建外键。"+ "title": "禁止使用外键约束",+ "description": "外键的优缺点争议较大,使用外键可能导致数据库变更、扩展(如分库)等工作的难度明显增加,甚至无法使用一些工具。因此可以考虑在应用层实现外键约束。建议错误等级:警告"},"table-drop-naming-convention": {- "title": "待删除表的命名规范",- "description": "只有符合命名规范的表才可以被删除,通过强制用户在删除前重命名来避免误删。默认情况下待删除表名必须以 \"_del\" 结尾。",+ "title": "限制待删除表的命名格式",+ "description": "通过重命名待删除表,例如增加 _del 后缀,可以有效避免误操作发生。建议错误等级:错误","component": {"format": {"title": "命名规则(正则)"@@ -47,8 +47,8 @@}},"table-disallow-partition": {- "title": "禁止分区",- "description": ""+ "title": "禁止使用分区表",+ "description": "在一些数据库引擎中,分区表技术并不成熟,使用与维护都较为不便,因此更倾向于通过分库分表等方式进行人工数据分区。建议错误等级:警告"},"table-comment": {"title": "注释检查",@@ -63,8 +63,8 @@}},"naming-table": {- "title": "表名命名检查",- "description": "限制表名命名风格和长度,默认为小写字母_下划线,且不超过 63 个字符。",+ "title": "强制表命名格式",+ "description": "默认格式为全小写字母,单词之间以下划线分割,长度不超过 63 个字符,例如 \"abc\",\"abc_def\"。建议错误等级:警告","component": {"format": {"title": "表命名规则(正则)"@@ -75,8 +75,8 @@}},"naming-column": {- "title": "列名命名检查",- "description": "限制列名命名风格和长度,默认为小写字母_下划线,且不超过 63 个字符。",+ "title": "强制列命名格式",+ "description": "默认格式为全小写字母,单词之间以下划线分割,长度不超过 63 个字符,例如 \"abc\",\"abc_def\"。建议错误等级:警告","component": {"format": {"title": "列命名规则(正则)"@@ -87,8 +87,8 @@}},"naming-index-uk": {- "title": "唯一键命名检查",- "description": "限制唯一键命名风格和长度,默认为 uk_<表名>_<主键包含的字段名组合> 或空,且不超过 63 个字符。",+ "title": "强制唯一键命名格式",+ "description": "允许名字为空并由数据库自动命名,若非空则默认格式为 uk_<表名>_<唯一键包含的列名组合> ,且不超过 63 个字符,例如 \"uk_my_table_id_name\"。建议错误等级:警告","component": {"format": {"title": "唯一键命名规则",@@ -103,8 +103,8 @@}},"naming-index-pk": {- "title": "主键命名检查",- "description": "限制主键命名风格和长度,默认为 pk_<表名>_<主键包含的字段名组合> 或空,且不超过 63 个字符。",+ "title": "强制主键命名格式",+ "description": "允许名字为空并由数据库自动命名,若非空则默认格式为 pk_<表名>_<主键包含的列名组合> ,且不超过 63 个字符,例如 \"pk_my_table_id_name\"。建议错误等级:警告","component": {"format": {"title": "主键命名规则",@@ -119,8 +119,8 @@}},"naming-index-fk": {- "title": "外键命名检查",- "description": "限制外键命名风格和长度,默认为 fk_<目标表名>_<目标字段名>_<被引用表名>_<被引用字段名> 或空,且不超过 63 个字符。",+ "title": "强制外键命名格式",+ "description": "允许名字为空并由数据库自动命名,若非空则默认格式为 fk_<目标表名>_<目标列名>_<被引用表名>_<被引用列名>,且不超过 63 个字符,例如 \"fk_my_table_id_foreign_table_id\"。","component": {"format": {"title": "外键命名规则",@@ -137,8 +137,8 @@}},"naming-index-idx": {- "title": "索引命名检查",- "description": "限制索引命名风格和长度,默认为 idx_<表名>_<索引包含的字段名组合> 或空,且不超过 63 个字符。",+ "title": "强制索引命名格式",+ "description": "允许名字为空并由数据库自动命名,若非空则默认格式为 idx_<表名>_<索引包含的列名组合> ,且不超过 63 个字符,例如 \"idx_my_table_id_name\"。建议错误等级:警告","component": {"format": {"title": "索引命名规则",@@ -153,8 +153,8 @@}},"naming-column-auto-increment": {- "title": "自增列命名检查",- "description": "限制自增列命名风格和长度,默认为 id ,且不超过 63 个字符。",+ "title": "强制自增列命名格式",+ "description": "默认列名为 \"ID\",且不超过 63 个字符。","component": {"format": {"title": "自增列命名规则(正则)"@@ -165,8 +165,8 @@}},"column-required": {- "title": "必须包含的字段",- "description": "强制要求表中必须包含某些字段。",+ "title": "强制表中包含特定列",+ "description": "某些通用列有助于更好的维护应用,例如增加 \"ID\" 作为业务无关的通用主键避免了业务变化(如业务合并)导致的主键冲突,某些场景还能带来更好的数据插入性能。建议错误等级:警告","component": {"list": {"title": "必须包含的字段名"@@ -174,8 +174,8 @@}},"column-type-disallow-list": {- "title": "类型约束",- "description": "为字段设置类型黑名单。",+ "title": "禁止使用的列类型列表",+ "description": "滥用列类型可能对系统可维护性与性能带来严重负面影响,例如使用 \"LOB\" 类列存放大量音视频数据可能导致数据库性能降低、备份恢复时间延长、数据同步工具不兼容等问题。建议错误等级:错误","component": {"list": {"title": "禁止的类型"@@ -183,40 +183,40 @@}},"column-no-null": {- "title": "禁止字段为 NULL",+ "title": "强制非空约束","description": "表中的字段不允许存在 NULL 值。"},"column-disallow-set-charset": {- "title": "禁止设置字符集",- "description": "禁止为字段设置字符集。"+ "title": "禁止在列属性中定义字符集",+ "description": "字符集一般建议在数据库级别或表级别设置,更细粒度的字符集设置极易造成开发管理混乱。建议错误等级:错误"},"column-disallow-change-type": {- "title": "禁止改变类型",- "description": "不允许改变字段的类型。"+ "title": "禁止修改列类型",+ "description": "修改列类型可能影响系统的性能、可维护性,甚至导致数据丢失。建议错误等级:警告"},"column-disallow-change": {- "title": "禁止改变字段",- "description": "不允许 \"CHANGE COLUMN\" 语句。"+ "title": "禁止使用 \"CHANGE COLUMN\" 语句",+ "description": "\"CHANGE COLUMN\" 是 MySQL 特有的语法,可以同时修改列名与其他属性,但可能导致修改属性时误改了列名,建议仍然使用标准的 \"RENAME\",\"MODIFY\" 语句区分两类变更。建议错误等级:错误"},"column-disallow-changing-order": {- "title": "禁止改变字段顺序",- "description": "不允许列的顺序变更。"+ "title": "禁止修改表中的列顺序",+ "description": "修改列顺序可能导致某些依赖原表默认顺序的应用或视图出现不符合预期的结果,例如 \"SELECT * \"。建议错误等级:警告"},"column-set-default-for-not-null": {- "title": "为 NOT NULL 字段设置默认值",- "description": "不允许为 NULL 的字段必须设定默认值。"+ "title": "强制 \"NOT NULL\" 列设置默认值",+ "description": "会和已经存在的 NULL 数据不兼容,此外旧应用代码中未提供有效值的插入语句都将报错。建议错误等级:错误"},"column-auto-increment-must-integer": {- "title": "自增字段必须为数字类型",- "description": ""+ "title": "强制自增列使用整数类型",+ "description": "MySQL 的自增列一般用做业务无关主键,使用整数类型占用更少的存储空间,还能让主键索引结构更紧凑,带来更好的查询与 DML 性能。建议错误等级:错误"},"column-auto-increment-must-unsigned": {- "title": "自增列需要设置无符号",- "description": ""+ "title": "强制自增列使用 \"UNSIGNED\" 类型",+ "description": "无符号类型不存储负数,同样的类型存放的数值范围增加一倍,可以避免自增列超出上限。建议错误等级:警告"},"column-comment": {- "title": "注释检查",- "description": "配置字段是否需要注释和最大注释长度。",+ "title": "强制列增加注释并限制长度",+ "description": "对列添加注释是良好的开发习惯,但过长的注释将导致 Schema 易读性降低。建议错误等级:警告","component": {"required": {"title": "必须注释"@@ -227,8 +227,8 @@}},"column-maximum-character-length": {- "title": "CHAR 长度限制",- "description": "CHAR 长度大于指定值的时候需要改为 VARCHAR 类型。",+ "title": "限制 \"CHAR\" 类型长度",+ "description": "\"CHAR\" 是定长类型,例如 CHAR(20) 列即便只存放1个字符也将占用20个字符空间造成浪费,当字符串过长且长度不固定时,MySQL 可考虑用 VARCHAR 替代,PostgreSQL 可考虑用 TEXT 替代。建议错误等级:错误","component": {"number": {"title": "最大长度"@@ -236,8 +236,8 @@}},"column-auto-increment-initial-value": {- "title": "自增初始值",- "description": "配置自增字段的初始值。",+ "title": "限制自增列初始值",+ "description": "结合管理要求限制自增列的初始值。建议错误等级:警告","component": {"number": {"title": "初始值"@@ -245,52 +245,52 @@}},"column-current-time-count-limit": {- "title": "限制 NOW() 列的数量",- "description": "限制列默认值或 ON UPDATE 值为 NOW(), CURRENT_TIME() 和 CURRENT_TIMESTAMP() 的数量。"+ "title": "限制表中获取系统时间的列的数量",+ "description": "列需要调用函数获取系统时间的情况一般只包括记录创建时间的 \"DEFAULT NOW()\" 与记录更新时间的 \"DEFAULT NOW() ON UPDATE NOW()\",额外的列记录系统时间没有意义且会增加资源开销。建议错误等级:错误"},"column-require-default": {- "title": "强制设置列默认值",- "description": ""+ "title": "强制列设置默认值",+ "description": "设置符合业务特点的默认值可以有效提升下游统计分析业务的数据质量,此规范不检查 \"PRIMARY KEY\", \"JSON\", \"BLOB\", \"TEXT\", \"GEOMETRY\", \"AUTO_INCREMENT\", \"GENERATED\" 类型。建议错误等级:警告"},"statement-select-no-select-all": {- "title": "禁止 \"SELECT *\"",- "description": "不允许使用 \"SELECT *\" 语句。"+ "title": "禁止使用 \"SELECT *\"",+ "description": "SELECT * 拉取整行数据可能造成不必要的资源开销,同时一旦表增减列,也可能造成应用出现不符合预期的结果。建议错误等级:错误"},"statement-where-require": {- "title": "强制 \"WHERE\"",- "description": "必须使用 \"WHERE\" 语句。"+ "title": "强制语句带有 \"WHERE\" 条件",+ "description": "语句不带过滤条件,查询可能导致巨大的资源开销,DML 更可能导致大规模数据丢失。建议错误等级:错误"},"statement-where-no-leading-wildcard-like": {- "title": "禁止左模糊",- "description": "WHERE 语句中禁止使用左模糊匹配,例如禁止 LIKE foo = '%x'。"+ "title": "禁止过滤条件使用左模糊匹配",+ "description": "当使用左模糊匹配,例如 \"LIKE '%ABC'\",数据库优化器将无法进行快速索引扫描,而只能执行全表或全索引扫描,可能造成极为严重的性能问题。建议错误等级:错误"},"statement-disallow-commit": {- "title": "禁止使用提交",- "description": "禁止在工单中使用提交。"+ "title": "禁止显式 \"COMMIT\"",+ "description": "某些情况要求多条语句包含在一个事务中由系统提交,只允许同时成功或同时失败,以便部分出错时快速重跑,因此不允许出现显式的 \"COMMIT\"。建议错误等级:警告"},"statement-disallow-limit": {- "title": "不允许使用 \"LIMIT\"",- "description": "在 INSERT, UPDATE, DELETE 语句中禁止使用 \"LIMIT\"。"+ "title": "禁止在 DML 语句中使用 \"LIMIT\"",+ "description": "如果 DML 语句中使用 LIMIT 不伴随 ORDER BY,影响的行是不确定的,在某些复制模式下可能导致主库与从库变更了不同的行,造成数据不一致。建议错误等级:错误"},"statement-disallow-order-by": {- "title": "不允许使用 \"ORDER BY\"",- "description": "在 UPDATE, DELETE 语句中禁止使用 \"ORDER BY\"。"+ "title": "禁止在 \"UPDATE\",\"DELETE\" 语句中使用 \"ORDER BY\"",+ "description": "排序操作是极为耗费资源的,对于更新与删除操作应该尽可能用确定的过滤条件,而不要使用 ORDER BY 加 LIMIT 的方式。建议错误等级:错误"},"statement-merge-alter-table": {- "title": "合并 \"ALTER TABLE\" 语句",- "description": "禁止在工单中对同一张表使用多个 \"ALTER TABLE\" 语句。"+ "title": "禁止对同一张表发起多次独立变更",+ "description": "每一次对表的变更都可能造成锁表并且消耗大量资源,如果存在对同一张表的多次变更,应该合并为一个变更语句。建议错误等级:错误"},"statement-insert-must-specify-column": {- "title": "\"INSERT\" 语句必须指定字段",- "description": "必须指定插入的字段,也就是要写入哪些列,如 \"INSERT INTO t (id,name) VALUES(...)\"。"+ "title": "强制 \"INSERT\" 语句显示指定列名",+ "description": "\"INSERT INTO table VALUES (...)\" 语句没有显式列出列名,一旦发生列顺序变化或列增减,语句就可能失败或写入不符合预期的数据。建议错误等级:错误"},"statement-insert-disallow-order-by-rand": {- "title": "不能有 \"ORDER BY rand()\" 语句",- "description": ""+ "title": "禁止在 \"INSERT\" 语句中使用 \"ORDER BY RAND()\"",+ "description": "对待插入的数据进行随机排序是没有意义的,只会无端消耗资源。建议错误等级:错误"},"statement-insert-row-limit": {- "title": "插入行数限制",- "description": "",+ "title": "限制最大插入行数",+ "description": "通过提示插入的行数辅助判断语句是否符合业务预期。建议错误等级:警告","component": {"number": {"title": "最大插入行数"@@ -298,8 +298,8 @@}},"statement-affected-row-limit": {- "title": "限制影响行数",- "description": "限制 \"DELETE\" and \"UPDATE\" 语句影响的行数。",+ "title": "限制最大更新或删除行数",+ "description": "通过提示更新或删除的行数辅助判断语句是否符合业务预期。建议错误等级:警告","component": {"number": {"title": "最大影响行数"@@ -307,44 +307,44 @@}},"statement-dml-dry-run": {- "title": "试运行 DML 语句",- "description": "使用 EXPLAIN 语句试运行 DML。"+ "title": "验证 DML 语句可执行性",+ "description": "当语法正确但表名错误或权限不足时,可以在正式运行前通过模拟运行发现。建议错误等级:警告"},"statement-disallow-add-column-with-default": {- "title": "增加列时不能同时设置默认值",- "description": "增加列的同时设置默认值会导致 PostgreSQL 锁表并且重写所有行的数据。可以分别进行添加列、设置默认值和回填已有行操作避免可能的停机。"+ "title": "限制向表中添加带默认值的列",+ "description": "在 PostgreSQL 11 之前的版本中,添加带有默认值的列将导致全表锁定无法读写,这可能导致业务中断。在 PostgreSQL 11 及以上版本中该问题已得到优化,无需关注此规范。建议错误等级:警告"},"statement-add-check-not-valid": {- "title": "添加 CHECK 约束时使用 NOT VALID 参数",- "description": "添加 CHECK 约束时会阻塞读写操作,可能导致停机。可以使用 NOT VALID 参数在添加 CHECK 约束时跳过检查,并在之后分别进行手动检查已有数据和使约束生效来避免可能的停机。"+ "title": "强制添加 \"CHECK\" 约束时附带 \"NOT VALID\" 选项",+ "description": "在 PostgreSQL 11 之前的版本中,添加 CHECK 约束将对已有数据进行校验并导致全表锁定无法读写,这可能导致业务中断。建议附带 \"NOT VALID\" 选项只对新数据进行校验,变更完成后再手动校验已有数据。在 PostgreSQL 11 及以上版本中该问题已得到优化,无需关注此规范。建议错误等级:警告"},"statement-disallow-add-not-null": {- "title": "避免 NOT NULL 到已有列",- "description": "添加 NOT NULL 到已有列会阻塞读写操作,可能导致停机。可以使用 CHECK (column IS NOT NULL) NOT VALID 绕过,避免可能的停机。"+ "title": "限制向已有列添加 \"NOT NULL\" 约束",+ "description": "在 PostgreSQL 11 之前的版本中,向表中添加 NOT NULL 约束将对已有数据进行校验并导致全表锁定无法读写,这可能导致业务中断。在 PostgreSQL 11 及以上版本中该问题已得到优化,无需关注此规范。建议错误等级:警告"},"schema-backward-compatibility": {- "title": "向后兼容",- "description": "MySQL 和 TiDB 支持检测 schema 变更是否向后兼容。"+ "title": "检查应用向后兼容性",+ "description": "某些变更可能影响现有应用功能,例如修改数据库对象名,增加新的约束等,此规范可避免不谨慎变更导致现有应用运行失败。建议错误等级:警告"},"database-drop-empty-database": {- "title": "数据库删除限制",- "description": "只有当数据库内没有表时,才可以被删除。"+ "title": "禁止删除非空数据库",+ "description": "只有当数据库中不包含任何表时才允许被删除,这能最大程度避免误删除的发生。建议错误等级:错误"},"index-no-duplicate-column": {- "title": "索引中的列不能重复",- "description": ""+ "title": "禁止索引包含重复列",+ "description": "创建索引含重复列时语句将执行失败。建议错误等级:错误"},"index-type-no-blob": {- "title": "BLOB 列不能建作为索引",- "description": ""+ "title": "禁止对 \"BLOB\" 与 \"TEXT\" 类型列创建索引",+ "description": "\"BLOB\" 等类型一般用于存放二进制数据,并不会作为查询条件,如果误在此类列上创建索引,将占用大量资源并产生严重的性能问题。建议错误等级:错误"},"index-pk-type-limit": {"title": "主键类型限制","description": "限制主键类型必须是 INT 或 BIGINT。"},"index-key-number-limit": {- "title": "索引包含的字段数量限制",- "description": "",+ "title": "限制单个索引中的列数量",+ "description": "组合索引列超过 5 个对查询性能的提升并不明显,但却占用大量空间并降低 DML 性能。建议错误等级:警告","component": {"number": {"title": "字段数量上限"@@ -352,8 +352,8 @@}},"index-total-number-limit": {- "title": "索引数量限制",- "description": "",+ "title": "限制单表的索引数量",+ "description": "索引虽然能提升查询性能,但却占用大量空间并降低 DML 性能,因此不建议单个表创建的索引数量超过5个。建议错误等级:警告","component": {"number": {"title": "索引数量上限"@@ -361,8 +361,8 @@}},"index-primary-key-type-allowlist": {- "title": "主键列的类型限制",- "description": "",+ "title": "允许主键使用的类型列表",+ "description": "合适的主键类型可以优化存储结构,减少空间占用并带来更好的插入与查询性能。建议错误等级:警告","component": {"list": {"title": "允许的主键列的类型"@@ -370,12 +370,12 @@}},"index-create-concurrently": {- "title": "创建索引时使用 CONCURRENTLY 参数",- "description": "创建索引会导致无法写表。可以使用 CONCURRENTLY 参数避免阻塞写表操作。"+ "title": "强制并行索引创建",+ "description": "在 PostgreSQL 11 及以上版本中,使用普通方式创建索引将导致表锁定无法写入数据,使用 \"CONCURRENTLY\" 模式可以实现无锁创建索引,不影响表的正常访问。建议错误等级:警告"},"system-charset-allowlist": {- "title": "字符集限制",- "description": "",+ "title": "允许使用的字符集(Charset)列表",+ "description": "字符集决定了表中可以存储哪些字符,使用错误的字符集可能导致应用中的某些字符无法正确存储与显示,例如中文与 Emoji 表情。建议错误等级:错误","component": {"list": {"title": "允许的字符集"@@ -383,8 +383,8 @@}},"system-collation-allowlist": {- "title": "排序规则限制",- "description": "",+ "title": "允许使用的字符序(Collation)列表",+ "description": "字符序决定了字符比对与排序的规则,例如使用不区分大小写的字符序时 \"ABC\" 与 \"abc\" 在查询时将被视为相同字符串。建议错误等级:错误","component": {"list": {"title": "允许的规则限制"@@ -392,8 +392,8 @@}},"system-comment-length": {- "title": "注释长度限制",- "description": "",+ "title": "限制注释长度",+ "description": "过长的注释将导致 Schema 易读性降低,并可能带来潜在的性能风险。建议错误等级:警告","component": {"number": {"title": "注释长度上限"