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'); }