From 7992286367f1d48d9d94fad05354aae26614aa0a Mon Sep 17 00:00:00 2001 From: "iVampireSP.com" Date: Thu, 2 Feb 2023 20:20:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2023_02_02_000001_create_modules_table.php | 2 +- ... => 2023_02_02_201951_create_notifications_table.php} | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) rename database/migrations/{2023_02_02_000000_create_notifications_table.php => 2023_02_02_201951_create_notifications_table.php} (73%) diff --git a/database/migrations/2023_02_02_000001_create_modules_table.php b/database/migrations/2023_02_02_000001_create_modules_table.php index a4af1b0..964868d 100644 --- a/database/migrations/2023_02_02_000001_create_modules_table.php +++ b/database/migrations/2023_02_02_000001_create_modules_table.php @@ -19,9 +19,9 @@ public function up(): void $table->decimal('balance', 20, 4)->default(0)->index(); $table->string('api_token')->nullable()->unique(); $table->string('url')->nullable()->index(); + $table->string('wecom_key')->nullable()->comment('企业微信机器人 key'); $table->enum('status', ['up', 'down', 'maintenance'])->default('down')->index(); $table->timestamps(); - $table->string('wecom_key')->nullable()->comment('企业微信机器人 key'); }); } diff --git a/database/migrations/2023_02_02_000000_create_notifications_table.php b/database/migrations/2023_02_02_201951_create_notifications_table.php similarity index 73% rename from database/migrations/2023_02_02_000000_create_notifications_table.php rename to database/migrations/2023_02_02_201951_create_notifications_table.php index 14ad82f..4357c9e 100644 --- a/database/migrations/2023_02_02_000000_create_notifications_table.php +++ b/database/migrations/2023_02_02_201951_create_notifications_table.php @@ -11,13 +11,12 @@ * * @return void */ - public function up(): void + public function up() { Schema::create('notifications', function (Blueprint $table) { - $table->uuid()->primary(); + $table->uuid('id')->primary(); $table->string('type'); - $table->string('notifiable_type')->index(); - $table->unsignedBigInteger('notifiable_id')->index(); + $table->morphs('notifiable'); $table->text('data'); $table->timestamp('read_at')->nullable(); $table->timestamps(); @@ -29,7 +28,7 @@ public function up(): void * * @return void */ - public function down(): void + public function down() { Schema::dropIfExists('notifications'); }