Latest updates from IceHrmPro

This commit is contained in:
Thilina Pituwala
2020-05-20 18:47:29 +02:00
parent 60c92d7935
commit 7453a58aad
18012 changed files with 2089245 additions and 10173 deletions

View File

@@ -1,5 +1,19 @@
<?php
$migrationList = [];
$migrationList[] = 'v20200518_270011_add_al_language';
$migrationList[] = 'v20200429_270010_setting_groups';
$migrationList[] = 'v20200411_270009_email_log';
$migrationList[] = 'v20200316_270006_add_provinces';
$migrationList[] = 'v20200404_270006_password_rate_limit';
$migrationList[] = 'v20200224_270004_update_module_names';
$migrationList[] = 'v20191121_270008_custom_user_roles';
$migrationList[] = 'v20191121_270007_team_management';
$migrationList[] = 'v20191118_270006_update_data_importers';
$migrationList[] = 'v20191024_270005_update_data_importers';
$migrationList[] = 'v20191024_270004_add_object_type_import';
$migrationList[] = 'v20191024_270003_payroll_column_function';
$migrationList[] = 'v20190919_260008_employee_leave_periods';
$migrationList[] = 'v20190805_260007_fix_expense_table';
$migrationList[] = 'v20190707_260006_google_map_api';
$migrationList[] = 'v20190707_260005_attendance_location';
$migrationList[] = 'v20190707_260004_attendance_out_map';

View File

