php-censor/src/Migrations/20140730143702_fix_database_columns.php

55 lines
2.8 KiB
PHP
Raw Normal View History

<?php
use Phinx\Migration\AbstractMigration;
class FixDatabaseColumns extends AbstractMigration
{
public function up()
{
$build = $this->table('build');
2016-05-07 08:43:21 +02:00
2016-04-20 17:39:48 +02:00
$build->changeColumn('project_id', 'integer', ['null' => false]);
$build->changeColumn('commit_id', 'string', ['limit' => 50, 'null' => false]);
$build->changeColumn('status', 'integer', ['null' => false]);
2016-04-25 19:30:23 +02:00
$build->changeColumn('log', 'text', ['null' => true]);
2016-04-20 17:39:48 +02:00
$build->changeColumn('branch', 'string', ['limit' => 50, 'null' => false, 'default' => 'master']);
$build->changeColumn('created', 'datetime', ['null' => true]);
$build->changeColumn('started', 'datetime', ['null' => true]);
$build->changeColumn('finished', 'datetime', ['null' => true]);
$build->changeColumn('committer_email', 'string', ['limit' => 512, 'null' => true]);
$build->changeColumn('commit_message', 'text', ['null' => true]);
$build->changeColumn('extra', 'text', ['null' => true]);
$buildMeta = $this->table('build_meta');
2016-05-07 08:43:21 +02:00
2016-04-20 17:39:48 +02:00
$buildMeta->changeColumn('project_id', 'integer', ['null' => false]);
$buildMeta->changeColumn('build_id', 'integer', ['null' => false]);
$buildMeta->changeColumn('meta_key', 'string', ['limit' => 250, 'null' => false]);
$buildMeta->changeColumn('meta_value', 'text', ['null' => false]);
$project = $this->table('project');
2016-05-07 08:43:21 +02:00
2016-04-20 17:39:48 +02:00
$project->changeColumn('title', 'string', ['limit' => 250, 'null' => false]);
$project->changeColumn('reference', 'string', ['limit' => 250, 'null' => false]);
$project->changeColumn('branch', 'string', ['limit' => 50, 'null' => false, 'default' => 'master']);
$project->changeColumn('ssh_private_key', 'text', ['null' => true, 'default' => null]);
$project->changeColumn('ssh_public_key', 'text', ['null' => true, 'default' => null]);
$project->changeColumn('type', 'string', ['limit' => 50, 'null' => false]);
$project->changeColumn('access_information', 'string', ['limit' => 250, 'null' => true, 'default' => null]);
$project->changeColumn('last_commit', 'string', ['limit' => 250, 'null' => true, 'default' => null]);
$project->changeColumn('ssh_public_key', 'text', ['null' => true, 'default' => null]);
$project->changeColumn('allow_public_status', 'integer', ['null' => false, 'default' => 0]);
$user = $this->table('user');
2016-05-07 08:43:21 +02:00
2016-04-20 17:39:48 +02:00
$user->changeColumn('email', 'string', ['limit' => 250, 'null' => false]);
$user->changeColumn('hash', 'string', ['limit' => 250, 'null' => false]);
$user->changeColumn('is_admin', 'integer', ['null' => false, 'default' => 0]);
$user->changeColumn('name', 'string', ['limit' => 250, 'null' => false]);
}
2016-05-07 08:43:21 +02:00
public function down()
{
}
2014-07-30 16:59:16 +02:00
}