- Column names according to data type:
- DATETIME or TIMESTAMP ->
{verbed}_at
(eg. created_at, read_at) or{verbed}_until
(eg. suspended_until) - INT that is a count ->
{noun}_count
(eg. comment_count, word_count) - Foreign key ->
{verbed}_{entity}_id
(eg. hidden_user_id)- Verb can be omitted for primary relationship (eg. post author is just
user_id
)
- Verb can be omitted for primary relationship (eg. post author is just
- BOOL ->
is_{adjective}
(eg. is_locked)
- DATETIME or TIMESTAMP ->
- Table names:
- Use plural form (
discussions
) - Underscores for multiple words (
access_tokens
) - Relationships: two table names joined with underscore in alphabetical order (eg.
discussions_users
) so that Eloquent can automatically figure it out
- Use plural form (
- Extensions
- Prefix table names with
vendor_package_table
- Prefix column names with
vendor_package_column
- Core extensions are exempt
- Prefix table names with
- RENAME
id
->token
- ADD
created_at
- MODIFY
last_activity_at
-> DATETIME - RENAME
lifetime
->lifetime_seconds
- RENAME
id
->key
; ADDid
surrogate key - ADD
allowed_ips
- ADD
user_id
(nullable) - ADD
scopes
- ADD
created_at
- ADD
last_activity_at
- RENAME
id
->token
- RENAME
comments_count
->comment_count
- RENAME
participants_count
->participant_count
- RENAME
number_index
->post_number_index
- RENAME
start_time
->created_at
- RENAME
start_user_id
->user_id
- RENAME
start_post_id
->first_post_id
- RENAME
last_post_time
->last_posted_at
- RENAME
last_user_id
->last_posted_user_id
- RENAME
hide_time
->hidden_at
- RENAME
hide_user_id
->hidden_user_id
- RENAME
read_time
->last_read_at
- RENAME
read_number
->last_read_post_number
- RENAME
id
->token
- RENAME
time
->created_at
- DROP
sender_id
- DROP
subject_type
- RENAME
time
->created_at
- RENAME
is_read
->read_at
- RENAME
is_deleted
->is_hidden
id
from_user_id
- RENAME
id
->token
- RENAME
time
->created_at
- RENAME
edit_time
->edited_at
- RENAME
edit_user_id
->edited_user_id
- RENAME
hide_time
->hidden_at
- RENAME
hide_user_id
->hidden_user_id
- MODIFY
content
-> LONGTEXT
post_id
user_id
- Empty by default - placeholders for extensions wanting to add fields
- MODIFY
value
-> LONGBLOB (serialize all values)
- RENAME
discussions_count
->discussion_count
- ADD
post_count
- RENAME
last_time
->last_posted_at
- RENAME
last_discussion_id
->last_posted_discussion_id
- ADD
last_posted_user_id
- RENAME
read_time
->marked_as_read_at
- RENAME
is_activated
->is_email_confirmed
- DROP
bio
(move to extension) - DROP
preferences
- RENAME
join_time
->joined_at
- RENAME
last_seen_time
->last_seen_at
- RENAME
discussions_count
->discussion_count
- RENAME
comments_count
->comment_count
- RENAME
read_time
->marked_all_as_read_at
- RENAME
notifications_read_time
->read_notifications_at
- RENAME
suspend_until
->suspended_until
user_id
other_user_id
- Empty by default - placeholders for extensions wanting to add fields (eg. friend users, ignore users)