Refactoring

This commit is contained in:
gamonoid
2017-09-03 20:39:22 +02:00
parent af40881847
commit a7274d3cfd
5075 changed files with 238202 additions and 16291 deletions

5
data/migrations/list.php Normal file
View 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';

View 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);
}
}

View 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(){
}
}

View 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);
}
}