数据库审查指南

DBA 生成数据库模式审查/DDL 指南的在线工具。 现在支持 MySQL,以后支持 PostgreSQL。

指导方针 Prod
指导方针 Dev
敬请等候

Database Review Guide for MySQL

Engine

Require InnoDB as the storage engine.

Naming

Enforce the table name format. Default snake_lower_case.

  • format: ^[a-z]+(_[a-z]+)?$

Enforce the column name format. Default snake_lower_case.

  • format: ^[a-z]+(_[a-z]+)?$

Enforce the unique key name format.

  • uk: ^uk_{{table}}_{{column_list}}$

Enforce the index name format.

  • idx: ^idx_{{table}}_{{column_list}}$
Query

Disallow 'SELECT *'.

Require 'WHERE' clause.

Disallow leading '%' in LIKE, e.g. LIKE foo = '%x' is not allowed.

Table

Require the table to have a primary key.

Column

Enforce the required columns in each table.

  • columns:
    id created_ts updated_ts creator_id updater_id

Columns cannot have NULL value.

Made by Bytebase at 2022-05-21