Project

General

Profile

Enhancement(機能追加・改善) #4085

Updated by Shinichi Urabe about 6 years ago

テーブル定義変更案

<pre>
<code="yaml">
options:
charset: utf8
actAs: [Timestampable]

Thread:
columns:
id: { type: integer(4), primary: true, autoincrement: true }
name: { type: string, notnull: true }

ThreadMember:
columns:
id: { type: integer(4), primary: true, autoincrement: true }
member_id: { type: integer(4) }
is_thread_block: { type: boolean, notnull: true, default: 0 }
is_notification: { type: boolean, notnull: true, default: 1 }
relations:
Member:
onDelete: set null
Message:
onDelete: cascade

Message:
columns:
id: { type: integer(4), primary: true, autoincrement: true }
thread_member_id: { type: integer(4), notnull: true }
thread_id: { type: integer(4), notnull: true }
body: { type: string, notnull: true }
is_deleted: { type: boolean, notnull: true, default: 0 }
return_message_id: { type: integer(4), default: null }
message_type_id: { type: integer(4), notnull: true }
relations:
Thread:
onDelete: cascade
ThreadMember:
onDelete: cascade
Message:
local: return_message_id
onDelete: set null
MessageType:
onDelete: cascade
indexes:
is_deleted_thread_id_id:
fields: [is_deleted, thread_id, id]

MessageUnread:
columns:
id: { type: integer(4), primary: true, autoincrement: true }
thread_member_id: { type: integer(4), notnull: true }
message_id: { type: integer(4), notnull: true }
relations:
ThreadMember:
onDelete: cascade
Message:
onDelete: cascade
indexes:
thread_member_id_message_id_UNIQUE:
fields: [thread_member_id, message_id]
type: unique

MessageFile:
columns:
id: { type: integer(4), primary: true, autoincrement: true }
message_id: { type: integer(4), notnull: true }
file_id: { type: integer(4), notnull: true }
relations:
Message:
onDelete: cascade
File:
onDelete: cascade

MessageType:
columns:
id: { type: integer(4), primary: true, autoincrement: true }
type_name: { type: string(256), notnull: true }
body: { type: string, notnull: true }
caption: { type: string, notnull: true }
info: { type: string, notnull: true }

</code>
</pre>

Back