fix: 添加表存在性检查

This commit is contained in:
yatgei 2025-12-10 16:33:37 +08:00
parent 4621222fa3
commit 14a16a0374
5 changed files with 21 additions and 0 deletions

View File

@ -13,6 +13,10 @@ class CreateReportLinksTable extends Migration
*/ */
public function up() public function up()
{ {
if (Schema::hasTable('report_links')) {
return;
}
Schema::create('report_links', function (Blueprint $table) { Schema::create('report_links', function (Blueprint $table) {
$table->bigIncrements('id'); $table->bigIncrements('id');
$table->bigInteger('rid')->nullable()->default(0)->index()->comment('报告ID'); $table->bigInteger('rid')->nullable()->default(0)->index()->comment('报告ID');

View File

@ -8,6 +8,10 @@ return new class extends Migration
{ {
public function up(): void public function up(): void
{ {
if (Schema::hasTable('project_task_relations')) {
return;
}
Schema::create('project_task_relations', function (Blueprint $table) { Schema::create('project_task_relations', function (Blueprint $table) {
$table->id(); $table->id();
$table->unsignedBigInteger('task_id')->comment('任务ID'); $table->unsignedBigInteger('task_id')->comment('任务ID');

View File

@ -13,6 +13,10 @@ class CreateUserTagsTable extends Migration
*/ */
public function up() public function up()
{ {
if (Schema::hasTable('user_tags')) {
return;
}
Schema::create('user_tags', function (Blueprint $table) { Schema::create('user_tags', function (Blueprint $table) {
$table->bigIncrements('id'); $table->bigIncrements('id');
$table->unsignedBigInteger('user_id')->index()->comment('被标签用户ID'); $table->unsignedBigInteger('user_id')->index()->comment('被标签用户ID');

View File

@ -13,6 +13,10 @@ class CreateUserTagRecognitionsTable extends Migration
*/ */
public function up() public function up()
{ {
if (Schema::hasTable('user_tag_recognitions')) {
return;
}
Schema::create('user_tag_recognitions', function (Blueprint $table) { Schema::create('user_tag_recognitions', function (Blueprint $table) {
$table->bigIncrements('id'); $table->bigIncrements('id');
$table->unsignedBigInteger('tag_id')->index()->comment('标签ID'); $table->unsignedBigInteger('tag_id')->index()->comment('标签ID');

View File

@ -8,6 +8,11 @@ return new class extends Migration
{ {
public function up(): void public function up(): void
{ {
if (Schema::hasTable('umeng_logs')) {
return;
}
Schema::create('umeng_logs', function (Blueprint $table) { Schema::create('umeng_logs', function (Blueprint $table) {
$table->id(); $table->id();
$table->text('request')->nullable()->comment('请求参数'); $table->text('request')->nullable()->comment('请求参数');