Files
FendxPHP/database/migrations/2024_01_15_000006_create_migrations_table.php

31 lines
778 B
PHP
Raw Permalink Normal View History

<?php
declare(strict_types=1);
use Fendx\Database\Schema\Schema;
use Fendx\Database\Migration;
/**
* 创建迁移记录表
*/
class CreateMigrationsTable extends Migration
{
public function up(): void
{
Schema::create('migrations', function (Schema\Table $table) {
$table->id('id')->primary()->autoIncrement();
$table->string('migration', 255)->comment('迁移文件名');
$table->integer('batch')->comment('批次号');
$table->timestamp('ran_at')->useCurrent()->comment('执行时间');
// 索引
$table->index('migration');
$table->index('batch');
});
}
public function down(): void
{
Schema::dropIfExists('migrations');
}
}