改进 task,增加 notifications
This commit is contained in:
parent
c9b4b4dcc1
commit
bc85e6c1f0
@ -1,8 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use App\Models\User;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use App\Models\Module\ProviderModule;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
@ -15,6 +17,21 @@ public function up()
|
|||||||
{
|
{
|
||||||
Schema::create('tasks', function (Blueprint $table) {
|
Schema::create('tasks', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
|
|
||||||
|
$table->string('title');
|
||||||
|
|
||||||
|
// progress (max 100)
|
||||||
|
$table->integer('progress')->default(0);
|
||||||
|
|
||||||
|
// status
|
||||||
|
$table->enum('status', ['pending', 'done', 'success', 'failed', 'error', 'cancelled', 'processing'])->index();
|
||||||
|
|
||||||
|
// user id
|
||||||
|
$table->foreignIdFor(User::class)->index();
|
||||||
|
|
||||||
|
// provider module id
|
||||||
|
$table->foreignIdFor(ProviderModule::class)->index();
|
||||||
|
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,12 @@
|
|||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('messages', function (Blueprint $table) {
|
Schema::create('notifications', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->uuid('id')->primary();
|
||||||
|
$table->string('type');
|
||||||
|
$table->morphs('notifiable');
|
||||||
|
$table->text('data');
|
||||||
|
$table->timestamp('read_at')->nullable();
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -26,6 +30,6 @@ public function up()
|
|||||||
*/
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('messages');
|
Schema::dropIfExists('notifications');
|
||||||
}
|
}
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user