Answer the question
In order to leave comments, you need to log in
Designing a database schema for a messaging system?
Hello!
The task is to develop a messaging system as in contact. Dialogues, users, messages.
Googling and analyzing the essence of the task, I came to the following database structure:
$this->createTable('{{dlg_usr}}', [
'dlg_id' => 'int(11) NOT NULL',
'user_id' => 'int(11) NOT NULL',
'created_at' => 'timestamp NOT NULL',
]);
$this->createTable('{{dlg_msg}}', [
'id' => 'pk',
'author_id' => 'int(11) NOT NULL',
'type' => 'int(11) NOT NULL',
'message' => 'longtext NOT NULL',
'created_at' => 'timestamp NOT NULL',
'update_at' => 'timestamp NOT NULL',
]);
$this->createTable('{{dlg_msg_usr}}', [
'dlg_id' => 'int(11) NOT NULL',
'user_id' => 'int(11) NOT NULL',
'msg_id' => 'int(11) NOT NULL',
'is_new' => 'int(11) NOT NULL',
'hide_status' => 'int(11) NOT NULL',
'moderated_status' => 'int(11) NOT NULL',
'hide_at' => 'timestamp NOT NULL',
'moderated_at' => 'timestamp NOT NULL',
'created_at' => 'timestamp NOT NULL',
'update_at' => 'timestamp NOT NULL',
]);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question