mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-07 02:22:48 +08:00
修复seeder错误;删除第三方的think迁移工具,在extend中重新实现;
This commit is contained in:
101
extend/phinx/Db/Plan/NewTable.php
Normal file
101
extend/phinx/Db/Plan/NewTable.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
* For full license information, please view the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Phinx\Db\Plan;
|
||||
|
||||
use Phinx\Db\Table\Column;
|
||||
use Phinx\Db\Table\Index;
|
||||
use Phinx\Db\Table\Table;
|
||||
|
||||
/**
|
||||
* Represents the collection of actions for creating a new table
|
||||
*/
|
||||
class NewTable
|
||||
{
|
||||
/**
|
||||
* The table to create
|
||||
*
|
||||
* @var \Phinx\Db\Table\Table
|
||||
*/
|
||||
protected $table;
|
||||
|
||||
/**
|
||||
* The list of columns to add
|
||||
*
|
||||
* @var \Phinx\Db\Table\Column[]
|
||||
*/
|
||||
protected $columns = [];
|
||||
|
||||
/**
|
||||
* The list of indexes to create
|
||||
*
|
||||
* @var \Phinx\Db\Table\Index[]
|
||||
*/
|
||||
protected $indexes = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \Phinx\Db\Table\Table $table The table to create
|
||||
*/
|
||||
public function __construct(Table $table)
|
||||
{
|
||||
$this->table = $table;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a column to the collection
|
||||
*
|
||||
* @param \Phinx\Db\Table\Column $column The column description
|
||||
* @return void
|
||||
*/
|
||||
public function addColumn(Column $column): void
|
||||
{
|
||||
$this->columns[] = $column;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an index to the collection
|
||||
*
|
||||
* @param \Phinx\Db\Table\Index $index The index description
|
||||
* @return void
|
||||
*/
|
||||
public function addIndex(Index $index): void
|
||||
{
|
||||
$this->indexes[] = $index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the table object associated to this collection
|
||||
*
|
||||
* @return \Phinx\Db\Table\Table
|
||||
*/
|
||||
public function getTable(): Table
|
||||
{
|
||||
return $this->table;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the columns collection
|
||||
*
|
||||
* @return \Phinx\Db\Table\Column[]
|
||||
*/
|
||||
public function getColumns(): array
|
||||
{
|
||||
return $this->columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the indexes collection
|
||||
*
|
||||
* @return \Phinx\Db\Table\Index[]
|
||||
*/
|
||||
public function getIndexes(): array
|
||||
{
|
||||
return $this->indexes;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user