Initial implementation CI environments

This commit is contained in:
Stepan Strelets 2017-03-23 15:53:24 +03:00 committed by Dmitry Khomutov
commit 047cedaab3
No known key found for this signature in database
GPG key ID: 7EB36C9576F9ECB9
21 changed files with 850 additions and 42 deletions

View 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();
}
}
}