Fixing database stuff
This commit is contained in:
parent
3eac0b0c23
commit
1b28d43b7f
|
@ -9,6 +9,13 @@ class FixDatabaseColumns extends AbstractMigration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
$dbAdapter = $this->getAdapter();
|
||||
|
||||
if ($dbAdapter instanceof \Phinx\Db\Adapter\PdoAdapter) {
|
||||
$pdo = $dbAdapter->getConnection();
|
||||
$pdo->exec('SET foreign_key_checks = 0');
|
||||
}
|
||||
|
||||
$build = $this->table('build');
|
||||
$build->changeColumn('project_id', 'integer', array('null' => false));
|
||||
$build->changeColumn('commit_id', 'string', array('limit' => 50, 'null' => false));
|
||||
|
@ -45,5 +52,10 @@ class FixDatabaseColumns extends AbstractMigration
|
|||
$user->changeColumn('hash', 'string', array('limit' => 250, 'null' => false));
|
||||
$user->changeColumn('is_admin', 'integer', array('null' => false, 'default' => 0));
|
||||
$user->changeColumn('name', 'string', array('limit' => 250, 'null' => false));
|
||||
|
||||
if ($dbAdapter instanceof \Phinx\Db\Adapter\PdoAdapter) {
|
||||
$pdo = $dbAdapter->getConnection();
|
||||
$pdo->exec('SET foreign_key_checks = 1');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,16 +110,15 @@ class BuildBase extends Model
|
|||
'commit_id' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 50,
|
||||
'nullable' => true,
|
||||
'default' => null,
|
||||
),
|
||||
'status' => array(
|
||||
'type' => 'tinyint',
|
||||
'length' => 4,
|
||||
'type' => 'int',
|
||||
'length' => 11,
|
||||
'default' => null,
|
||||
),
|
||||
'log' => array(
|
||||
'type' => 'longtext',
|
||||
'type' => 'text',
|
||||
'nullable' => true,
|
||||
'default' => null,
|
||||
),
|
||||
|
@ -155,7 +154,7 @@ class BuildBase extends Model
|
|||
'default' => null,
|
||||
),
|
||||
'extra' => array(
|
||||
'type' => 'longtext',
|
||||
'type' => 'text',
|
||||
'nullable' => true,
|
||||
'default' => null,
|
||||
),
|
||||
|
@ -382,10 +381,12 @@ class BuildBase extends Model
|
|||
/**
|
||||
* Set the value of CommitId / commit_id.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
public function setCommitId($value)
|
||||
{
|
||||
$this->_validateNotNull('CommitId', $value);
|
||||
$this->_validateString('CommitId', $value);
|
||||
|
||||
if ($this->data['commit_id'] === $value) {
|
||||
|
|
|
@ -91,17 +91,15 @@ class BuildMetaBase extends Model
|
|||
'build_id' => array(
|
||||
'type' => 'int',
|
||||
'length' => 11,
|
||||
'nullable' => true,
|
||||
'default' => null,
|
||||
),
|
||||
'meta_key' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 255,
|
||||
'length' => 250,
|
||||
'default' => null,
|
||||
),
|
||||
'meta_value' => array(
|
||||
'type' => 'longtext',
|
||||
'nullable' => true,
|
||||
'type' => 'text',
|
||||
'default' => null,
|
||||
),
|
||||
);
|
||||
|
@ -238,10 +236,12 @@ class BuildMetaBase extends Model
|
|||
/**
|
||||
* Set the value of BuildId / build_id.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value int
|
||||
*/
|
||||
public function setBuildId($value)
|
||||
{
|
||||
$this->_validateNotNull('BuildId', $value);
|
||||
$this->_validateInt('BuildId', $value);
|
||||
|
||||
if ($this->data['build_id'] === $value) {
|
||||
|
@ -276,10 +276,12 @@ class BuildMetaBase extends Model
|
|||
/**
|
||||
* Set the value of MetaValue / meta_value.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
public function setMetaValue($value)
|
||||
{
|
||||
$this->_validateNotNull('MetaValue', $value);
|
||||
$this->_validateString('MetaValue', $value);
|
||||
|
||||
if ($this->data['meta_value'] === $value) {
|
||||
|
|
|
@ -36,6 +36,7 @@ class ProjectBase extends Model
|
|||
'id' => null,
|
||||
'title' => null,
|
||||
'reference' => null,
|
||||
'branch' => null,
|
||||
'ssh_private_key' => null,
|
||||
'type' => null,
|
||||
'access_information' => null,
|
||||
|
@ -53,6 +54,7 @@ class ProjectBase extends Model
|
|||
'id' => 'getId',
|
||||
'title' => 'getTitle',
|
||||
'reference' => 'getReference',
|
||||
'branch' => 'getBranch',
|
||||
'ssh_private_key' => 'getSshPrivateKey',
|
||||
'type' => 'getType',
|
||||
'access_information' => 'getAccessInformation',
|
||||
|
@ -72,6 +74,7 @@ class ProjectBase extends Model
|
|||
'id' => 'setId',
|
||||
'title' => 'setTitle',
|
||||
'reference' => 'setReference',
|
||||
'branch' => 'setBranch',
|
||||
'ssh_private_key' => 'setSshPrivateKey',
|
||||
'type' => 'setType',
|
||||
'access_information' => 'setAccessInformation',
|
||||
|
@ -104,6 +107,11 @@ class ProjectBase extends Model
|
|||
'length' => 250,
|
||||
'default' => null,
|
||||
),
|
||||
'branch' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 50,
|
||||
'default' => 'master',
|
||||
),
|
||||
'ssh_private_key' => array(
|
||||
'type' => 'text',
|
||||
'nullable' => true,
|
||||
|
@ -112,7 +120,7 @@ class ProjectBase extends Model
|
|||
'type' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 50,
|
||||
'default' => 1,
|
||||
'default' => null,
|
||||
),
|
||||
'access_information' => array(
|
||||
'type' => 'varchar',
|
||||
|
@ -137,9 +145,8 @@ class ProjectBase extends Model
|
|||
'default' => null,
|
||||
),
|
||||
'allow_public_status' => array(
|
||||
'type' => 'tinyint',
|
||||
'length' => 4,
|
||||
'default' => null,
|
||||
'type' => 'int',
|
||||
'length' => 11,
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -193,6 +200,18 @@ class ProjectBase extends Model
|
|||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of Branch / branch.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBranch()
|
||||
{
|
||||
$rtn = $this->data['branch'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of SshPrivateKey / ssh_private_key.
|
||||
*
|
||||
|
@ -337,6 +356,26 @@ class ProjectBase extends Model
|
|||
$this->_setModified('reference');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of Branch / branch.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
public function setBranch($value)
|
||||
{
|
||||
$this->_validateNotNull('Branch', $value);
|
||||
$this->_validateString('Branch', $value);
|
||||
|
||||
if ($this->data['branch'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['branch'] = $value;
|
||||
|
||||
$this->_setModified('branch');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of SshPrivateKey / ssh_private_key.
|
||||
*
|
||||
|
|
|
@ -90,14 +90,12 @@ class UserBase extends Model
|
|||
'default' => null,
|
||||
),
|
||||
'is_admin' => array(
|
||||
'type' => 'tinyint',
|
||||
'length' => 1,
|
||||
'default' => null,
|
||||
'type' => 'int',
|
||||
'length' => 11,
|
||||
),
|
||||
'name' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
'nullable' => true,
|
||||
'default' => null,
|
||||
),
|
||||
);
|
||||
|
@ -259,10 +257,12 @@ class UserBase extends Model
|
|||
/**
|
||||
* Set the value of Name / name.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
public function setName($value)
|
||||
{
|
||||
$this->_validateNotNull('Name', $value);
|
||||
$this->_validateString('Name', $value);
|
||||
|
||||
if ($this->data['name'] === $value) {
|
||||
|
|
Loading…
Reference in a new issue