Files

48 lines
991 B
PHP
Raw Permalink Normal View History

2026-08-31 11:33:59 +08:00
<?php
/**
* 插件迁移基类
*
* 迁移文件写法(匿名类方式):
*
* <?php
* use Illuminate\Database\Schema\Builder;
* use Illuminate\Database\Schema\Blueprint;
*
* return new class {
* public function up(Builder $schema): void
* {
* $schema->create('official_app', function (Blueprint $table) {
* $table->bigInteger('id')->primary();
* $table->string('name', 50);
* });
* }
*
* public function down(Builder $schema): void
* {
* $schema->dropIfExists('official_app');
* }
* };
*/
namespace core\plugin;
use Illuminate\Database\Schema\Builder;
use Illuminate\Database\Schema\Blueprint;
abstract class PluginMigrate
{
/**
* 迁移向上执行(安装)
*/
abstract public function up(Builder $schema): void;
/**
* 迁移向下执行(回滚)
*/
public function down(Builder $schema): void
{
// 可选实现
}
}