支持多数据库

This commit is contained in:
zyimm 2023-01-11 16:26:56 +08:00
parent d4f8912a0f
commit 0fed8e8816

View File

@ -17,8 +17,6 @@ use Phinx\Db\Adapter\ProxyAdapter;
use Phinx\Migration\AbstractMigration; use Phinx\Migration\AbstractMigration;
use Phinx\Migration\MigrationInterface; use Phinx\Migration\MigrationInterface;
use Phinx\Util\Util; use Phinx\Util\Util;
use think\console\Input;
use think\console\Output;
use think\Exception; use think\Exception;
use think\facade\Env; use think\facade\Env;
use think\migration\Command; use think\migration\Command;
@ -64,8 +62,8 @@ abstract class Migrate extends Command
// Run the migration // Run the migration
if (method_exists($migration, MigrationInterface::CHANGE)) { if (method_exists($migration, MigrationInterface::CHANGE)) {
if (MigrationInterface::DOWN === $direction) { if (MigrationInterface::DOWN === $direction) {
// Create an instance of the ProxyAdapter so we can record all // Create an instance of the ProxyAdapter, so we can record all
// of the migration commands for reverse playback // the migration commands for reverse playback
/** @var ProxyAdapter $proxyAdapter */ /** @var ProxyAdapter $proxyAdapter */
$proxyAdapter = AdapterFactory::instance()->getWrapper('proxy', $this->getAdapter()); $proxyAdapter = AdapterFactory::instance()->getWrapper('proxy', $this->getAdapter());
$migration->setAdapter($proxyAdapter); $migration->setAdapter($proxyAdapter);
@ -87,7 +85,7 @@ abstract class Migrate extends Command
} }
// Record it in the database // Record it in the database
$this->getAdapter($migration->getDbConfig()) $this->getAdapter()
->migrated($migration, $direction, date('Y-m-d H:i:s', $startTime), date('Y-m-d H:i:s', time())); ->migrated($migration, $direction, date('Y-m-d H:i:s', $startTime), date('Y-m-d H:i:s', time()));
$end = microtime(true); $end = microtime(true);