Removed useless field 'last_commit' from table 'project'.
This commit is contained in:
parent
ad7670e81e
commit
2ed6377971
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Phinx\Migration\AbstractMigration;
|
||||||
|
|
||||||
|
class RemovedLastCommitFromProject extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
if ($this->hasTable('project')) {
|
||||||
|
$table = $this->table('project');
|
||||||
|
|
||||||
|
if ($table->hasColumn('last_commit')) {
|
||||||
|
$table
|
||||||
|
->removeColumn('last_commit')
|
||||||
|
->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
if ($this->hasTable('project')) {
|
||||||
|
$table = $this->table('project');
|
||||||
|
|
||||||
|
if (!$table->hasColumn('last_commit')) {
|
||||||
|
$table
|
||||||
|
->addColumn('last_commit', 'string', ['limit' => 250, 'null' => true, 'default' => null])
|
||||||
|
->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -24,7 +24,6 @@ class Project extends Model
|
||||||
'ssh_public_key' => null,
|
'ssh_public_key' => null,
|
||||||
'type' => null,
|
'type' => null,
|
||||||
'access_information' => null,
|
'access_information' => null,
|
||||||
'last_commit' => null,
|
|
||||||
'build_config' => null,
|
'build_config' => null,
|
||||||
'allow_public_status' => null,
|
'allow_public_status' => null,
|
||||||
'archived' => null,
|
'archived' => null,
|
||||||
|
@ -300,33 +299,6 @@ class Project extends Model
|
||||||
return $this->setModified('access_information');
|
return $this->setModified('access_information');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getLastCommit()
|
|
||||||
{
|
|
||||||
return $this->data['last_commit'];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $value
|
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
public function setLastCommit($value)
|
|
||||||
{
|
|
||||||
$this->validateString('last_commit', $value);
|
|
||||||
|
|
||||||
if ($this->data['last_commit'] === $value) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->data['last_commit'] = $value;
|
|
||||||
|
|
||||||
return $this->setModified('last_commit');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -24,7 +24,6 @@ class ProjectTest extends TestCase
|
||||||
'ssh_public_key' => null,
|
'ssh_public_key' => null,
|
||||||
'type' => null,
|
'type' => null,
|
||||||
'access_information' => null,
|
'access_information' => null,
|
||||||
'last_commit' => null,
|
|
||||||
'build_config' => null,
|
'build_config' => null,
|
||||||
'allow_public_status' => null,
|
'allow_public_status' => null,
|
||||||
'archived' => null,
|
'archived' => null,
|
||||||
|
@ -155,18 +154,6 @@ class ProjectTest extends TestCase
|
||||||
self::assertEquals(false, $result);
|
self::assertEquals(false, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testLastCommit()
|
|
||||||
{
|
|
||||||
$project = new Project();
|
|
||||||
|
|
||||||
$result = $project->setLastCommit('commit');
|
|
||||||
self::assertEquals(true, $result);
|
|
||||||
self::assertEquals('commit', $project->getLastCommit());
|
|
||||||
|
|
||||||
$result = $project->setLastCommit('commit');
|
|
||||||
self::assertEquals(false, $result);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testBuildConfig()
|
public function testBuildConfig()
|
||||||
{
|
{
|
||||||
$project = new Project();
|
$project = new Project();
|
||||||
|
|
Loading…
Reference in a new issue