$version
$version : float
Abstract Migration Class.
It is expected that the migrations you write extend from this class.
This abstract class proxies the various database methods to your specified adapter.
$adapter : \Phinx\Db\Adapter\AdapterInterface
$output : \think\console\Output
$input : \think\console\Input
__construct(integer $version, \think\console\Input|null $input = null, \think\console\Output|null $output = null)
Class Constructor.
integer | $version | Migration Version |
\think\console\Input|null | $input | |
\think\console\Output|null | $output |
setAdapter(\Phinx\Db\Adapter\AdapterInterface $adapter) : \Phinx\Migration\MigrationInterface
Sets the database adapter.
\Phinx\Db\Adapter\AdapterInterface | $adapter | Database Adapter |
getAdapter() : \Phinx\Db\Adapter\AdapterInterface
Gets the database adapter.
setInput(\think\console\Input $input) : \Phinx\Migration\MigrationInterface
Sets the input object to be used in migration object
\think\console\Input | $input |
getInput() : \think\console\Input
Gets the input object to be used in migration object
setOutput(\think\console\Output $output) : \Phinx\Migration\MigrationInterface
Sets the output object to be used in migration object
\think\console\Output | $output |
getOutput() : \think\console\Output
Gets the output object to be used in migration object
setVersion(float $version) : \Phinx\Migration\MigrationInterface
Sets the migration version number.
float | $version | Version |
table(string $tableName, array $options = array()) : \think\migration\db\Table
Returns an instance of the <code>\Table</code> class.
You can use this class to create and manipulate tables.
string | $tableName | Table Name |
array | $options | Options |
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: yunwuxin <448901948@qq.com>
// +----------------------------------------------------------------------
namespace think\migration;
use Phinx\Migration\AbstractMigration;
use think\migration\db\Table;
class Migrator extends AbstractMigration
{
/**
* @param string $tableName
* @param array $options
* @return Table
*/
public function table($tableName, $options = [])
{
return new Table($tableName, $options, $this->getAdapter());
}
}