Skip to content
Snippets Groups Projects
Commit 6658896b authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

dev #51538 : set default value to allDaysSerialized

parent bd28dd36
Branches
Tags
3 merge requests!2334Master,!2325Dev#51538 1655 pouvoir parametrer les jours de lancement des batchs,!2303Dev#51538 1655 pouvoir parametrer les jours de lancement des batchs
......@@ -4,6 +4,7 @@ $adapter = Zend_Db_Table_Abstract::getDefaultAdapter();
try {
$adapter->query('select pick_day from batchs limit 1');
} catch (Exception $e) {
$adapter->query('ALTER TABLE `batchs` ADD COLUMN `pick_day` VARCHAR(255) NULL DEFAULT NULL;');
$week_days = new Class_Repeat_WeekDays();
$adapter->query('ALTER TABLE `batchs` ADD COLUMN `pick_day` VARCHAR(255) NOT NULL DEFAULT "' . $week_days->allDaysSerialized() . '";');
}
?>
\ No newline at end of file
......@@ -118,7 +118,6 @@ class Class_Batch extends Storm_Model_Abstract {
protected $_table_name = 'batchs';
protected $_loader_class = 'Class_BatchLoader';
protected $_default_attribute_values = ['type'=> '',
'pick_day' => '',
'last_run' => ''];
public function __construct() {
......
......@@ -177,6 +177,12 @@ abstract class UpgradeDBTestCase extends PHPUnit_Framework_TestCase {
}
protected function assertFieldDefault($table, $column, $default, $message='') {
return $this->assertField($table, $column, $default, 'Default', $message);
}
protected function assertField($table, $column, $expected, $field, $message = '') {
try {
$fields = [];
......@@ -1672,7 +1678,8 @@ class UpgradeDB_334_Test extends UpgradeDBTestCase {
/** @test */
public function pickDayColumnShouldBeAdded() {
$this->assertColumn('batchs', 'pick_day');
public function pickDayDefaultShouldBeAllWeekDays() {
$this->assertFieldDefault('batchs', 'pick_day', '1;2;3;4;5;6;0');
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment