Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
Clubphp
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Clubphp
Commits
c23742ac
Commit
c23742ac
authored
Apr 12, 2026
by
Mahmoud Aglan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixhr3
parent
ba5df702
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
219 additions
and
5 deletions
+219
-5
Phase_31_001_alter_hr_tables_fix_columns.php
...e/migrations/Phase_31_001_alter_hr_tables_fix_columns.php
+5
-5
Phase_32_001_fix_hr_check_constraints_and_missing_columns.php
...e_32_001_fix_hr_check_constraints_and_missing_columns.php
+214
-0
No files found.
database/migrations/Phase_31_001_alter_hr_tables_fix_columns.php
View file @
c23742ac
...
...
@@ -80,7 +80,7 @@ return function (Database $db): void {
if
(
$hasColumn
(
'hr_salary_components'
,
'component_type'
)
&&
!
$hasColumn
(
'hr_salary_components'
,
'type'
))
{
// Must drop CHECK constraint before renaming column (MySQL 3959)
if
(
$hasCheck
(
'hr_salary_components'
,
'chk_hr_salary_comp_type'
))
{
$safeAlter
(
"ALTER TABLE `hr_salary_components` DROP C
ONSTRAINT
`chk_hr_salary_comp_type`"
);
$safeAlter
(
"ALTER TABLE `hr_salary_components` DROP C
HECK
`chk_hr_salary_comp_type`"
);
}
$safeAlter
(
"ALTER TABLE `hr_salary_components` CHANGE COLUMN `component_type` `type` VARCHAR(20) NOT NULL DEFAULT 'earning'"
);
$safeAlter
(
"ALTER TABLE `hr_salary_components` ADD CONSTRAINT `chk_hr_salary_comp_type` CHECK (`type` IN ('earning', 'deduction'))"
);
...
...
@@ -215,7 +215,7 @@ return function (Database $db): void {
if
(
$hasColumn
(
'hr_holidays'
,
'religion_specific'
)
&&
!
$hasColumn
(
'hr_holidays'
,
'religion'
))
{
// Must drop CHECK constraint before renaming column (MySQL 3959)
if
(
$hasCheck
(
'hr_holidays'
,
'chk_hr_holidays_religion'
))
{
$safeAlter
(
"ALTER TABLE `hr_holidays` DROP C
ONSTRAINT
`chk_hr_holidays_religion`"
);
$safeAlter
(
"ALTER TABLE `hr_holidays` DROP C
HECK
`chk_hr_holidays_religion`"
);
}
$safeAlter
(
"ALTER TABLE `hr_holidays` CHANGE COLUMN `religion_specific` `religion` VARCHAR(20) NULL DEFAULT NULL"
);
echo
" ✔ hr_holidays: religion_specific → religion
\n
"
;
...
...
@@ -277,7 +277,7 @@ return function (Database $db): void {
if
(
$hasColumn
(
'hr_payroll_components_log'
,
'component_type'
)
&&
!
$hasColumn
(
'hr_payroll_components_log'
,
'type'
))
{
// Must drop CHECK constraint before renaming column (MySQL 3959)
if
(
$hasCheck
(
'hr_payroll_components_log'
,
'chk_hr_payroll_comp_type'
))
{
$safeAlter
(
"ALTER TABLE `hr_payroll_components_log` DROP C
ONSTRAINT
`chk_hr_payroll_comp_type`"
);
$safeAlter
(
"ALTER TABLE `hr_payroll_components_log` DROP C
HECK
`chk_hr_payroll_comp_type`"
);
}
$safeAlter
(
"ALTER TABLE `hr_payroll_components_log` CHANGE COLUMN `component_type` `type` VARCHAR(20) NOT NULL"
);
$safeAlter
(
"ALTER TABLE `hr_payroll_components_log` ADD CONSTRAINT `chk_hr_payroll_comp_type` CHECK (`type` IN ('earning', 'deduction'))"
);
...
...
@@ -424,7 +424,7 @@ return function (Database $db): void {
$safeAlter
(
"ALTER TABLE `hr_attendance` ADD COLUMN `is_archived` TINYINT(1) NOT NULL DEFAULT 0, ADD COLUMN `archived_at` TIMESTAMP NULL DEFAULT NULL, ADD COLUMN `archived_by` BIGINT UNSIGNED NULL"
);
}
// Update CHECK constraint to include 'late' and 'rest_day' statuses
$safeAlter
(
"ALTER TABLE `hr_attendance` DROP C
ONSTRAINT
`chk_hr_attendance_status`"
);
$safeAlter
(
"ALTER TABLE `hr_attendance` DROP C
HECK
`chk_hr_attendance_status`"
);
$safeAlter
(
"ALTER TABLE `hr_attendance` ADD CONSTRAINT `chk_hr_attendance_status` CHECK (`status` IN ('present', 'absent', 'late', 'leave', 'holiday', 'rest_day', 'half_day'))"
);
// ─── 15. hr_leave_balances: employee_id → employee_profile_id ───
...
...
@@ -476,7 +476,7 @@ return function (Database $db): void {
if
(
$hasColumn
(
'hr_employee_loans'
,
'amount'
)
&&
!
$hasColumn
(
'hr_employee_loans'
,
'loan_amount'
))
{
// Must drop CHECK constraint before renaming column (MySQL 3959)
if
(
$hasCheck
(
'hr_employee_loans'
,
'chk_hr_loans_amount'
))
{
$safeAlter
(
"ALTER TABLE `hr_employee_loans` DROP C
ONSTRAINT
`chk_hr_loans_amount`"
);
$safeAlter
(
"ALTER TABLE `hr_employee_loans` DROP C
HECK
`chk_hr_loans_amount`"
);
}
$safeAlter
(
"ALTER TABLE `hr_employee_loans` CHANGE COLUMN `amount` `loan_amount` DECIMAL(15,2) NOT NULL"
);
$safeAlter
(
"ALTER TABLE `hr_employee_loans` ADD CONSTRAINT `chk_hr_loans_amount` CHECK (`loan_amount` > 0)"
);
...
...
database/migrations/Phase_32_001_fix_hr_check_constraints_and_missing_columns.php
0 → 100644
View file @
c23742ac
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment