Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: add i18n for index type allow list rule (#11008)

boojack566ec57c6b85
diff --git a/backend/plugin/advisor/config/sql-review.dev.yaml b/backend/plugin/advisor/config/sql-review.dev.yaml
index 2e3037be1b..bd2aaab0f8 100644
--- a/backend/plugin/advisor/config/sql-review.dev.yaml
+++ b/backend/plugin/advisor/config/sql-review.dev.yaml
@@ -205,6 +205,12 @@ ruleList:
- BIGINT
- type: index.create-concurrently
level: WARNING
+ - type: index.type-allow-list
+ level: WARNING
+ payload:
+ list:
+ - BTREE
+ - HASH
- type: system.charset.allowlist
level: WARNING
payload:
diff --git a/backend/plugin/advisor/config/sql-review.prod.yaml b/backend/plugin/advisor/config/sql-review.prod.yaml
index 2214470506..0a5898e369 100644
--- a/backend/plugin/advisor/config/sql-review.prod.yaml
+++ b/backend/plugin/advisor/config/sql-review.prod.yaml
@@ -205,6 +205,12 @@ ruleList:
- BIGINT
- type: index.create-concurrently
level: WARNING
+ - type: index.type-allow-list
+ level: WARNING
+ payload:
+ list:
+ - BTREE
+ - HASH
- type: system.charset.allowlist
level: ERROR
payload:
diff --git a/frontend/src/locales/sql-review/en-US.json b/frontend/src/locales/sql-review/en-US.json
index c6ce58930d..78fcc55e52 100644
--- a/frontend/src/locales/sql-review/en-US.json
+++ b/frontend/src/locales/sql-review/en-US.json
@@ -434,6 +434,15 @@
"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"
},
+ "index-type-allow-list": {
+ "title": "Allowable list of index types",
+ "description": "Different index types have different performance characteristics. For example, B-tree indexes are suitable for range queries, while hash indexes are suitable for equality queries. Suggestion error level: Warning",
+ "component": {
+ "list": {
+ "title": "Allow list"
+ }
+ }
+ },
"system-charset-allowlist": {
"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",
diff --git a/frontend/src/locales/sql-review/es-ES.json b/frontend/src/locales/sql-review/es-ES.json
index abbbd13698..90bd9998e4 100644
--- a/frontend/src/locales/sql-review/es-ES.json
+++ b/frontend/src/locales/sql-review/es-ES.json
@@ -434,6 +434,15 @@
"title": "Aplicar creación de índices concurrentes",
"description": "En PostgreSQL 11 y versiones posteriores, usar la declaración estándar para crear un índice causará un bloqueo de tabla y no permitirá escribir. Usar el modo \"CONCURRENTLY\" puede evitar este problema. Nivel de error sugerido: Advertencia"
},
+ "index-type-allow-list": {
+ "title": "Lista de tipos de índice permitidos",
+ "description": "Los diferentes tipos de índice tienen diferentes características de rendimiento. Por ejemplo, los índices B-tree son adecuados para consultas de rango, mientras que los índices hash son adecuados para consultas de igualdad. Nivel de error de sugerencia: Advertencia",
+ "component": {
+ "list": {
+ "title": "Lista permitida"
+ }
+ }
+ },
"system-charset-allowlist": {
"title": "Lista permitida de juegos de caracteres",
"description": "El juego de caracteres determina qué caracteres se pueden almacenar en la tabla. El uso de un juego de caracteres incorrecto puede hacer que ciertos caracteres de la aplicación no se puedan almacenar ni mostrar correctamente, como los caracteres CJK y Emoji. Nivel de error sugerido: Error",
diff --git a/frontend/src/locales/sql-review/ja-JP.json b/frontend/src/locales/sql-review/ja-JP.json
index b570c65986..bab9e02fcc 100644
--- a/frontend/src/locales/sql-review/ja-JP.json
+++ b/frontend/src/locales/sql-review/ja-JP.json
@@ -434,6 +434,15 @@
"title": "同時インデックス作成の強制",
"description": "PostgreSQL 11以降では、標準のステートメントを使用してインデックスを作成すると、テーブルのロックが発生し、書き込みができなくなります。\"CONCURRENTLY\"モードを使用すると、この問題を回避できます。提案エラーレベル:警告"
},
+ "index-type-allow-list": {
+ "title": "許可されたインデックスタイプのリスト",
+ "description": "異なるインデックスタイプには異なるパフォーマンス特性があります。例えば、B-tree インデックスは範囲クエリに適していますが、ハッシュインデックスは等価クエリに適しています。提案エラーレベル: 警告",
+ "component": {
+ "list": {
+ "title": "許可リスト"
+ }
+ }
+ },
"system-charset-allowlist": {
"title": "許可される文字セットのリスト",
"description": "文字セットは、テーブルに格納できる文字を決定します。間違った文字セットを使用すると、アプリケーションの一部の文字が正しく格納および表示されない場合があります。CJKや絵文字などが該当します。提案エラーレベル:エラー",
diff --git a/frontend/src/locales/sql-review/vi-VN.json b/frontend/src/locales/sql-review/vi-VN.json
index e80f14ed7b..b7163ee337 100644
--- a/frontend/src/locales/sql-review/vi-VN.json
+++ b/frontend/src/locales/sql-review/vi-VN.json
@@ -434,6 +434,15 @@
"title": "Thực thi việc tạo chỉ mục đồng thời",
"description": "Trong PostgreSQL 11 trở lên, việc sử dụng câu lệnh chuẩn để tạo chỉ mục sẽ khiến bảng bị khóa và không thể ghi. Sử dụng chế độ \"ĐỒNG HÀNH\" có thể tránh được sự cố này. Mức độ lỗi đề xuất: Cảnh báo"
},
+ "index-type-allow-list": {
+ "title": "Danh sách loại chỉ mục cho phép",
+ "description": "Các loại chỉ mục khác nhau có các đặc điểm về hiệu suất khác nhau. Ví dụ, chỉ mục B-tree phù hợp cho các truy vấn phạm vi, trong khi chỉ mục băm phù hợp cho các truy vấn bằng nhau. Cấp độ lỗi gợi ý: Cảnh báo",
+ "component": {
+ "list": {
+ "title": "Danh sách cho phép"
+ }
+ }
+ },
"system-charset-allowlist": {
"title": "Danh sách Charset được phép",
"description": "Bộ ký tự xác định những ký tự nào có thể được lưu trữ trong bảng. Việc sử dụng bộ ký tự sai có thể khiến một số ký tự nhất định trong ứng dụng không thể được lưu trữ và hiển thị chính xác, chẳng hạn như CJK và Emoji. Mức độ lỗi đề xuất: Lỗi",
diff --git a/frontend/src/locales/sql-review/zh-CN.json b/frontend/src/locales/sql-review/zh-CN.json
index 5006158494..69af94bb55 100644
--- a/frontend/src/locales/sql-review/zh-CN.json
+++ b/frontend/src/locales/sql-review/zh-CN.json
@@ -434,6 +434,15 @@
"title": "强制并行索引创建",
"description": "在 PostgreSQL 11 及以上版本中,使用普通方式创建索引将导致表锁定无法写入数据,使用 \"CONCURRENTLY\" 模式可以实现无锁创建索引,不影响表的正常访问。建议错误等级:警告"
},
+ "index-type-allow-list": {
+ "title": "可允许的索引类型列表",
+ "description": "不同的索引类型具有不同的性能特征。例如,B-tree 索引适用于范围查询,而哈希索引适用于相等查询。建议错误级别:警告",
+ "component": {
+ "list": {
+ "title": "允许的索引类型"
+ }
+ }
+ },
"system-charset-allowlist": {
"title": "允许使用的字符集(Charset)列表",
"description": "字符集决定了表中可以存储哪些字符,使用错误的字符集可能导致应用中的某些字符无法正确存储与显示,例如中文与 Emoji 表情。建议错误等级:错误",
diff --git a/frontend/src/types/sql-review-schema.yaml b/frontend/src/types/sql-review-schema.yaml
index ea23c43377..d9f6a25ec8 100644
--- a/frontend/src/types/sql-review-schema.yaml
+++ b/frontend/src/types/sql-review-schema.yaml
@@ -715,6 +715,15 @@ ruleList:
engineList:
- POSTGRES
componentList: []
+ - type: index.type-allow-list
+ category: INDEX
+ engineList:
+ - MYSQL
+ componentList:
+ - key: list
+ payload:
+ type: STRING_ARRAY
+ default: []
- type: system.charset.allowlist
category: SYSTEM
engineList:
diff --git a/frontend/src/types/sqlReview.ts b/frontend/src/types/sqlReview.ts
index 801af4eaef..b25de0f127 100644
--- a/frontend/src/types/sqlReview.ts
+++ b/frontend/src/types/sqlReview.ts
@@ -604,6 +604,7 @@ export const convertPolicyRuleToRuleTemplate = (
}
case "column.type-disallow-list":
case "index.primary-key-type-allowlist":
+ case "index.type-allow-list":
case "system.charset.allowlist":
case "system.collation.allowlist":
case "system.function.disallowed-list": {
@@ -762,6 +763,7 @@ const mergeIndividualConfigAsRule = (
case "column.required":
case "column.type-disallow-list":
case "index.primary-key-type-allowlist":
+ case "index.type-allow-list":
case "system.charset.allowlist":
case "system.collation.allowlist":
case "system.function.disallowed-list": {