<?php
$_db_migration_to = '01.03';
if (!isset($migrations) || !is_object($migrations))
	die("This file cannot be executed directly");
$migrations->CheckValid($_db_migration_to);
//===========================================================================================



$migrations->Run('01_admin_role.php', <<<'DB_UPDATE_FILE'
<?php

/** @var $migrations \Claromentis\Setup\SetupFacade */
$roles = UserRole::GetRolesByNames('Project Administrator');

if (count($roles) === 0)
{
	UserRole::CreateRoles(array('Project Administrator'));
}
DB_UPDATE_FILE
);


$migrations->Run('02_decimal_duration.php', <<<'DB_UPDATE_FILE'
<?php

/** @var $migrations \Claromentis\Setup\SetupFacade */
$migrations->GetDb()->AlterColumn('projects_task', 'duration', 'duration', 'FLOAT NULL DEFAULT 1');
DB_UPDATE_FILE
);


//===========================================================================================
$migrations->SetVersion('01.03');
