Database Review Guide

An online tool for DBA to generate the database schema review / DDL guideline. Support MySQL now, PostgreSQL later.

Guideline for Prod
Guideline for Dev
coming soon

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