mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-05 09:42:47 +08:00
修复seeder错误;删除第三方的think迁移工具,在extend中重新实现;
This commit is contained in:
38
extend/phinx/Db/Action/Action.php
Normal file
38
extend/phinx/Db/Action/Action.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
* For full license information, please view the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Phinx\Db\Action;
|
||||
|
||||
use Phinx\Db\Table\Table;
|
||||
|
||||
abstract class Action
|
||||
{
|
||||
/**
|
||||
* @var \Phinx\Db\Table\Table
|
||||
*/
|
||||
protected $table;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \Phinx\Db\Table\Table $table the Table to apply the action to
|
||||
*/
|
||||
public function __construct(Table $table)
|
||||
{
|
||||
$this->table = $table;
|
||||
}
|
||||
|
||||
/**
|
||||
* The table this action will be applied to
|
||||
*
|
||||
* @return \Phinx\Db\Table\Table
|
||||
*/
|
||||
public function getTable(): Table
|
||||
{
|
||||
return $this->table;
|
||||
}
|
||||
}
|
||||
62
extend/phinx/Db/Action/AddColumn.php
Normal file
62
extend/phinx/Db/Action/AddColumn.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
* For full license information, please view the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Phinx\Db\Action;
|
||||
|
||||
use Phinx\Db\Table\Column;
|
||||
use Phinx\Db\Table\Table;
|
||||
|
||||
class AddColumn extends Action
|
||||
{
|
||||
/**
|
||||
* The column to add
|
||||
*
|
||||
* @var \Phinx\Db\Table\Column
|
||||
*/
|
||||
protected $column;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \Phinx\Db\Table\Table $table The table to add the column to
|
||||
* @param \Phinx\Db\Table\Column $column The column to add
|
||||
*/
|
||||
public function __construct(Table $table, Column $column)
|
||||
{
|
||||
parent::__construct($table);
|
||||
$this->column = $column;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new AddColumn object after assembling the given commands
|
||||
*
|
||||
* @param \Phinx\Db\Table\Table $table The table to add the column to
|
||||
* @param string $columnName The column name
|
||||
* @param string|\Phinx\Util\Literal $type The column type
|
||||
* @param array<string, mixed> $options The column options
|
||||
* @return static
|
||||
*/
|
||||
public static function build(Table $table, string $columnName, $type = null, array $options = [])
|
||||
{
|
||||
$column = new Column();
|
||||
$column->setName($columnName);
|
||||
$column->setType($type);
|
||||
$column->setOptions($options); // map options to column methods
|
||||
|
||||
return new static($table, $column);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the column to be added
|
||||
*
|
||||
* @return \Phinx\Db\Table\Column
|
||||
*/
|
||||
public function getColumn(): Column
|
||||
{
|
||||
return $this->column;
|
||||
}
|
||||
}
|
||||
78
extend/phinx/Db/Action/AddForeignKey.php
Normal file
78
extend/phinx/Db/Action/AddForeignKey.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
* For full license information, please view the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Phinx\Db\Action;
|
||||
|
||||
use Phinx\Db\Table\ForeignKey;
|
||||
use Phinx\Db\Table\Table;
|
||||
|
||||
class AddForeignKey extends Action
|
||||
{
|
||||
/**
|
||||
* The foreign key to add
|
||||
*
|
||||
* @var \Phinx\Db\Table\ForeignKey
|
||||
*/
|
||||
protected $foreignKey;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \Phinx\Db\Table\Table $table The table to add the foreign key to
|
||||
* @param \Phinx\Db\Table\ForeignKey $fk The foreign key to add
|
||||
*/
|
||||
public function __construct(Table $table, ForeignKey $fk)
|
||||
{
|
||||
parent::__construct($table);
|
||||
$this->foreignKey = $fk;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new AddForeignKey object after building the foreign key with
|
||||
* the passed attributes
|
||||
*
|
||||
* @param \Phinx\Db\Table\Table $table The table object to add the foreign key to
|
||||
* @param string|string[] $columns The columns for the foreign key
|
||||
* @param \Phinx\Db\Table\Table|string $referencedTable The table the foreign key references
|
||||
* @param string|string[] $referencedColumns The columns in the referenced table
|
||||
* @param array<string, mixed> $options Extra options for the foreign key
|
||||
* @param string|null $name The name of the foreign key
|
||||
* @return static
|
||||
*/
|
||||
public static function build(Table $table, $columns, $referencedTable, $referencedColumns = ['id'], array $options = [], ?string $name = null)
|
||||
{
|
||||
if (is_string($referencedColumns)) {
|
||||
$referencedColumns = [$referencedColumns]; // str to array
|
||||
}
|
||||
|
||||
if (is_string($referencedTable)) {
|
||||
$referencedTable = new Table($referencedTable);
|
||||
}
|
||||
|
||||
$fk = new ForeignKey();
|
||||
$fk->setReferencedTable($referencedTable)
|
||||
->setColumns($columns)
|
||||
->setReferencedColumns($referencedColumns)
|
||||
->setOptions($options);
|
||||
|
||||
if ($name !== null) {
|
||||
$fk->setConstraint($name);
|
||||
}
|
||||
|
||||
return new static($table, $fk);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the foreign key to be added
|
||||
*
|
||||
* @return \Phinx\Db\Table\ForeignKey
|
||||
*/
|
||||
public function getForeignKey(): ForeignKey
|
||||
{
|
||||
return $this->foreignKey;
|
||||
}
|
||||
}
|
||||
67
extend/phinx/Db/Action/AddIndex.php
Normal file
67
extend/phinx/Db/Action/AddIndex.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
* For full license information, please view the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Phinx\Db\Action;
|
||||
|
||||
use Phinx\Db\Table\Index;
|
||||
use Phinx\Db\Table\Table;
|
||||
|
||||
class AddIndex extends Action
|
||||
{
|
||||
/**
|
||||
* The index to add to the table
|
||||
*
|
||||
* @var \Phinx\Db\Table\Index
|
||||
*/
|
||||
protected $index;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \Phinx\Db\Table\Table $table The table to add the index to
|
||||
* @param \Phinx\Db\Table\Index $index The index to be added
|
||||
*/
|
||||
public function __construct(Table $table, Index $index)
|
||||
{
|
||||
parent::__construct($table);
|
||||
$this->index = $index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new AddIndex object after building the index object with the
|
||||
* provided arguments
|
||||
*
|
||||
* @param \Phinx\Db\Table\Table $table The table to add the index to
|
||||
* @param string|string[]|\Phinx\Db\Table\Index $columns The columns to index
|
||||
* @param array<string, mixed> $options Additional options for the index creation
|
||||
* @return static
|
||||
*/
|
||||
public static function build(Table $table, $columns, array $options = [])
|
||||
{
|
||||
// create a new index object if strings or an array of strings were supplied
|
||||
$index = $columns;
|
||||
|
||||
if (!$columns instanceof Index) {
|
||||
$index = new Index();
|
||||
|
||||
$index->setColumns($columns);
|
||||
$index->setOptions($options);
|
||||
}
|
||||
|
||||
return new static($table, $index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the index to be added
|
||||
*
|
||||
* @return \Phinx\Db\Table\Index
|
||||
*/
|
||||
public function getIndex(): Index
|
||||
{
|
||||
return $this->index;
|
||||
}
|
||||
}
|
||||
87
extend/phinx/Db/Action/ChangeColumn.php
Normal file
87
extend/phinx/Db/Action/ChangeColumn.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
* For full license information, please view the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Phinx\Db\Action;
|
||||
|
||||
use Phinx\Db\Table\Column;
|
||||
use Phinx\Db\Table\Table;
|
||||
|
||||
class ChangeColumn extends Action
|
||||
{
|
||||
/**
|
||||
* The column definition
|
||||
*
|
||||
* @var \Phinx\Db\Table\Column
|
||||
*/
|
||||
protected $column;
|
||||
|
||||
/**
|
||||
* The name of the column to be changed
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $columnName;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \Phinx\Db\Table\Table $table The table to alter
|
||||
* @param string $columnName The name of the column to change
|
||||
* @param \Phinx\Db\Table\Column $column The column definition
|
||||
*/
|
||||
public function __construct(Table $table, string $columnName, Column $column)
|
||||
{
|
||||
parent::__construct($table);
|
||||
$this->columnName = $columnName;
|
||||
$this->column = $column;
|
||||
|
||||
// if the name was omitted use the existing column name
|
||||
if ($column->getName() === null || strlen($column->getName()) === 0) {
|
||||
$column->setName($columnName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new ChangeColumn object after building the column definition
|
||||
* out of the provided arguments
|
||||
*
|
||||
* @param \Phinx\Db\Table\Table $table The table to alter
|
||||
* @param string $columnName The name of the column to change
|
||||
* @param string|\Phinx\Db\Table\Column|\Phinx\Util\Literal $type The type of the column
|
||||
* @param array<string, mixed> $options Additional options for the column
|
||||
* @return static
|
||||
*/
|
||||
public static function build(Table $table, string $columnName, $type = null, array $options = [])
|
||||
{
|
||||
$column = new Column();
|
||||
$column->setName($columnName);
|
||||
$column->setType($type);
|
||||
$column->setOptions($options); // map options to column methods
|
||||
|
||||
return new static($table, $columnName, $column);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the column to change
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getColumnName(): string
|
||||
{
|
||||
return $this->columnName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the column definition
|
||||
*
|
||||
* @return \Phinx\Db\Table\Column
|
||||
*/
|
||||
public function getColumn(): Column
|
||||
{
|
||||
return $this->column;
|
||||
}
|
||||
}
|
||||
42
extend/phinx/Db/Action/ChangeComment.php
Normal file
42
extend/phinx/Db/Action/ChangeComment.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
* For full license information, please view the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Phinx\Db\Action;
|
||||
|
||||
use Phinx\Db\Table\Table;
|
||||
|
||||
class ChangeComment extends Action
|
||||
{
|
||||
/**
|
||||
* The new comment for the table
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
protected $newComment;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \Phinx\Db\Table\Table $table The table to be changed
|
||||
* @param string|null $newComment The new comment for the table
|
||||
*/
|
||||
public function __construct(Table $table, ?string $newComment)
|
||||
{
|
||||
parent::__construct($table);
|
||||
$this->newComment = $newComment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the new comment for the table
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getNewComment(): ?string
|
||||
{
|
||||
return $this->newComment;
|
||||
}
|
||||
}
|
||||
42
extend/phinx/Db/Action/ChangePrimaryKey.php
Normal file
42
extend/phinx/Db/Action/ChangePrimaryKey.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
* For full license information, please view the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Phinx\Db\Action;
|
||||
|
||||
use Phinx\Db\Table\Table;
|
||||
|
||||
class ChangePrimaryKey extends Action
|
||||
{
|
||||
/**
|
||||
* The new columns for the primary key
|
||||
*
|
||||
* @var string|string[]|null
|
||||
*/
|
||||
protected $newColumns;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \Phinx\Db\Table\Table $table The table to be changed
|
||||
* @param string|string[]|null $newColumns The new columns for the primary key
|
||||
*/
|
||||
public function __construct(Table $table, $newColumns)
|
||||
{
|
||||
parent::__construct($table);
|
||||
$this->newColumns = $newColumns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the new columns for the primary key
|
||||
*
|
||||
* @return string|string[]|null
|
||||
*/
|
||||
public function getNewColumns()
|
||||
{
|
||||
return $this->newColumns;
|
||||
}
|
||||
}
|
||||
12
extend/phinx/Db/Action/CreateTable.php
Normal file
12
extend/phinx/Db/Action/CreateTable.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
* For full license information, please view the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Phinx\Db\Action;
|
||||
|
||||
class CreateTable extends Action
|
||||
{
|
||||
}
|
||||
68
extend/phinx/Db/Action/DropForeignKey.php
Normal file
68
extend/phinx/Db/Action/DropForeignKey.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
* For full license information, please view the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Phinx\Db\Action;
|
||||
|
||||
use Phinx\Db\Table\ForeignKey;
|
||||
use Phinx\Db\Table\Table;
|
||||
|
||||
class DropForeignKey extends Action
|
||||
{
|
||||
/**
|
||||
* The foreign key to remove
|
||||
*
|
||||
* @var \Phinx\Db\Table\ForeignKey
|
||||
*/
|
||||
protected $foreignKey;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \Phinx\Db\Table\Table $table The table to remove the constraint from
|
||||
* @param \Phinx\Db\Table\ForeignKey $foreignKey The foreign key to remove
|
||||
*/
|
||||
public function __construct(Table $table, ForeignKey $foreignKey)
|
||||
{
|
||||
parent::__construct($table);
|
||||
$this->foreignKey = $foreignKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new DropForeignKey object after building the ForeignKey
|
||||
* definition out of the passed arguments.
|
||||
*
|
||||
* @param \Phinx\Db\Table\Table $table The table to delete the foreign key from
|
||||
* @param string|string[] $columns The columns participating in the foreign key
|
||||
* @param string|null $constraint The constraint name
|
||||
* @return static
|
||||
*/
|
||||
public static function build(Table $table, $columns, ?string $constraint = null)
|
||||
{
|
||||
if (is_string($columns)) {
|
||||
$columns = [$columns];
|
||||
}
|
||||
|
||||
$foreignKey = new ForeignKey();
|
||||
$foreignKey->setColumns($columns);
|
||||
|
||||
if ($constraint) {
|
||||
$foreignKey->setConstraint($constraint);
|
||||
}
|
||||
|
||||
return new static($table, $foreignKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the foreign key to remove
|
||||
*
|
||||
* @return \Phinx\Db\Table\ForeignKey
|
||||
*/
|
||||
public function getForeignKey(): ForeignKey
|
||||
{
|
||||
return $this->foreignKey;
|
||||
}
|
||||
}
|
||||
75
extend/phinx/Db/Action/DropIndex.php
Normal file
75
extend/phinx/Db/Action/DropIndex.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
* For full license information, please view the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Phinx\Db\Action;
|
||||
|
||||
use Phinx\Db\Table\Index;
|
||||
use Phinx\Db\Table\Table;
|
||||
|
||||
class DropIndex extends Action
|
||||
{
|
||||
/**
|
||||
* The index to drop
|
||||
*
|
||||
* @var \Phinx\Db\Table\Index
|
||||
*/
|
||||
protected $index;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \Phinx\Db\Table\Table $table The table owning the index
|
||||
* @param \Phinx\Db\Table\Index $index The index to be dropped
|
||||
*/
|
||||
public function __construct(Table $table, Index $index)
|
||||
{
|
||||
parent::__construct($table);
|
||||
$this->index = $index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new DropIndex object after assembling the passed
|
||||
* arguments.
|
||||
*
|
||||
* @param \Phinx\Db\Table\Table $table The table where the index is
|
||||
* @param string[] $columns the indexed columns
|
||||
* @return static
|
||||
*/
|
||||
public static function build(Table $table, array $columns = [])
|
||||
{
|
||||
$index = new Index();
|
||||
$index->setColumns($columns);
|
||||
|
||||
return new static($table, $index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new DropIndex when the name of the index to drop
|
||||
* is known.
|
||||
*
|
||||
* @param \Phinx\Db\Table\Table $table The table where the index is
|
||||
* @param string $name The name of the index
|
||||
* @return static
|
||||
*/
|
||||
public static function buildFromName(Table $table, string $name)
|
||||
{
|
||||
$index = new Index();
|
||||
$index->setName($name);
|
||||
|
||||
return new static($table, $index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the index to be dropped
|
||||
*
|
||||
* @return \Phinx\Db\Table\Index
|
||||
*/
|
||||
public function getIndex(): Index
|
||||
{
|
||||
return $this->index;
|
||||
}
|
||||
}
|
||||
12
extend/phinx/Db/Action/DropTable.php
Normal file
12
extend/phinx/Db/Action/DropTable.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
* For full license information, please view the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Phinx\Db\Action;
|
||||
|
||||
class DropTable extends Action
|
||||
{
|
||||
}
|
||||
59
extend/phinx/Db/Action/RemoveColumn.php
Normal file
59
extend/phinx/Db/Action/RemoveColumn.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
* For full license information, please view the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Phinx\Db\Action;
|
||||
|
||||
use Phinx\Db\Table\Column;
|
||||
use Phinx\Db\Table\Table;
|
||||
|
||||
class RemoveColumn extends Action
|
||||
{
|
||||
/**
|
||||
* The column to be removed
|
||||
*
|
||||
* @var \Phinx\Db\Table\Column
|
||||
*/
|
||||
protected $column;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \Phinx\Db\Table\Table $table The table where the column is
|
||||
* @param \Phinx\Db\Table\Column $column The column to be removed
|
||||
*/
|
||||
public function __construct(Table $table, Column $column)
|
||||
{
|
||||
parent::__construct($table);
|
||||
$this->column = $column;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new RemoveColumn object after assembling the
|
||||
* passed arguments.
|
||||
*
|
||||
* @param \Phinx\Db\Table\Table $table The table where the column is
|
||||
* @param string $columnName The name of the column to drop
|
||||
* @return static
|
||||
*/
|
||||
public static function build(Table $table, string $columnName)
|
||||
{
|
||||
$column = new Column();
|
||||
$column->setName($columnName);
|
||||
|
||||
return new static($table, $column);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the column to be dropped
|
||||
*
|
||||
* @return \Phinx\Db\Table\Column
|
||||
*/
|
||||
public function getColumn(): Column
|
||||
{
|
||||
return $this->column;
|
||||
}
|
||||
}
|
||||
79
extend/phinx/Db/Action/RenameColumn.php
Normal file
79
extend/phinx/Db/Action/RenameColumn.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
* For full license information, please view the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Phinx\Db\Action;
|
||||
|
||||
use Phinx\Db\Table\Column;
|
||||
use Phinx\Db\Table\Table;
|
||||
|
||||
class RenameColumn extends Action
|
||||
{
|
||||
/**
|
||||
* The column to be renamed
|
||||
*
|
||||
* @var \Phinx\Db\Table\Column
|
||||
*/
|
||||
protected $column;
|
||||
|
||||
/**
|
||||
* The new name for the column
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $newName;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \Phinx\Db\Table\Table $table The table where the column is
|
||||
* @param \Phinx\Db\Table\Column $column The column to be renamed
|
||||
* @param string $newName The new name for the column
|
||||
*/
|
||||
public function __construct(Table $table, Column $column, string $newName)
|
||||
{
|
||||
parent::__construct($table);
|
||||
$this->newName = $newName;
|
||||
$this->column = $column;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new RenameColumn object after building the passed
|
||||
* arguments
|
||||
*
|
||||
* @param \Phinx\Db\Table\Table $table The table where the column is
|
||||
* @param string $columnName The name of the column to be changed
|
||||
* @param string $newName The new name for the column
|
||||
* @return static
|
||||
*/
|
||||
public static function build(Table $table, string $columnName, string $newName)
|
||||
{
|
||||
$column = new Column();
|
||||
$column->setName($columnName);
|
||||
|
||||
return new static($table, $column, $newName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the column to be changed
|
||||
*
|
||||
* @return \Phinx\Db\Table\Column
|
||||
*/
|
||||
public function getColumn(): Column
|
||||
{
|
||||
return $this->column;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the new name for the column
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getNewName(): string
|
||||
{
|
||||
return $this->newName;
|
||||
}
|
||||
}
|
||||
42
extend/phinx/Db/Action/RenameTable.php
Normal file
42
extend/phinx/Db/Action/RenameTable.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
* For full license information, please view the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Phinx\Db\Action;
|
||||
|
||||
use Phinx\Db\Table\Table;
|
||||
|
||||
class RenameTable extends Action
|
||||
{
|
||||
/**
|
||||
* The new name for the table
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $newName;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \Phinx\Db\Table\Table $table The table to be renamed
|
||||
* @param string $newName The new name for the table
|
||||
*/
|
||||
public function __construct(Table $table, string $newName)
|
||||
{
|
||||
parent::__construct($table);
|
||||
$this->newName = $newName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the new name for the table
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getNewName(): string
|
||||
{
|
||||
return $this->newName;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user