框架升级2.1
parent
21452a966c
commit
491eb1e539
|
@ -20,7 +20,7 @@ Lumen-IM 是一个网页版在线即时聊天项目,前端使用 Element-ui +
|
|||
|
||||
## 3、环境要求
|
||||
|
||||
- PHP >= 7.2
|
||||
- PHP >= 7.3
|
||||
- MySQL >= 5.7
|
||||
- Redis >= 5.0
|
||||
- Swoole >= 4.5
|
||||
|
|
|
@ -43,9 +43,12 @@ class ArticleController extends CController
|
|||
*/
|
||||
public function getArticleClass()
|
||||
{
|
||||
return $this->response->success([
|
||||
'rows' => $this->articleService->getUserClass($this->uid())
|
||||
]);
|
||||
$rows = $this->articleService->getUserClass($this->uid());
|
||||
foreach ($rows as &$row) {
|
||||
$row['count'] = is_null($row['count']) ? 0 : $row['count'];
|
||||
}
|
||||
|
||||
return $this->response->success(['rows' => $rows]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,18 +28,17 @@ class ArticleService extends BaseService
|
|||
*/
|
||||
public function getUserClass(int $user_id)
|
||||
{
|
||||
$subJoin = Article::select('class_id', Db::raw('count(class_id) as count'))->where('user_id', $user_id)->where('status', 1)->groupBy('class_id');
|
||||
|
||||
$fields = [
|
||||
'article_class.id', 'article_class.class_name',
|
||||
'article_class.is_default',
|
||||
Db::raw('ifnull(sub_join.count,0) as count')
|
||||
'sub_join.count',
|
||||
];
|
||||
|
||||
$subJoin = Article::select(['class_id', Db::raw('count(class_id) as count')])->where('user_id', $user_id)->where('status', 1)->groupBy(['class_id']);
|
||||
return ArticleClass::leftJoinSub($subJoin, 'sub_join', function ($join) {
|
||||
$join->on('article_class.id', '=', Db::raw('sub_join.class_id'));
|
||||
$join->on('article_class.id', '=', 'sub_join.class_id');
|
||||
})->where('article_class.user_id', $user_id)
|
||||
->orderBy('article_class.sort', 'asc')
|
||||
->orderBy('article_class.sort')
|
||||
->get($fields)
|
||||
->toArray();
|
||||
}
|
||||
|
|
|
@ -14,38 +14,38 @@
|
|||
"require": {
|
||||
"php": ">=7.2",
|
||||
"ext-swoole": ">=4.5",
|
||||
"hyperf/cache": "~2.0.0",
|
||||
"hyperf/command": "~2.0.0",
|
||||
"hyperf/config": "~2.0.0",
|
||||
"hyperf/db-connection": "~2.0.0",
|
||||
"hyperf/framework": "~2.0.0",
|
||||
"hyperf/guzzle": "~2.0.0",
|
||||
"hyperf/http-server": "~2.0.0",
|
||||
"hyperf/logger": "~2.0.0",
|
||||
"hyperf/memory": "~2.0.0",
|
||||
"hyperf/process": "~2.0.0",
|
||||
"hyperf/redis": "~2.0.0",
|
||||
"hyperf/database": "~2.0.0",
|
||||
"hyperf/async-queue": "~2.0.0",
|
||||
"hyperf/websocket-server": "^2.0",
|
||||
"hyperf/constants": "~2.0.0",
|
||||
"hyperf/validation": "~2.0.0",
|
||||
"hyperf/filesystem": "~2.0.0",
|
||||
"hyperf/cache": "2.1.*",
|
||||
"hyperf/command": "2.1.*",
|
||||
"hyperf/config": "2.1.*",
|
||||
"hyperf/db-connection": "2.1.*",
|
||||
"hyperf/framework": "2.1.*",
|
||||
"hyperf/guzzle": "2.1.*",
|
||||
"hyperf/http-server": "2.1.*",
|
||||
"hyperf/logger": "2.1.*",
|
||||
"hyperf/memory": "2.1.*",
|
||||
"hyperf/process": "2.1.*",
|
||||
"hyperf/redis": "2.1.*",
|
||||
"hyperf/database": "2.1.*",
|
||||
"hyperf/async-queue": "2.1.*",
|
||||
"hyperf/websocket-server": "2.1.*",
|
||||
"hyperf/constants": "2.1.*",
|
||||
"hyperf/validation": "2.1.*",
|
||||
"hyperf/filesystem": "2.1.*",
|
||||
"hashids/hashids": "^4.0",
|
||||
"ext-json": "*",
|
||||
"hyperf/view": "~2.0.0",
|
||||
"hyperf/view-engine": "~2.0.0",
|
||||
"hyperf/view": "2.1.*",
|
||||
"hyperf/view-engine": "2.1.*",
|
||||
"phpmailer/phpmailer": "^6.2",
|
||||
"96qbhy/hyperf-auth": "^2.3",
|
||||
"hyperf/event": "~2.0.0"
|
||||
"hyperf/event": "2.1.*"
|
||||
},
|
||||
"require-dev": {
|
||||
"swoole/ide-helper": "^4.5",
|
||||
"friendsofphp/php-cs-fixer": "^2.14",
|
||||
"mockery/mockery": "^1.0",
|
||||
"phpstan/phpstan": "^0.12",
|
||||
"hyperf/devtool": "~2.0.0",
|
||||
"hyperf/testing": "~2.0.0"
|
||||
"hyperf/devtool": "2.1.*",
|
||||
"hyperf/testing": "2.1.*"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-openssl": "Required to use HTTPS.",
|
||||
|
|
|
@ -12,7 +12,7 @@ declare(strict_types=1);
|
|||
*/
|
||||
|
||||
use Hyperf\Server\Server;
|
||||
use Hyperf\Server\SwooleEvent;
|
||||
use Hyperf\Server\Event;
|
||||
|
||||
return [
|
||||
'mode' => SWOOLE_PROCESS,
|
||||
|
@ -24,7 +24,7 @@ return [
|
|||
'port' => 9503,
|
||||
'sock_type' => SWOOLE_SOCK_TCP,
|
||||
'callbacks' => [
|
||||
SwooleEvent::ON_REQUEST => [Hyperf\HttpServer\Server::class, 'onRequest'],
|
||||
Event::ON_REQUEST => [Hyperf\HttpServer\Server::class, 'onRequest'],
|
||||
],
|
||||
],
|
||||
[
|
||||
|
@ -35,9 +35,9 @@ return [
|
|||
'sock_type' => SWOOLE_SOCK_TCP,
|
||||
'callbacks' => [
|
||||
// 自定义握手处理
|
||||
SwooleEvent::ON_HAND_SHAKE => [Hyperf\WebSocketServer\Server::class, 'onHandShake'],
|
||||
SwooleEvent::ON_MESSAGE => [Hyperf\WebSocketServer\Server::class, 'onMessage'],
|
||||
SwooleEvent::ON_CLOSE => [Hyperf\WebSocketServer\Server::class, 'onClose'],
|
||||
Event::ON_HAND_SHAKE => [Hyperf\WebSocketServer\Server::class, 'onHandShake'],
|
||||
Event::ON_MESSAGE => [Hyperf\WebSocketServer\Server::class, 'onMessage'],
|
||||
Event::ON_CLOSE => [Hyperf\WebSocketServer\Server::class, 'onClose'],
|
||||
],
|
||||
'settings' => [
|
||||
// 设置心跳检测
|
||||
|
@ -60,9 +60,9 @@ return [
|
|||
],
|
||||
'callbacks' => [
|
||||
// 自定义启动前事件
|
||||
SwooleEvent::ON_BEFORE_START => [App\Bootstrap\ServerStart::class, 'beforeStart'],
|
||||
SwooleEvent::ON_WORKER_START => [Hyperf\Framework\Bootstrap\WorkerStartCallback::class, 'onWorkerStart'],
|
||||
SwooleEvent::ON_PIPE_MESSAGE => [Hyperf\Framework\Bootstrap\PipeMessageCallback::class, 'onPipeMessage'],
|
||||
SwooleEvent::ON_WORKER_EXIT => [Hyperf\Framework\Bootstrap\WorkerExitCallback::class, 'onWorkerExit'],
|
||||
Event::ON_BEFORE_START => [App\Bootstrap\ServerStart::class, 'beforeStart'],
|
||||
Event::ON_WORKER_START => [Hyperf\Framework\Bootstrap\WorkerStartCallback::class, 'onWorkerStart'],
|
||||
Event::ON_PIPE_MESSAGE => [Hyperf\Framework\Bootstrap\PipeMessageCallback::class, 'onPipeMessage'],
|
||||
Event::ON_WORKER_EXIT => [Hyperf\Framework\Bootstrap\WorkerExitCallback::class, 'onWorkerExit'],
|
||||
],
|
||||
];
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
class CreateUsersTable extends Migration
|
||||
{
|
||||
|
@ -30,10 +29,9 @@ class CreateUsersTable extends Migration
|
|||
$table->engine = 'InnoDB';
|
||||
|
||||
$table->unique(['mobile'], 'uk_mobile');
|
||||
});
|
||||
|
||||
$prefix = config('databases.default.prefix');
|
||||
Db::statement("ALTER TABLE `{$prefix}users` comment '用户信息表'");
|
||||
$table->comment('用户信息表');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
class CreateArticleTable extends Migration
|
||||
{
|
||||
|
@ -32,10 +31,9 @@ class CreateArticleTable extends Migration
|
|||
|
||||
//创建索引
|
||||
$table->index(['user_id', 'class_id', 'title'], 'idx_user_id_class_id_title');
|
||||
});
|
||||
|
||||
$prefix = config('databases.default.prefix');
|
||||
Db::statement("ALTER TABLE `{$prefix}article` comment '用户笔记表'");
|
||||
$table->comment('用户笔记表');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
class CreateArticleAnnexTable extends Migration
|
||||
{
|
||||
|
@ -29,10 +28,9 @@ class CreateArticleAnnexTable extends Migration
|
|||
$table->engine = 'InnoDB';
|
||||
|
||||
$table->index(['user_id', 'article_id'], 'idx_user_id_article_id');
|
||||
});
|
||||
|
||||
$prefix = config('databases.default.prefix');
|
||||
DB::statement("ALTER TABLE `{$prefix}article_annex` comment '笔记附件信息表'");
|
||||
$table->comment('笔记附件信息表');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
class CreateArticleClassTable extends Migration
|
||||
{
|
||||
/**
|
||||
|
@ -24,10 +24,8 @@ class CreateArticleClassTable extends Migration
|
|||
$table->engine = 'InnoDB';
|
||||
|
||||
$table->index(['user_id', 'sort'], 'idx_user_id_sort');
|
||||
$table->comment('笔记分类表');
|
||||
});
|
||||
|
||||
$prefix = config('databases.default.prefix');
|
||||
DB::statement("ALTER TABLE `{$prefix}article_class` comment '笔记分类表'");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
class CreateArticleDetailTable extends Migration
|
||||
{
|
||||
/**
|
||||
|
@ -22,10 +22,9 @@ class CreateArticleDetailTable extends Migration
|
|||
$table->engine = 'InnoDB';
|
||||
|
||||
$table->unique('article_id', 'unique_article_id');
|
||||
});
|
||||
|
||||
$prefix = config('databases.default.prefix');
|
||||
DB::statement("ALTER TABLE `{$prefix}article_detail` comment '笔记详情表'");
|
||||
$table->comment('笔记详情表');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
class CreateArticleTagsTable extends Migration
|
||||
{
|
||||
/**
|
||||
|
@ -22,10 +22,8 @@ class CreateArticleTagsTable extends Migration
|
|||
$table->collation = 'utf8_general_ci';
|
||||
$table->engine = 'InnoDB';
|
||||
$table->index(['user_id'], 'idx_user_id');
|
||||
$table->comment('笔记标签表');
|
||||
});
|
||||
|
||||
$prefix = config('databases.default.prefix');
|
||||
DB::statement("ALTER TABLE `{$prefix}article_tags` comment '笔记标签表'");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
class CreateEmoticonTable extends Migration
|
||||
{
|
||||
|
@ -24,10 +23,8 @@ class CreateEmoticonTable extends Migration
|
|||
$table->collation = 'utf8_general_ci';
|
||||
|
||||
$table->unique(['name'], 'uk_name');
|
||||
$table->comment('表情包');
|
||||
});
|
||||
|
||||
$prefix = config('databases.default.prefix');
|
||||
DB::statement("ALTER TABLE `{$prefix}emoticon` comment '表情包'");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
class CreateEmoticonItemTable extends Migration
|
||||
{
|
||||
|
@ -25,10 +24,8 @@ class CreateEmoticonItemTable extends Migration
|
|||
|
||||
$table->charset = 'utf8';
|
||||
$table->collation = 'utf8_general_ci';
|
||||
$table->comment('表情包详情表');
|
||||
});
|
||||
|
||||
$prefix = config('databases.default.prefix');
|
||||
DB::statement("ALTER TABLE `{$prefix}emoticon_item` comment '表情包详情表'");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
class CreateFileSplitUploadTable extends Migration
|
||||
{
|
||||
/**
|
||||
|
@ -29,10 +29,8 @@ class CreateFileSplitUploadTable extends Migration
|
|||
$table->collation = 'utf8_general_ci';
|
||||
|
||||
$table->index(['user_id', 'hash_name'], 'idx_user_id_hash_name');
|
||||
$table->comment('文件拆分上传');
|
||||
});
|
||||
|
||||
$prefix = config('databases.default.prefix');
|
||||
DB::statement("ALTER TABLE `{$prefix}file_split_upload` comment '文件拆分上传'");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
class CreateTalkListTable extends Migration
|
||||
{
|
||||
|
@ -29,10 +28,8 @@ class CreateTalkListTable extends Migration
|
|||
$table->engine = 'InnoDB';
|
||||
|
||||
$table->index(['user_id', 'receiver_id', 'talk_type'], 'idx_user_id_receiver_id_talk_type');
|
||||
$table->comment('用户聊天列表');
|
||||
});
|
||||
|
||||
$prefix = config('databases.default.prefix');
|
||||
DB::statement("ALTER TABLE `{$prefix}talk_list` comment '用户聊天列表'");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
class CreateTalkRecordsTable extends Migration
|
||||
{
|
||||
|
@ -32,10 +31,8 @@ class CreateTalkRecordsTable extends Migration
|
|||
$table->engine = 'InnoDB';
|
||||
|
||||
$table->index(['user_id', 'receiver_id'], 'idx_user_id_receiver_id');
|
||||
$table->comment('用户聊天记录表');
|
||||
});
|
||||
|
||||
$prefix = config('databases.default.prefix');
|
||||
DB::statement("ALTER TABLE `{$prefix}talk_records` comment '用户聊天记录表'");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
class CreateTalkRecordsFileTable extends Migration
|
||||
{
|
||||
|
@ -31,10 +30,8 @@ class CreateTalkRecordsFileTable extends Migration
|
|||
$table->engine = 'InnoDB';
|
||||
|
||||
$table->unique(['record_id'], 'uk_record_id');
|
||||
$table->comment('用户聊天记录_文件消息表');
|
||||
});
|
||||
|
||||
$prefix = config('databases.default.prefix');
|
||||
DB::statement("ALTER TABLE `{$prefix}talk_records_file` comment '用户聊天记录_文件消息表'");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
class CreateTalkRecordsDeleteTable extends Migration
|
||||
{
|
||||
|
@ -23,10 +22,8 @@ class CreateTalkRecordsDeleteTable extends Migration
|
|||
$table->engine = 'InnoDB';
|
||||
|
||||
$table->unique(['record_id', 'user_id'], 'uk_record_id_user_id');
|
||||
$table->comment('用户聊天记录_删除记录表');
|
||||
});
|
||||
|
||||
$prefix = config('databases.default.prefix');
|
||||
DB::statement("ALTER TABLE `{$prefix}talk_records_delete` comment '用户聊天记录_删除记录表'");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
class CreateTalkRecordsForwardTable extends Migration
|
||||
{
|
||||
/**
|
||||
|
@ -24,10 +24,8 @@ class CreateTalkRecordsForwardTable extends Migration
|
|||
$table->engine = 'InnoDB';
|
||||
|
||||
$table->index(['user_id', 'records_id'], 'idx_user_id_records_id');
|
||||
$table->comment('用户聊天记录_转发信息表');
|
||||
});
|
||||
|
||||
$prefix = config('databases.default.prefix');
|
||||
DB::statement("ALTER TABLE `{$prefix}talk_records_forward` comment '用户聊天记录_转发信息表'");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
class CreateTalkRecordsInviteTable extends Migration
|
||||
{
|
||||
|
@ -24,10 +23,8 @@ class CreateTalkRecordsInviteTable extends Migration
|
|||
$table->engine = 'InnoDB';
|
||||
|
||||
$table->index(['record_id'], 'idx_record_id');
|
||||
$table->comment('用户聊天记录_入群或退群消息表');
|
||||
});
|
||||
|
||||
$prefix = config('databases.default.prefix');
|
||||
DB::statement("ALTER TABLE `{$prefix}talk_records_invite` comment '用户聊天记录_入群或退群消息表'");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,11 +24,9 @@ class CreateTalkRecordsCodeTable extends Migration
|
|||
$table->collation = 'utf8_general_ci';
|
||||
$table->engine = 'InnoDB';
|
||||
|
||||
$table->index(['record_id'], 'idx_recordid');
|
||||
$table->index(['record_id'], 'idx_record_id');
|
||||
$table->comment('用户聊天记录_代码块消息表');
|
||||
});
|
||||
|
||||
$prefix = config('databases.default.prefix');
|
||||
DB::statement("ALTER TABLE `{$prefix}talk_records_code` comment '用户聊天记录_代码块消息表'");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
class CreateUsersEmoticonTable extends Migration
|
||||
{
|
||||
/**
|
||||
|
@ -20,10 +20,8 @@ class CreateUsersEmoticonTable extends Migration
|
|||
$table->collation = 'utf8_general_ci';
|
||||
|
||||
$table->unique(['user_id'], 'uk_user_id');
|
||||
$table->comment('用户收藏表情包');
|
||||
});
|
||||
|
||||
$prefix = config('databases.default.prefix');
|
||||
DB::statement("ALTER TABLE `{$prefix}users_emoticon` comment '用户收藏表情包'");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
class CreateUsersFriendsTable extends Migration
|
||||
{
|
||||
|
@ -26,10 +25,8 @@ class CreateUsersFriendsTable extends Migration
|
|||
$table->engine = 'InnoDB';
|
||||
|
||||
$table->index(['user_id', 'friend_id'], 'idx_user_id_friend_id');
|
||||
$table->comment('用户好友关系表');
|
||||
});
|
||||
|
||||
$prefix = config('databases.default.prefix');
|
||||
DB::statement("ALTER TABLE `{$prefix}users_friends` comment '用户好友关系表'");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
class CreateUsersFriendsApplyTable extends Migration
|
||||
{
|
||||
|
@ -25,10 +24,8 @@ class CreateUsersFriendsApplyTable extends Migration
|
|||
|
||||
$table->index(['user_id'], 'idx_user_id');
|
||||
$table->index(['friend_id'], 'idx_friend_id');
|
||||
$table->comment('用户添加好友申请表');
|
||||
});
|
||||
|
||||
$prefix = config('databases.default.prefix');
|
||||
DB::statement("ALTER TABLE `{$prefix}users_friends_apply` comment '用户添加好友申请表'");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
class CreateGroupTable extends Migration
|
||||
{
|
||||
|
@ -28,10 +27,8 @@ class CreateGroupTable extends Migration
|
|||
$table->charset = 'utf8';
|
||||
$table->collation = 'utf8_general_ci';
|
||||
$table->engine = 'InnoDB';
|
||||
$table->comment('聊天群组表');
|
||||
});
|
||||
|
||||
$prefix = config('databases.default.prefix');
|
||||
DB::statement("ALTER TABLE `{$prefix}group` comment '聊天群组表'");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
class CreateGroupMemberTable extends Migration
|
||||
{
|
||||
|
@ -29,10 +28,8 @@ class CreateGroupMemberTable extends Migration
|
|||
|
||||
$table->unique(['group_id', 'user_id'], 'uk_group_id_user_id');
|
||||
$table->index(['user_id'], 'idx_user_id');
|
||||
$table->comment('聊天群组成员表');
|
||||
});
|
||||
|
||||
$prefix = config('databases.default.prefix');
|
||||
DB::statement("ALTER TABLE `{$prefix}group_member` comment '聊天群组成员表'");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
class CreateGroupNoticeTable extends Migration
|
||||
{
|
||||
|
@ -31,10 +30,8 @@ class CreateGroupNoticeTable extends Migration
|
|||
$table->engine = 'InnoDB';
|
||||
|
||||
$table->index(['group_id', 'is_delete', 'is_top', 'updated_at'], 'idx_group_id_is_delete_is_top_updated_at');
|
||||
$table->comment('群组公告表');
|
||||
});
|
||||
|
||||
$prefix = config('databases.default.prefix');
|
||||
DB::statement("ALTER TABLE `{$prefix}group_notice` comment '群组公告表'");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
class CreateRobotsTable extends Migration
|
||||
{
|
||||
|
@ -26,10 +25,8 @@ class CreateRobotsTable extends Migration
|
|||
$table->charset = 'utf8';
|
||||
$table->collation = 'utf8_general_ci';
|
||||
$table->engine = 'InnoDB';
|
||||
$table->comment('聊天机器人表');
|
||||
});
|
||||
|
||||
$prefix = config('databases.default.prefix');
|
||||
Db::statement("ALTER TABLE `{$prefix}robots` comment '聊天机器人表'");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
class CreateTalkRecordsVoteTable extends Migration
|
||||
{
|
||||
|
@ -30,10 +29,8 @@ class CreateTalkRecordsVoteTable extends Migration
|
|||
$table->engine = 'InnoDB';
|
||||
|
||||
$table->unique(['record_id'], 'uk_record_id');
|
||||
$table->comment('聊天对话记录(投票消息表)');
|
||||
});
|
||||
|
||||
$prefix = config('databases.default.prefix');
|
||||
Db::statement("ALTER TABLE `{$prefix}talk_records_vote` comment '聊天对话记录(投票消息表)'");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
class CreateTalkRecordsVoteAnswerTable extends Migration
|
||||
{
|
||||
|
@ -24,10 +23,8 @@ class CreateTalkRecordsVoteAnswerTable extends Migration
|
|||
$table->engine = 'InnoDB';
|
||||
|
||||
$table->index(['vote_id', 'user_id'], 'idx_vote_id_user_id');
|
||||
$table->comment('聊天对话记录(投票消息统计表)');
|
||||
});
|
||||
|
||||
$prefix = config('databases.default.prefix');
|
||||
Db::statement("ALTER TABLE `{$prefix}talk_records_vote_answer` comment '聊天对话记录(投票消息统计表)'");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
class CreateTalkRecordsLoginTable extends Migration
|
||||
{
|
||||
|
@ -28,10 +27,8 @@ class CreateTalkRecordsLoginTable extends Migration
|
|||
$table->engine = 'InnoDB';
|
||||
|
||||
$table->unique(['record_id'], 'uk_record_id');
|
||||
$table->comment('聊天对话记录(登录日志)');
|
||||
});
|
||||
|
||||
$prefix = config('databases.default.prefix');
|
||||
Db::statement("ALTER TABLE `{$prefix}talk_records_login` comment '聊天对话记录(登录日志)'");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue