Initial implementation CI environments
This commit is contained in:
parent
7f8b0234b9
commit
047cedaab3
21 changed files with 850 additions and 42 deletions
52
src/PHPCensor/Migrations/20170321131931_add_environment.php
Normal file
52
src/PHPCensor/Migrations/20170321131931_add_environment.php
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
class AddEnvironment extends AbstractMigration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$table = $this->table('environment');
|
||||
|
||||
if (!$this->hasTable('environment')) {
|
||||
$table->create();
|
||||
}
|
||||
|
||||
if (!$table->hasColumn('project_id')) {
|
||||
$table->addColumn('project_id', 'integer')->save();
|
||||
}
|
||||
|
||||
if (!$table->hasColumn('name')) {
|
||||
$table->addColumn('name', 'string', ['limit' => 20])->save();
|
||||
}
|
||||
|
||||
if (!$table->hasColumn('branches')) {
|
||||
$table->addColumn('branches', 'text')->save();
|
||||
}
|
||||
|
||||
if (!$table->hasIndex(['project_id', 'name'])) {
|
||||
$table->addIndex(['project_id', 'name'])->save();
|
||||
}
|
||||
|
||||
$table = $this->table('build');
|
||||
|
||||
if (!$table->hasColumn('environment')) {
|
||||
$table->addColumn('environment', 'string', ['limit' => 20])->save();
|
||||
}
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$table = $this->table('environment');
|
||||
|
||||
if ($this->hasTable('environment')) {
|
||||
$table->drop();
|
||||
}
|
||||
|
||||
$table = $this->table('build');
|
||||
|
||||
if ($table->hasColumn('environment')) {
|
||||
$table->removeColumn('environment')->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue