Refactoring
This commit is contained in:
5
data/migrations/list.php
Normal file
5
data/migrations/list.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
$migrationList = [];
|
||||
$migrationList[] = 'v20170702_190500_add_attendance_image';
|
||||
$migrationList[] = 'v20170310_190401_add_timesheet_changes';
|
||||
$migrationList[] = 'v20161116_190001_unique_index_cron_name';
|
||||
25
data/migrations/v20161116_190001_unique_index_cron_name.php
Normal file
25
data/migrations/v20161116_190001_unique_index_cron_name.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace Classes\Migration;
|
||||
|
||||
class v20161116_190001_unique_index_cron_name extends AbstractMigration{
|
||||
|
||||
public function up(){
|
||||
|
||||
$sql = <<<'SQL'
|
||||
Alter table Crons add unique key `KEY_Crons_name` (`name`);
|
||||
SQL;
|
||||
|
||||
|
||||
return $this->executeQuery($sql);
|
||||
}
|
||||
|
||||
public function down(){
|
||||
|
||||
$sql = <<<'SQL'
|
||||
Alter table Crons drop key `KEY_Crons_name`;
|
||||
SQL;
|
||||
|
||||
return $this->executeQuery($sql);
|
||||
}
|
||||
|
||||
}
|
||||
24
data/migrations/v20170310_190401_add_timesheet_changes.php
Normal file
24
data/migrations/v20170310_190401_add_timesheet_changes.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace Classes\Migration;
|
||||
|
||||
use Model\Setting;
|
||||
|
||||
class v20170310_190401_add_timesheet_changes extends AbstractMigration{
|
||||
|
||||
public function up(){
|
||||
$setting = new Setting();
|
||||
$setting->Load("name = ?", array('System: Time-sheet Entry Start and End time Required'));
|
||||
if(empty($setting->id)){
|
||||
$setting->name = 'System: Time-sheet Entry Start and End time Required';
|
||||
$setting->value = 1;
|
||||
$setting->description = 'Select 0 if you only need to store the time spend in time sheets';
|
||||
$setting->meta = '["value", {"label":"Value","type":"select","source":[["1","Yes"],["0","No"]]}]';
|
||||
$setting->Save();
|
||||
}
|
||||
}
|
||||
|
||||
public function down(){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
49
data/migrations/v20170702_190500_add_attendance_image.php
Normal file
49
data/migrations/v20170702_190500_add_attendance_image.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
namespace Classes\Migration;
|
||||
|
||||
class v20170702_190500_add_attendance_image extends AbstractMigration{
|
||||
|
||||
public function up(){
|
||||
|
||||
$setting = new Setting();
|
||||
$setting->Load("name = ?", array('Attendance: Photo Attendance'));
|
||||
if(empty($setting->id)){
|
||||
$setting->name = 'Attendance: Photo Attendance';
|
||||
$setting->value = 0;
|
||||
$setting->description = 'Require submitting a photo using web cam when marking attendance';
|
||||
$setting->meta = '["value", {"label":"Value","type":"select","source":[["1","Yes"],["0","No"]]}]';
|
||||
$setting->Save();
|
||||
}
|
||||
|
||||
|
||||
$sql = <<<'SQL'
|
||||
Alter table Attendance add column `image_in` longtext default null;
|
||||
SQL;
|
||||
|
||||
|
||||
return $this->executeQuery($sql);
|
||||
|
||||
$sql = <<<'SQL'
|
||||
Alter table Attendance add column `image_out` longtext default null;
|
||||
SQL;
|
||||
|
||||
|
||||
return $this->executeQuery($sql);
|
||||
}
|
||||
|
||||
public function down(){
|
||||
|
||||
$sql = <<<'SQL'
|
||||
Alter table Attendance drop column `image_in`;
|
||||
SQL;
|
||||
|
||||
return $this->executeQuery($sql);
|
||||
|
||||
$sql = <<<'SQL'
|
||||
Alter table Attendance drop column `image_out`;
|
||||
SQL;
|
||||
|
||||
return $this->executeQuery($sql);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user