一、命名规范
1. 数据库、表、字段、别名规范
识别符
最大长度(字节)
允许的字符
数据库
64
[a-z_] (所有字符均小写, 字之间用 _ 分割)
表
64
[a-z_] (所有字符均小写, 字之间用 _ 分割)
列
64
[a-z_] (所有字符均小写, 字之间用 _ 分割)
索引
64
[a-z_] (所有字符均小写, 字之间用 _ 分割)
别名
255
[a-z_] (所有字符均小写, 字之间用 _ 分割)
数据库、表、列、索引、别名的命名应尽可能描述其真实的意思。
2. 统一命名
字段
命名空间为:
数据库::表(数据库_表名):: 字段(简)
* 名称或标题 name (char[])
* 创建时间 create_time (datetime)
* 更新时间 update_time (datetime)
* 过期时间 expire_time (datetime)
* 数据状态 status (tinyint) ''0:正常 1:隐藏''
* ID id (int)
* IP ip (char[19])
* 资源文件/图片Id resource_id (int)
* 标签 tag (char[])
* 类型 type (tinyint)
索引命名空间为:
index_table_field
unique_table_field
key_table_fi