@@ -0,0 +1,24 @@
<?php
namespace Classes\Migration;
class v20190805_260007_fix_expense_table extends AbstractMigration {
public function up(){
$sql = <<<'SQL'
Alter table EmployeeTravelRecords modify column `funding` decimal(10,2) NULL;
SQL;
$this->executeQuery($sql);
$sql = <<<'SQL'
Alter table EmployeeExpenses modify column `amount` decimal(10,2) NULL;
SQL;
return $this->executeQuery($sql);
}
public function down(){
return true;
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace Classes\Migration;
class v20190919_260008_employee_leave_periods extends AbstractMigration {
public function up(){
$sql = <<<'SQL'
alter table LeaveTypes add column employee_leave_period enum ('Yes', 'No') default 'No' null;
SQL;
$this->executeQuery($sql);
$sql = <<<'SQL'
alter table LeaveRules add column employee_leave_period enum ('Yes', 'No') default 'No' null;
SQL;
return $this->executeQuery($sql);
}
public function down(){
return true;
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace Classes\Migration;
class v20191022_270001_joined_date_settings extends AbstractMigration {
public function up(){
$sql = <<<'SQL'
REPLACE INTO `Settings` (`name`, `value`, `description`, `meta`) VALUES
('Leave: Use Confirmation Date Instead of Joined Date', '0', 'Use confirmation date instead of joined date for leave calculations','["value", {"label":"Value","type":"select","source":[["0","No"], ["1","Yes"]]}]');
SQL;
return $this->executeQuery($sql);
}
public function down(){
return true;
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace Classes\Migration;
class v20191024_270002_report_migrations extends AbstractMigration {
public function up(){
$sql = <<<'SQL'
REPLACE INTO `Reports` (`name`, `details`, `parameters`, `query`, `paramOrder`, `type`,`report_group`,`output`) VALUES
('Employee Leaves Report', 'This report list all employee leaves by employee, date range and leave status', '[\r\n[ "employee", {"label":"Employee","type":"select2multi","allow-null":true,"null-label":"All Employees","remote-source":["Employee","id","first_name+last_name"]}],\r\n[ "date_start", {"label":"Start Date","type":"date"}],\r\n[ "date_end", {"label":"End Date","type":"date"}],\r\n[ "status", {"label":"Leave Status","type":"select","source":[["NULL","All Statuses"],["Approved","Approved"],["Pending","Pending"],["Rejected","Rejected"],["Cancellation Requested","Cancellation Requested"],["Cancelled","Cancelled"]]}]\r\n]', 'EmployeeLeavesReport', '["employee","date_start","date_end","status"]', 'Class','Leave Management','CSV'),
('Employee Leave Entitlement', 'This report list employees leave entitlement for current leave period by department or by employee ',
'[[ "department", {"label":"Department","type":"select2","remote-source":["CompanyStructure","id","title"],"allow-null":true,"validation":"none"}],\r\n[ "employee", {"label":"Employee","type":"select2","allow-null":true,"validation":"none","remote-source":["Employee","id","first_name+last_name"]}]]',
'EmployeeLeaveEntitlementReport',
'["department","employee"]', 'Class','Leave Management','CSV'),
('Expense Report', 'This report list employees expenses for a specified period',
'[\r\n[ "employee", {"label":"Employee","type":"select2multi","allow-null":true,"null-label":"All Employees","remote-source":["Employee","id","first_name+last_name"]}],\r\n[ "date_start", {"label":"Start Date","type":"date"}],\r\n[ "date_end", {"label":"End Date","type":"date"}],\r\n[ "status", {"label":"Status","type":"select","source":[["NULL","All Statuses"],["Approved","Approved"],["Pending","Pending"],["Rejected","Rejected"],["Cancellation Requested","Cancellation Requested"],["Cancelled","Cancelled"]]}]\r\n]',
'ExpenseReport',
'["employee","date_start","date_end","status"]', 'Class','Travel and Expense Management','CSV');
SQL;
return $this->executeQuery($sql);
}
public function down(){
return true;
}
}

View File

@@ -0,0 +1,26 @@
<?php
namespace Classes\Migration;
class v20191024_270003_payroll_column_function extends AbstractMigration {
public function up(){
$sql = <<<'SQL'
Alter Table PayrollColumns modify column calculation_function TEXT null;
SQL;
$this->executeQuery($sql);
$sql = <<<'SQL'
Alter Table PayrollColumns add column function_type ENUM('Simple', 'Advanced') DEFAULT 'Simple';
SQL;
return $this->executeQuery($sql);
}
public function down(){
return true;
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace Classes\Migration;
class v20191024_270004_add_object_type_import extends AbstractMigration {
public function up(){
$sql = <<<'SQL'
Alter Table DataImport add column objectType varchar(60) NULL;
SQL;
$this->executeQuery($sql);
$sql = <<<'SQL'
ALTER TABLE DataImport ADD CONSTRAINT KEY_DataImport_name UNIQUE (name)
SQL;
return $this->executeQuery($sql);
}
public function down(){
return true;
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace Classes\Migration;
class v20191024_270005_update_data_importers extends AbstractMigration {
public function up(){
$sql = <<<'SQL'
Update DataImport set columns = '[{"name":"employee_id","title":"","type":"Normal","dependOn":"NULL","dependOnField":"","isKeyField":"No","idField":"Yes","id":"columns_7"},{"name":"first_name","title":"","type":"Normal","dependOn":"NULL","dependOnField":"","isKeyField":"No","idField":"No","id":"columns_3"},{"name":"middle_name","title":"","type":"Normal","dependOn":"NULL","dependOnField":"","isKeyField":"No","idField":"No","id":"columns_5"},{"name":"last_name","title":"","type":"Normal","dependOn":"NULL","dependOnField":"","isKeyField":"No","idField":"No","id":"columns_6"},{"name":"address1","title":"Address1","type":"Normal","dependOn":"NULL","dependOnField":"","isKeyField":"No","idField":"No","id":"columns_8"},{"name":"address2","title":"Address2","type":"Normal","dependOn":"NULL","dependOnField":"","isKeyField":"No","idField":"No","id":"columns_9"},{"name":"home_phone","title":"","type":"Normal","dependOn":"NULL","dependOnField":"","isKeyField":"No","idField":"No","id":"columns_14"},{"name":"mobile_phone","title":"","type":"Normal","dependOn":"NULL","dependOnField":"","isKeyField":"No","idField":"No","id":"columns_15"},{"name":"work_email","title":"","type":"Normal","dependOn":"NULL","dependOnField":"","isKeyField":"No","idField":"No","id":"columns_16"},{"name":"gender","title":"","type":"Normal","dependOn":"NULL","dependOnField":"","isKeyField":"No","idField":"No","id":"columns_17"},{"name":"marital_status","title":"","type":"Normal","dependOn":"NULL","dependOnField":"","isKeyField":"No","idField":"No","id":"columns_18"},{"name":"birthday","title":"","type":"Normal","dependOn":"NULL","dependOnField":"","isKeyField":"No","idField":"No","id":"columns_20"},{"name":"Nationality/nationality","title":"Nationality","type":"Reference","dependOn":"Nationality","dependOnField":"name","isKeyField":"Yes","idField":"No","id":"columns_22"},{"name":"Ethnicity/ethnicity","title":"Ethnicity","type":"Normal","dependOn":"Ethnicity","dependOnField":"name","isKeyField":"Yes","idField":"No","id":"columns_23"},{"name":"EmergencyContact/name","title":"","type":"Attached","dependOn":"EmergencyContact","dependOnField":"name","isKeyField":"Yes","idField":"No","id":"columns_24"},{"name":"EmergencyContact/relationship","title":"","type":"Attached","dependOn":"EmergencyContact","dependOnField":"relationship","isKeyField":"No","idField":"No","id":"columns_25"},{"name":"EmergencyContact/home_phone","title":"","type":"Attached","dependOn":"EmergencyContact","dependOnField":"home_phone","isKeyField":"No","idField":"No","id":"columns_26"},{"name":"ssn_num","title":"","type":"Normal","dependOn":"NULL","dependOnField":"","isKeyField":"No","idField":"No","id":"columns_31"},{"name":"job_title","title":"","type":"Reference","dependOn":"JobTitle","dependOnField":"name","isKeyField":"Yes","idField":"No","id":"columns_32"},{"name":"employment_status","title":"","type":"Reference","dependOn":"EmploymentStatus","dependOnField":"name","isKeyField":"Yes","idField":"No","id":"columns_33"},{"name":"joined_date","title":"","type":"Normal","dependOn":"NULL","dependOnField":"","isKeyField":"No","idField":"No","id":"columns_36"},{"name":"department","title":"","type":"Reference","dependOn":"CompanyStructure","dependOnField":"title","isKeyField":"Yes","idField":"No","id":"columns_38"}]' where name = 'Employee Data Import';
SQL;
return $this->executeQuery($sql);
}
public function down(){
return true;
}
}

View File

@@ -0,0 +1,50 @@
<?php
namespace Classes\Migration;
use Data\Common\Model\DataImport;
class v20191118_270006_update_data_importers extends AbstractMigration {
public function up(){
$dataImport = new DataImport();
$dataImport->Load('name = ?', ['Employee Data Import']);
if (!empty($dataImport->id)) {
$dataImport->columns = '[{"name":"employee_id","title":"Employee ID","type":"Normal","dependOn":"NULL","dependOnField":"NULL","idField":"No","sampleValue":"EMP05011","help":"Employee ID","id":"columns_7"},{"name":"first_name","title":"First name","type":"Normal","dependOn":"NULL","dependOnField":"NULL","idField":"No","sampleValue":"Chris","help":"First name","id":"columns_3"},{"name":"last_name","title":"Last name","type":"Normal","dependOn":"NULL","dependOnField":"NULL","idField":"No","sampleValue":"Doe","help":"Last name","id":"columns_6"},{"name":"address1","title":"Address line 1","type":"Normal","dependOn":"NULL","dependOnField":"NULL","idField":"No","sampleValue":"Abc Street","help":"Address line 1","id":"columns_8"},{"name":"address2","title":"Address line 2","type":"Normal","dependOn":"NULL","dependOnField":"NULL","idField":"No","sampleValue":"10","help":"Address line 2","id":"columns_9"},{"name":"home_phone","title":"Home phone","type":"Normal","dependOn":"NULL","dependOnField":"NULL","idField":"No","sampleValue":"+409 782324434","help":"Home phone","id":"columns_14"},{"name":"mobile_phone","title":"Mobile phone","type":"Normal","dependOn":"NULL","dependOnField":"NULL","idField":"No","sampleValue":"+49 176 4545454545","help":"Mobile phone","id":"columns_15"},{"name":"work_email","title":"Work email","type":"Normal","dependOn":"NULL","dependOnField":"NULL","idField":"No","sampleValue":"user@icehrm.com","help":"Work email","id":"columns_16"},{"name":"gender","title":"Gender","type":"Normal","dependOn":"NULL","dependOnField":"NULL","idField":"No","sampleValue":"Male","help":"Allowed values (Male, Female)","id":"columns_17"},{"name":"marital_status","title":"Marital status","type":"Normal","dependOn":"NULL","dependOnField":"NULL","idField":"No","sampleValue":"Single","help":"Marital status","id":"columns_18"},{"name":"birthday","title":"Birthday","type":"Normal","dependOn":"NULL","dependOnField":"NULL","idField":"No","sampleValue":"2003-12-15","help":"Birthday","id":"columns_20"},{"name":"nationality","title":"Nationality","type":"Reference","dependOn":"Nationality","dependOnField":"name","idField":"No","sampleValue":"Austrian","help":"Name of a Nationality defined under System->Metadata","id":"columns_22"},{"name":"ethnicity","title":"Ethnicity","type":"Reference","dependOn":"Ethnicity","dependOnField":"name","idField":"No","sampleValue":"Asian American","help":"Name of an Ethnicity defined under System -> Metadata","id":"columns_23"},{"name":"ssn_num","title":"Social security number","type":"Normal","dependOn":"NULL","dependOnField":"NULL","idField":"No","sampleValue":"34324903955WS","help":"Social security number","id":"columns_31"},{"name":"job_title","title":"Job title","type":"Reference","dependOn":"JobTitle","dependOnField":"name","idField":"No","sampleValue":"Software Engineer","help":"A Job title defined under Admin -> Job Details Setup","id":"columns_32"},{"name":"employment_status","title":"Employment status","type":"Reference","dependOn":"EmploymentStatus","dependOnField":"name","idField":"No","sampleValue":"Full Time","help":"Employment status defined under Admin -> Job Details","id":"columns_33"},{"name":"joined_date","title":"Joined date","type":"Normal","dependOn":"NULL","dependOnField":"NULL","idField":"No","sampleValue":"2015-04-17","help":"Joined date (YYYY-MM-DD format)","id":"columns_36"},{"name":"department","title":"Department","type":"Reference","dependOn":"CompanyStructure","dependOnField":"title","idField":"No","sampleValue":"Head Office","help":"Name of a Department","id":"columns_38"}]';
$dataImport->updated = date('Y-m-d H:i:s');
$dataImport->Save();
}
$dataImport = new DataImport();
$dataImport->Load('name = ?', ['Attendance Data Import']);
if (!empty($dataImport->id)) {
$dataImport->columns = '[{"name":"employee","title":"Employee","type":"Reference","dependOn":"Employee","dependOnField":"employee_id","idField":"Yes","sampleValue":"EMP050","help":"Employee id of the employee of the attendance record","id":"columns_1"},{"name":"in_time","title":"In time","type":"Normal","dependOn":"NULL","dependOnField":"NULL","idField":"No","sampleValue":"2019-11-06 08:15:00","help":"Time in format YYYY-MM-DD hh:mm:ss (use 24 hour time)","id":"columns_2"},{"name":"out_time","title":"Out time","type":"Normal","dependOn":"NULL","dependOnField":"NULL","idField":"No","sampleValue":"2019-11-06 15:18:00","help":"Time in format YYYY-MM-DD hh:mm:ss (use 24 hour time)","id":"columns_3"},{"name":"note","title":"Note","type":"Normal","dependOn":"NULL","dependOnField":"NULL","idField":"No","sampleValue":"Leaving a bit early today","help":"Free text (optional)","id":"columns_4"}]';
$dataImport->updated = date('Y-m-d H:i:s');
$dataImport->Save();
}
$dataImport = new DataImport();
$dataImport->Load('name = ?', ['Supervisor and Approver Import']);
if (!empty($dataImport->id)) {
$dataImport->columns = '[{"name":"employee_id","title":"Employee","type":"Reference","dependOn":"Employee","dependOnField":"employee_id","idField":"Yes","sampleValue":"EMP050","help":"Id of the employee to update approver details","id":"columns_1"},{"name":"supervisor","title":"Supervisor","type":"Reference","dependOn":"Employee","dependOnField":"employee_id","idField":"No","sampleValue":"EMP004","help":"Employee id of the supervisor","id":"columns_6"},{"name":"approver1","title":"Approver 1","type":"Reference","dependOn":"Employee","dependOnField":"employee_id","idField":"No","sampleValue":"EMP001","help":"Employee id of the first approver (can be empty)","id":"columns_4"},{"name":"approver2","title":"Approver 2","type":"Reference","dependOn":"Employee","dependOnField":"employee_id","idField":"No","sampleValue":"EMP002","help":"Employee id of the second approver (can be empty)","id":"columns_3"},{"name":"approver3","title":"Approver 3","type":"Reference","dependOn":"Employee","dependOnField":"employee_id","idField":"No","sampleValue":"EMP003","help":"Employee id of the third approver (can be empty)","id":"columns_5"}]';
$dataImport->updated = date('Y-m-d H:i:s');
$dataImport->Save();
} else {
$dataImport->columns = '[{"name":"employee_id","title":"Employee","type":"Reference","dependOn":"Employee","dependOnField":"employee_id","idField":"Yes","sampleValue":"EMP050","help":"Id of the employee to update approver details","id":"columns_1"},{"name":"supervisor","title":"Supervisor","type":"Reference","dependOn":"Employee","dependOnField":"employee_id","idField":"No","sampleValue":"EMP004","help":"Employee id of the supervisor","id":"columns_6"},{"name":"approver1","title":"Approver 1","type":"Reference","dependOn":"Employee","dependOnField":"employee_id","idField":"No","sampleValue":"EMP001","help":"Employee id of the first approver (can be empty)","id":"columns_4"},{"name":"approver2","title":"Approver 2","type":"Reference","dependOn":"Employee","dependOnField":"employee_id","idField":"No","sampleValue":"EMP002","help":"Employee id of the second approver (can be empty)","id":"columns_3"},{"name":"approver3","title":"Approver 3","type":"Reference","dependOn":"Employee","dependOnField":"employee_id","idField":"No","sampleValue":"EMP003","help":"Employee id of the third approver (can be empty)","id":"columns_5"}]';
$dataImport->name = 'Supervisor and Approver Import';
$dataImport->dataType = 'EmployeeDataImporter';
$dataImport->details = '';
$dataImport->updated = date('Y-m-d H:i:s');
$dataImport->created = date('Y-m-d H:i:s');
$dataImport->Save();
}
return true;
}
public function down(){
return true;
}
}

View File

@@ -0,0 +1,40 @@
<?php
namespace Classes\Migration;
class v20191121_270007_team_management extends AbstractMigration {
public function up(){
$sql = <<<'SQL'
create table `EmployeeTeams` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(100),
`description` text,
`lead` bigint(20),
`department` bigint(20),
primary key (`id`),
CONSTRAINT `Fk_EmployeeTeams_Lead` FOREIGN KEY (`lead`) REFERENCES `Employees` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `Fk_EmployeeTeams_Department` FOREIGN KEY (`department`) REFERENCES `CompanyStructures` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) engine=innodb default charset=utf8;
SQL;
$this->executeQuery($sql);
$sql = <<<'SQL'
create table `EmployeeTeamMembers` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`team` bigint(20) ,
`member` bigint(20),
`role` varchar(60),
primary key (`id`),
CONSTRAINT `Fk_EmployeeTeamMembers_Team` FOREIGN KEY (`team`) REFERENCES `EmployeeTeams` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `Fk_EmployeeTeamMembers_Member` FOREIGN KEY (`member`) REFERENCES `Employees` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) engine=innodb default charset=utf8;
SQL;
return $this->executeQuery($sql);
}
public function down(){
return true;
}
}

View File

@@ -0,0 +1,28 @@
<?php
namespace Classes\Migration;
class v20191121_270008_custom_user_roles extends AbstractMigration {
public function up(){
$sql = <<<'SQL'
ALTER TABLE Users modify column `user_level` enum('Admin','Employee','Manager','Other','Restricted Admin') default NULL;
SQL;
$this->executeQuery($sql);
$sql = <<<'SQL'
Update Users set user_level = 'Restricted Admin' where user_level = 'Other';
SQL;
$this->executeQuery($sql);
$sql = <<<'SQL'
ALTER TABLE Users modify column `user_level` enum('Admin','Employee','Manager','Restricted Admin', 'Restricted Manager', 'Restricted Employee') default NULL;
SQL;
return $this->executeQuery($sql);
}
public function down(){
return true;
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace Classes\Migration;
class v20200224_270004_update_module_names extends AbstractMigration {
public function up(){
$sql = <<<'SQL'
Update Settings set value = '1' where name = 'System: Add New Permissions';
SQL;
$this->executeQuery($sql);
$sql = <<<'SQL'
Update Settings set value = '1' where name = 'System: Reset Module Names';
SQL;
return $this->executeQuery($sql);
}
public function down(){
return true;
}
}

View File

@@ -0,0 +1,27 @@
<?php
namespace Classes\Migration;
class v20200311_270005_update_gender extends AbstractMigration {
public function up(){
$sql = <<<'SQL'
ALTER TABLE Candidates modify column `gender` enum('Male','Female', 'Divers') default NULL;
SQL;
$this->executeQuery($sql);
$sql = <<<'SQL'
ALTER TABLE Employees modify column `gender` enum('Male','Female', 'Divers') default NULL;
SQL;
$this->executeQuery($sql);
$sql = <<<'SQL'
ALTER TABLE ArchivedEmployees modify column `gender` enum('Male','Female', 'Divers') default NULL;
SQL;
return $this->executeQuery($sql);
}
public function down(){
return true;
}
}

View File

@@ -0,0 +1,53 @@
<?php
namespace Classes\Migration;
class v20200316_270006_add_provinces extends AbstractMigration{
public function up(){
$sql = <<<'SQL'
INSERT INTO `Province` (`code`, `name`, `country`) VALUES
('AN', 'Andaman and Nicobar Islands','IN'),
('AP', 'Andhra Pradesh', 'IN'),
('AR', 'Arunachal Pradesh', 'IN'),
('AS', 'Assam', 'IN'),
('BR', 'Bihar', 'IN'),
('CH', 'Chandigarh', 'IN'),
('CG', 'Chhattisgarh', 'IN'),
('DN', 'Dadra and Nagar Haveli', 'IN'),
('DD', 'Daman and Diu', 'IN'),
('DL', 'Delhi', 'IN'),
('GA', 'Goa', 'IN'),
('GJ', 'Gujarat', 'IN'),
('HR', 'Haryana', 'IN'),
('HP', 'Himachal Pradesh', 'IN'),
('JK', 'Jammu and Kashmir', 'IN'),
('KA', 'Karnataka', 'IN'),
('KL', 'Kerala', 'IN'),
('LD', 'Lakshadweep Islands', 'IN'),
('MP', 'Madhya Pradesh', 'IN'),
('MH', 'Maharashtra', 'IN'),
('MN', 'Manipur', 'IN'),
('ML', 'Meghalaya', 'IN'),
('MZ', 'Mizoram', 'IN'),
('NL', 'Nagaland', 'IN'),
('NL', 'Nagaland', 'IN'),
('OR', 'Odisha', 'IN'),
('PY', 'Puducherry', 'IN'),
('PB', 'Punjab', 'IN'),
('RJ', 'Rajasthan', 'IN'),
('SK', 'Sikkim', 'IN'),
('TN', 'Tamil Nadu', 'IN'),
('TS', 'Telangana', 'IN'),
('TR', 'Tripura', 'IN'),
('UP', 'Uttar Pradesh', 'IN'),
('UK', 'Uttarakhand', 'IN'),
('WB', 'West Bengal', 'IN');
SQL;
return $this->executeQuery($sql);
}
public function down(){
return true;
}
}

View File

@@ -0,0 +1,27 @@
<?php
namespace Classes\Migration;
class v20200404_270006_password_rate_limit extends AbstractMigration {
public function up(){
$sql = <<<'SQL'
ALTER TABLE Users ADD column `wrong_password_count` int(11) default 0;
SQL;
$this->executeQuery($sql);
$sql = <<<'SQL'
ALTER TABLE Users ADD column `last_wrong_attempt_at` datetime default NULL;
SQL;
$this->executeQuery($sql);
$sql = <<<'SQL'
ALTER TABLE Users ADD column `last_password_requested_at` datetime default NULL;
SQL;
return $this->executeQuery($sql);
}
public function down(){
return true;
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace Classes\Migration;
class v20200411_270009_email_log extends AbstractMigration {
public function up(){
$sql = <<<'SQL'
create table `EmailLog` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`subject` varchar(300) NOT NULL,
`toEmail` varchar(300) NOT NULL,
`body` text NULL,
`cclist` varchar(500) NULL,
`bcclist` varchar(500) NULL,
`created` DATETIME default NULL,
`updated` DATETIME default NULL,
`status` enum('Pending','Sent','Failed') default 'Pending',
primary key (`id`),
key `KEY_EmailLog_status` (`status`)
) engine=innodb default charset=utf8;
SQL;
return $this->executeQuery($sql);
}
public function down(){
return true;
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace Classes\Migration;
class v20200429_270010_setting_groups extends AbstractMigration {
public function up(){
$sql = <<<'SQL'
Alter table Settings add column category varchar(15) NOT NULL;
SQL;
$this->executeQuery($sql);
$sql = <<<'SQL'
Update Settings set category = TRIM(SUBSTR(name, 1, LOCATE(':', name) - 1));
SQL;
return $this->executeQuery($sql);
}
public function down(){
return true;
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace Classes\Migration;
use Model\Setting;
class v20200430_270008_partial_leave_setting extends AbstractMigration
{
public function up()
{
$setting = new Setting();
$setting->Load('name = ?', array('Leave: Limit Allowed Partial Leave Days'));
if (empty($setting->id)) {
$setting->name = 'Leave: Limit Allowed Partial Leave Days';
$setting->value = '';
$setting->description = 'Allow only a selected set of partial leave days (if empty we allow all partial leave day types)';
$setting->meta = '["value", {"label":"Value","type":"select2multi","source": [["Full Day","Full Day"], ["Half Day - Morning","Half Day - Morning"], ["Half Day - Afternoon","Half Day - Afternoon"], ["1 Hour - Morning","1 Hour - Morning"], ["2 Hours - Morning","2 Hours - Morning"],[ "3 Hours - Morning","3 Hours - Morning"],[ "1 Hour - Afternoon","1 Hour - Afternoon"],[ "2 Hours - Afternoon","2 Hours - Afternoon"],[ "3 Hours - Afternoon","3 Hours - Afternoon"]]}]';
$setting->category = 'Leave';
$setting->Save();
}
return true;
}
public function down()
{
return true;
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace Classes\Migration;
class v20200518_270011_add_al_language extends AbstractMigration{
public function up(){
$sql = <<<'SQL'
REPLACE INTO `SupportedLanguages` (`name`, `description`) VALUES ('al', 'Albanian');
SQL;
return $this->executeQuery($sql);
}
public function down(){
return true;
}
}