46 lines
1.0 KiB
PHP
46 lines
1.0 KiB
PHP
|
<?php
|
||
|
|
||
|
use Illuminate\Database\Migrations\Migration;
|
||
|
use Illuminate\Database\Schema\Blueprint;
|
||
|
use Illuminate\Support\Facades\Schema;
|
||
|
|
||
|
return new class extends Migration
|
||
|
{
|
||
|
/**
|
||
|
* Run the migrations.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function up(): void
|
||
|
{
|
||
|
Schema::create('maintenances', function (Blueprint $table) {
|
||
|
$table->id();
|
||
|
|
||
|
// 维护名称
|
||
|
$table->string('name')->index();
|
||
|
|
||
|
// 内容
|
||
|
$table->text('content')->nullable();
|
||
|
|
||
|
// 模块 ID
|
||
|
$table->string('module_id')->index()->nullable();
|
||
|
$table->foreign('module_id')->references('id')->on('modules')->onDelete('set null');
|
||
|
|
||
|
// 开始于
|
||
|
$table->dateTime('start_at')->nullable();
|
||
|
|
||
|
$table->dateTime('end_at')->nullable();
|
||
|
});
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Reverse the migrations.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function down(): void
|
||
|
{
|
||
|
Schema::dropIfExists('maintenances');
|
||
|
}
|
||
|
};
|