Project rules
MySQL Rules
Project rules for MySQL 8: InnoDB and utf8mb4 defaults, careful indexes, online migrations, short transactions and parameterized queries.
1Engine and encoding
2- Use InnoDB for every table. Set the database and tables to `utf8mb4` with `utf8mb4_0900_ai_ci` (or the server's modern default). Keep `sql_mode` strict so bad data raises errors instead of being truncated.
3- Store times in UTC with `DATETIME` or `TIMESTAMP` and convert in the application. Use `DECIMAL` for money, `BIGINT UNSIGNED` auto-increment keys or ordered UUIDs stored as `BINARY(16)`.
4Schema
5- Use snake_case names. Declare `NOT NULL`, defaults, unique keys and foreign keys. Keep the primary key short, because every secondary index repeats it.
mysql
MySQL Rules
Project rulesmysql
Free