Fixed migrations

This commit is contained in:
Dmitry Khomutov 2016-05-05 23:05:40 +06:00
parent ff36c2504f
commit be645cbd9f
8 changed files with 18 additions and 50 deletions

View file

@ -7,9 +7,6 @@ use Phinx\Migration\AbstractMigration;
*/
class InitialMigration extends AbstractMigration
{
/**
* Migrate Up.
*/
public function up()
{
// Set up tables:
@ -40,9 +37,6 @@ class InitialMigration extends AbstractMigration
$buildMeta->save();
}
/**
* Migrate Down.
*/
public function down()
{

View file

@ -4,9 +4,6 @@ use Phinx\Migration\AbstractMigration;
class ChangeBuildKeysMigration extends AbstractMigration
{
/**
* Migrate Up.
*/
public function up()
{
$project = $this->table('project');
@ -18,9 +15,6 @@ class ChangeBuildKeysMigration extends AbstractMigration
}
}
/**
* Migrate Down.
*/
public function down()
{
$project = $this->table('project');

View file

@ -4,22 +4,6 @@ use Phinx\Migration\AbstractMigration;
class ChooseBranch extends AbstractMigration
{
/**
* Change Method.
*
* More information on this method is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-change-method
*
* Uncomment this method if you would like to use it.
*
public function change()
{
}
*/
/**
* Migrate Up.
*/
public function up()
{
$project = $this->table('project');
@ -28,9 +12,6 @@ class ChooseBranch extends AbstractMigration
}
}
/**
* Migrate Down.
*/
public function down()
{
$project = $this->table('project');

View file

@ -4,9 +4,6 @@ use Phinx\Migration\AbstractMigration;
class FixDatabaseColumns extends AbstractMigration
{
/**
* Migrate Up.
*/
public function up()
{
$dbAdapter = $this->getAdapter();

View file

@ -4,9 +4,6 @@ use Phinx\Migration\AbstractMigration;
class ArchiveProject extends AbstractMigration
{
/**
* Migrate Up.
*/
public function up()
{
$project = $this->table('project');
@ -15,9 +12,6 @@ class ArchiveProject extends AbstractMigration
}
}
/**
* Migrate Down.
*/
public function down()
{
$project = $this->table('project');

View file

@ -5,9 +5,6 @@ use Phinx\Db\Adapter\MysqlAdapter;
class FixColumnTypes extends AbstractMigration
{
/**
* Migrate Up.
*/
public function up()
{
// Update the build log column to MEDIUMTEXT:

View file

@ -4,9 +4,6 @@ use Phinx\Migration\AbstractMigration;
class UniqueEmailAndNameUserFields extends AbstractMigration
{
/**
* Migrate Up.
*/
public function up()
{
$user_table = $this->table('user');
@ -18,9 +15,6 @@ class UniqueEmailAndNameUserFields extends AbstractMigration
}
}
/**
* Migrate Down.
*/
public function down()
{
$user_table = $this->table('user');

View file

@ -4,9 +4,13 @@ use Phinx\Migration\AbstractMigration;
class AddProjectGroups extends AbstractMigration
{
public function change()
public function up()
{
$table = $this->table('project_group');
if (!$this->hasTable('project_group')) {
$table->create();
}
if (!$table->hasColumn('title')) {
$table->addColumn('title', 'string', ['limit' => 100, 'null' => false])->save();
@ -26,4 +30,17 @@ class AddProjectGroups extends AbstractMigration
$table->addForeignKey('group_id', 'project_group', 'id', ['delete'=> 'RESTRICT', 'update' => 'CASCADE'])->save();
}
}
public function down()
{
$table = $this->table('project_group');
if ($this->hasTable('project_group')) {
$table->drop();
}
$table = $this->table('project');
if ($table->hasColumn('group_id')) {
$table->removeColumn('group_id');
}
}
}