elstc/cakephp-migration-manager

CakePHP 迁移 GUI 插件

安装次数: 3,017

依赖项: 0

建议者: 0

安全性: 0

星标: 0

关注者: 2

分支: 1

公开问题: 0

类型:cakephp-plugin

v3.0.0 2024-05-01 08:12 UTC

This package is auto-updated.

Last update: 2024-08-31 00:33:19 UTC


README

Software License Build Status Codecov Latest Stable Version

此插件通过网页浏览器提供数据库迁移的图形用户界面。

重要提示

此插件可以直接从网页浏览器运行迁移,因此某些操作可能会删除/破坏数据。您只有在服务器限制导致无法使用命令行界面时才应安装此插件。此外,在安装时,应正确设置身份验证和授权,以确保未经授权的用户无法执行它。

功能

  • 应用程序/插件迁移状态列表
  • 运行迁移/回滚迁移
  • 显示迁移文件

版本映射

安装

您可以使用 composer 将此插件安装到您的 CakePHP 应用程序中。

安装 composer 包的推荐方法是

composer require elstc/cakephp-migration-manager

在项目的 Application::bootstrap() 中添加以下语句以加载插件(打开 src/Application.php

\Cake\Core\Configure::write('Elastic/MigrationManager.baseController', \App\Controller\AppController::class);
$this->addPlugin('Elastic/MigrationManager');

注意:如果您不需要迁移,应该取消注释 $this->addPlugin('Elastic/MigrationManager') 以禁用插件。

配置键:Elastic/MigrationManager.baseController

指定 MigrationManager 控制器的基类。默认为 \Cake\Controller\Controller。确保在加载插件之前设置它,因为它将在插件的引导过程中使用。

例如)指定基类为 App\Controller\Admin\BaseController

Configure::write('Elastic/MigrationManager.baseController', \App\Controller\Admin\BaseController::class);

使用方法

您可以通过从浏览器访问 https://{your-app-host}/migration-manager/migrations 来使用它。

允许回滚

默认情况下,您无法调用回滚操作。如果您想回滚,请将以下语句添加到项目的 config/bootstrap.php 文件中

Configure::write('Elastic/MigrationManager.canRollback', true);