horilla-opensource / horilla

Horilla is a free and open source HR software.
https://www.horilla.com/
GNU Lesser General Public License v2.1
213 stars 145 forks source link

Error when applying migration new__pms_historicalemployeeobjective.history_relation_id #297

Closed sergej-wv closed 1 month ago

sergej-wv commented 2 months ago

Bug Report

Description

Hello,

applying migrations fails because a valid value cannot be provided.

Steps to Reproduce

  1. Start at git commit 7ee91eab27acb1b18683ec8a0e7bda168c522995
    $ git rev-parse HEAD
    7ee91eab27acb1b18683ec8a0e7bda168c522995
  2. force forward to master
    $ git fetch --all
    $ git reset --hard origin/master
    HEAD is now at 9c7982f1 [RMV] TEMPLATES: Remove unwanted js function
  3. restore database and settings.py from copy
  4. enter python venv
  5. install requirements pip install -r requirements.txt
  6. run makemigration
$ python manage.py makemigrations
Was exitreason.attacments renamed to exitreason.attachments (a ManyToManyField)? [y/N] y
It is impossible to add a non-nullable field 'history_relation' to historicalemployeeobjective without specifying a default. This is because the database needs something to populate existing rows.
Please select a fix:
 1) Provide a one-off default now (will be set on all existing rows with a null value for this column)
 2) Quit and manually define a default value in models.py.
Select an option: 1
Please enter the default value as valid Python.
The datetime and django.utils.timezone modules are available, so it is possible to provide e.g. timezone.now as a value.
Type 'exit' to exit this prompt
>>> [TRUNCATED]
print(timezone.now())
Migrations for 'employee':
  employee/migrations/0010_alter_disciplinaryaction_options_and_more.py
    - Change Meta options on disciplinaryaction
    - Remove field title from employeenote
    - Add field block_option to actiontype
    - Add field created_at to actiontype
    - Add field created_by to actiontype
    - Add field is_active to actiontype
    - Add field modified_by to actiontype
    - Add field created_at to bonuspoint
    - Add field created_by to bonuspoint
    - Add field is_active to bonuspoint
    - Add field modified_by to bonuspoint
    - Add field created_at to disciplinaryaction
    - Add field created_by to disciplinaryaction
    - Add field is_active to disciplinaryaction
    - Add field modified_by to disciplinaryaction
    - Add field created_at to employeebankdetails
    - Add field created_by to employeebankdetails
    - Add field is_active to employeebankdetails
    - Add field modified_by to employeebankdetails
    - Add field created_at to employeegeneralsetting
    - Add field created_by to employeegeneralsetting
    - Add field is_active to employeegeneralsetting
    - Add field modified_by to employeegeneralsetting
    - Add field created_by to employeenote
    - Add field is_active to employeenote
    - Add field modified_by to employeenote
    - Add field created_at to employeetag
    - Add field created_by to employeetag
    - Add field is_active to employeetag
    - Add field modified_by to employeetag
    - Add field created_at to historicalbonuspoint
    - Add field created_by to historicalbonuspoint
    - Add field is_active to historicalbonuspoint
    - Add field modified_by to historicalbonuspoint
    - Add field created_at to policy
    - Add field created_by to policy
    - Add field is_active to policy
    - Add field modified_by to policy
    - Add field created_at to policymultiplefile
    - Add field created_by to policymultiplefile
    - Add field is_active to policymultiplefile
    - Add field modified_by to policymultiplefile
    - Alter field days on disciplinaryaction
    - Alter field description on employeenote
    - Alter field body on policy
    - Alter unique_together for employee (1 constraint(s))
    - Create model NoteFiles
    - Add field note_files to employeenote
Migrations for 'helpdesk':
  helpdesk/migrations/0004_attachment_created_at_attachment_created_by_and_more.py
    - Add field created_at to attachment
    - Add field created_by to attachment
    - Add field is_active to attachment
    - Add field modified_by to attachment
    - Add field created_at to comment
    - Add field created_by to comment
    - Add field is_active to comment
    - Add field modified_by to comment
    - Add field created_at to departmentmanager
    - Add field created_by to departmentmanager
    - Add field is_active to departmentmanager
    - Add field modified_by to departmentmanager
    - Add field created_at to faq
    - Add field created_by to faq
    - Add field modified_by to faq
    - Add field created_at to faqcategory
    - Add field created_by to faqcategory
    - Add field is_active to faqcategory
    - Add field modified_by to faqcategory
    - Add field created_at to historicalticket
    - Add field created_by to historicalticket
    - Add field modified_by to historicalticket
    - Add field created_at to ticket
    - Add field created_by to ticket
    - Add field modified_by to ticket
    - Add field created_at to tickettype
    - Add field created_by to tickettype
    - Add field modified_by to tickettype
    - Alter field comment on comment
    - Alter field is_active on faq
    - Alter field is_active on historicalticket
    - Alter field is_active on ticket
    - Alter field is_active on tickettype
Migrations for 'horilla_audit':
  horilla_audit/migrations/0004_accountblockunblock_created_at_and_more.py
    - Add field created_at to accountblockunblock
    - Add field created_by to accountblockunblock
    - Add field is_active to accountblockunblock
    - Add field modified_by to accountblockunblock
    - Add field created_at to historytrackingfields
    - Add field created_by to historytrackingfields
    - Add field is_active to historytrackingfields
    - Add field modified_by to historytrackingfields
    - Add field work_info_track to historytrackingfields
Migrations for 'horilla_documents':
  horilla_documents/migrations/0004_document_created_at_document_created_by_and_more.py
    - Add field created_at to document
    - Add field created_by to document
    - Add field modified_by to document
    - Add field created_at to documentrequest
    - Add field created_by to documentrequest
    - Add field modified_by to documentrequest
    - Alter field is_active on document
    - Alter field title on document
    - Alter field is_active on documentrequest
Migrations for 'horilla_views':
  horilla_views/migrations/0001_initial.py
    - Create model ToggleColumn
    - Create model SavedFilter
    - Create model ActiveView
    - Create model ActiveTab
    - Create model ActiveGroup
Migrations for 'offboarding':
  offboarding/migrations/0004_rename_attacments_exitreason_attachments_and_more.py
    - Rename field attacments on exitreason to attachments
    - Add field created_by to employeetask
    - Add field is_active to employeetask
    - Add field modified_by to employeetask
    - Add field created_at to exitreason
    - Add field created_by to exitreason
    - Add field is_active to exitreason
    - Add field modified_by to exitreason
    - Add field created_by to historicalemployeetask
    - Add field is_active to historicalemployeetask
    - Add field modified_by to historicalemployeetask
    - Add field created_by to offboarding
    - Add field modified_by to offboarding
    - Add field created_by to offboardingemployee
    - Add field is_active to offboardingemployee
    - Add field modified_by to offboardingemployee
    - Add field created_at to offboardinggeneralsetting
    - Add field created_by to offboardinggeneralsetting
    - Add field is_active to offboardinggeneralsetting
    - Add field modified_by to offboardinggeneralsetting
    - Add field created_by to offboardingnote
    - Add field is_active to offboardingnote
    - Add field modified_by to offboardingnote
    - Add field created_by to offboardingstage
    - Add field is_active to offboardingstage
    - Add field modified_by to offboardingstage
    - Add field created_by to offboardingstagemultiplefile
    - Add field is_active to offboardingstagemultiplefile
    - Add field modified_by to offboardingstagemultiplefile
    - Add field created_by to offboardingtask
    - Add field is_active to offboardingtask
    - Add field modified_by to offboardingtask
    - Add field created_by to resignationletter
    - Add field modified_by to resignationletter
    - Alter field created_at on employeetask
    - Alter field status on employeetask
    - Alter field created_at on historicalemployeetask
    - Alter field status on historicalemployeetask
    - Alter field created_at on offboarding
    - Alter field is_active on offboarding
    - Alter field created_at on offboardingemployee
    - Alter field resignation_request on offboardinggeneralsetting
    - Alter field created_at on offboardingnote
    - Alter field created_at on offboardingstage
    - Alter field created_at on offboardingstagemultiplefile
    - Alter field created_at on offboardingtask
    - Alter field created_at on resignationletter
    - Alter field is_active on resignationletter
    - Alter field title on resignationletter
Migrations for 'onboarding':
  onboarding/migrations/0007_candidatestage_created_at_candidatestage_created_by_and_more.py
    - Add field created_at to candidatestage
    - Add field created_by to candidatestage
    - Add field is_active to candidatestage
    - Add field modified_by to candidatestage
    - Add field created_at to candidatetask
    - Add field created_by to candidatetask
    - Add field is_active to candidatetask
    - Add field modified_by to candidatetask
    - Add field created_at to historicalcandidatetask
    - Add field created_by to historicalcandidatetask
    - Add field is_active to historicalcandidatetask
    - Add field modified_by to historicalcandidatetask
    - Add field created_at to onboardingportal
    - Add field created_by to onboardingportal
    - Add field is_active to onboardingportal
    - Add field modified_by to onboardingportal
    - Add field profile to onboardingportal
    - Add field created_at to onboardingstage
    - Add field created_by to onboardingstage
    - Add field is_active to onboardingstage
    - Add field modified_by to onboardingstage
    - Add field created_at to onboardingtask
    - Add field created_by to onboardingtask
    - Add field is_active to onboardingtask
    - Add field modified_by to onboardingtask
    - Alter field employee_id on onboardingtask
Migrations for 'asset':
  asset/migrations/0009_alter_assetassignment_options_and_more.py
    - Change Meta options on assetassignment
    - Change Meta options on assetrequest
    - Add field created_at to asset
    - Add field created_by to asset
    - Add field is_active to asset
    - Add field modified_by to asset
    - Add field created_at to assetassignment
    - Add field created_by to assetassignment
    - Add field is_active to assetassignment
    - Add field modified_by to assetassignment
    - Add field created_at to assetcategory
    - Add field created_by to assetcategory
    - Add field is_active to assetcategory
    - Add field modified_by to assetcategory
    - Add field created_at to assetdocuments
    - Add field created_by to assetdocuments
    - Add field is_active to assetdocuments
    - Add field modified_by to assetdocuments
    - Add field created_at to assetlot
    - Add field created_by to assetlot
    - Add field is_active to assetlot
    - Add field modified_by to assetlot
    - Add field created_at to assetreport
    - Add field created_by to assetreport
    - Add field is_active to assetreport
    - Add field modified_by to assetreport
    - Add field created_at to assetrequest
    - Add field created_by to assetrequest
    - Add field is_active to assetrequest
    - Add field modified_by to assetrequest
    - Add field created_at to returnimages
    - Add field created_by to returnimages
    - Add field is_active to returnimages
    - Add field modified_by to returnimages
    - Alter field assigned_to_employee_id on assetassignment
    - Alter field asset_category_id on assetrequest
Migrations for 'attendance':
  attendance/migrations/0015_overrideattendances_attendance_created_by_and_more.py
    - Create model OverrideAttendances
    - Add field created_by to attendance
    - Add field is_active to attendance
    - Add field is_bulk_request to attendance
    - Add field is_holiday to attendance
    - Add field modified_by to attendance
    - Add field created_at to attendanceactivity
    - Add field created_by to attendanceactivity
    - Add field is_active to attendanceactivity
    - Add field modified_by to attendanceactivity
    - Add field created_at to attendancegeneralsetting
    - Add field created_by to attendancegeneralsetting
    - Add field is_active to attendancegeneralsetting
    - Add field modified_by to attendancegeneralsetting
    - Add field created_by to attendancelatecomeearlyout
    - Add field is_active to attendancelatecomeearlyout
    - Add field modified_by to attendancelatecomeearlyout
    - Add field created_at to attendanceovertime
    - Add field created_by to attendanceovertime
    - Add field is_active to attendanceovertime
    - Add field modified_by to attendanceovertime
    - Add field created_by to attendancerequestcomment
    - Add field is_active to attendancerequestcomment
    - Add field modified_by to attendancerequestcomment
    - Add field created_at to attendancerequestfile
    - Add field created_by to attendancerequestfile
    - Add field is_active to attendancerequestfile
    - Add field modified_by to attendancerequestfile
    - Add field created_at to attendancevalidationcondition
    - Add field created_by to attendancevalidationcondition
    - Add field is_active to attendancevalidationcondition
    - Add field modified_by to attendancevalidationcondition
    - Add field allowed_clock_in to gracetime
    - Add field allowed_clock_out to gracetime
    - Add field created_at to gracetime
    - Add field created_by to gracetime
    - Add field modified_by to gracetime
    - Add field created_by to historicalattendance
    - Add field is_active to historicalattendance
    - Add field is_bulk_request to historicalattendance
    - Add field is_holiday to historicalattendance
    - Add field modified_by to historicalattendance
    - Add field created_by to penaltyaccount
    - Add field is_active to penaltyaccount
    - Add field modified_by to penaltyaccount
    - Alter field created_at on attendance
    - Alter field allowed_time on gracetime
    - Alter field is_active on gracetime
    - Alter field created_at on historicalattendance
    - Alter field created_at on penaltyaccount
    - Create model WorkRecords
Migrations for 'base':
  base/migrations/0014_attendanceallowedip_and_more.py
    - Create model AttendanceAllowedIP
    - Change Meta options on employeeshiftschedule
    - Remove field created_on from announcement
    - Add field created_at to announcement
    - Add field created_by to announcement
    - Add field is_active to announcement
    - Add field modified_by to announcement
    - Add field created_by to announcementcomment
    - Add field is_active to announcementcomment
    - Add field modified_by to announcementcomment
    - Add field created_at to company
    - Add field created_by to company
    - Add field is_active to company
    - Add field modified_by to company
    - Add field created_at to department
    - Add field created_by to department
    - Add field is_active to department
    - Add field modified_by to department
    - Add field created_at to dynamicemailconfiguration
    - Add field created_by to dynamicemailconfiguration
    - Add field display_name to dynamicemailconfiguration
    - Add field is_active to dynamicemailconfiguration
    - Add field is_primary to dynamicemailconfiguration
    - Add field modified_by to dynamicemailconfiguration
    - Add field created_at to employeeshift
    - Add field created_by to employeeshift
    - Add field is_active to employeeshift
    - Add field modified_by to employeeshift
    - Add field auto_punch_out_time to employeeshiftschedule
    - Add field created_at to employeeshiftschedule
    - Add field created_by to employeeshiftschedule
    - Add field is_active to employeeshiftschedule
    - Add field is_auto_punch_out_enabled to employeeshiftschedule
    - Add field modified_by to employeeshiftschedule
    - Add field created_at to employeetype
    - Add field created_by to employeetype
    - Add field is_active to employeetype
    - Add field modified_by to employeetype
    - Add field additional_data to historicalrotatingshiftassign
    - Add field created_by to historicalrotatingshiftassign
    - Add field modified_by to historicalrotatingshiftassign
    - Add field additional_data to historicalrotatingworktypeassign
    - Add field created_by to historicalrotatingworktypeassign
    - Add field modified_by to historicalrotatingworktypeassign
    - Add field created_by to historicalshiftrequest
    - Add field modified_by to historicalshiftrequest
    - Add field created_by to historicalworktyperequest
    - Add field modified_by to historicalworktyperequest
    - Add field created_at to jobposition
    - Add field created_by to jobposition
    - Add field is_active to jobposition
    - Add field modified_by to jobposition
    - Add field created_at to jobrole
    - Add field created_by to jobrole
    - Add field is_active to jobrole
    - Add field modified_by to jobrole
    - Add field created_at to multipleapprovalcondition
    - Add field created_by to multipleapprovalcondition
    - Add field is_active to multipleapprovalcondition
    - Add field modified_by to multipleapprovalcondition
    - Add field additional_data to rotatingshift
    - Add field created_at to rotatingshift
    - Add field created_by to rotatingshift
    - Add field is_active to rotatingshift
    - Add field modified_by to rotatingshift
    - Add field additional_data to rotatingshiftassign
    - Add field created_by to rotatingshiftassign
    - Add field modified_by to rotatingshiftassign
    - Add field additional_data to rotatingworktype
    - Add field created_at to rotatingworktype
    - Add field created_by to rotatingworktype
    - Add field is_active to rotatingworktype
    - Add field modified_by to rotatingworktype
    - Add field additional_data to rotatingworktypeassign
    - Add field created_by to rotatingworktypeassign
    - Add field modified_by to rotatingworktypeassign
    - Add field created_by to shiftrequest
    - Add field modified_by to shiftrequest
    - Add field created_by to shiftrequestcomment
    - Add field is_active to shiftrequestcomment
    - Add field modified_by to shiftrequestcomment
    - Add field created_at to tags
    - Add field created_by to tags
    - Add field modified_by to tags
    - Add field created_at to worktype
    - Add field created_by to worktype
    - Add field is_active to worktype
    - Add field modified_by to worktype
    - Add field created_by to worktyperequest
    - Add field modified_by to worktyperequest
    - Add field created_by to worktyperequestcomment
    - Add field is_active to worktyperequestcomment
    - Add field modified_by to worktyperequestcomment
    - Alter field description on announcement
    - Alter field title on announcement
    - Alter field from_email on dynamicemailconfiguration
    - Alter field host on dynamicemailconfiguration
    - Alter field password on dynamicemailconfiguration
    - Alter field port on dynamicemailconfiguration
    - Alter field timeout on dynamicemailconfiguration
    - Alter field username on dynamicemailconfiguration
    - Alter field day on employeeshiftschedule
    - Alter field end_time on employeeshiftschedule
    - Alter field is_night_shift on employeeshiftschedule
    - Alter field minimum_working_hour on employeeshiftschedule
    - Alter field start_time on employeeshiftschedule
    - Alter field created_at on historicalrotatingshiftassign
    - Alter field is_active on historicalrotatingshiftassign
    - Alter field created_at on historicalrotatingworktypeassign
    - Alter field is_active on historicalrotatingworktypeassign
    - Alter field created_at on historicalshiftrequest
    - Alter field is_active on historicalshiftrequest
    - Alter field is_permanent_shift on historicalshiftrequest
    - Alter field created_at on historicalworktyperequest
    - Alter field is_active on historicalworktyperequest
    - Alter field is_permanent_work_type on historicalworktyperequest
    - Alter field job_position on jobposition
    - Alter field created_at on rotatingshiftassign
    - Alter field is_active on rotatingshiftassign
    - Alter field created_at on rotatingworktypeassign
    - Alter field is_active on rotatingworktypeassign
    - Alter field created_at on shiftrequest
    - Alter field is_active on shiftrequest
    - Alter field is_permanent_shift on shiftrequest
    - Alter field is_active on tags
    - Alter field created_at on worktyperequest
    - Alter field is_active on worktyperequest
    - Alter field is_permanent_work_type on worktyperequest
    - Create model TrackLateComeEarlyOut
    - Create model PenaltyAccounts
    - Create model HorillaMailTemplate
    - Create model Holidays
    - Create model DriverViewed
    - Create model DashboardEmployeeCharts
    - Create model BiometricAttendance
    - Create model CompanyLeaves
Migrations for 'biometric':
  biometric/migrations/0001_initial.py
    - Create model BiometricDevices
    - Create model COSECAttendanceArguments
    - Create model BiometricEmployees
Migrations for 'horilla_automations':
  horilla_automations/migrations/0001_initial.py
    - Create model MailAutomation
Migrations for 'leave':
  leave/migrations/0010_compensatoryleaverequest_overrideleaverequests_and_more.py
    - Create model CompensatoryLeaveRequest
    - Create model OverrideLeaveRequests
    - Change Meta options on leaveallocationrequest
    - Change Meta options on leaverequest
    - Add field created_at to availableleave
    - Add field created_by to availableleave
    - Add field is_active to availableleave
    - Add field modified_by to availableleave
    - Add field created_at to companyleave
    - Add field created_by to companyleave
    - Add field is_active to companyleave
    - Add field modified_by to companyleave
    - Add field created_at to historicalavailableleave
    - Add field created_by to historicalavailableleave
    - Add field is_active to historicalavailableleave
    - Add field modified_by to historicalavailableleave
    - Add field is_active to historicalleaveallocationrequest
    - Add field modified_by to historicalleaveallocationrequest
    - Add field is_active to historicalleaverequest
    - Add field leave_clashes_count to historicalleaverequest
    - Add field modified_by to historicalleaverequest
    - Add field created_at to holiday
    - Add field created_by to holiday
    - Add field is_active to holiday
    - Add field modified_by to holiday
    - Add field is_active to leaveallocationrequest
    - Add field modified_by to leaveallocationrequest
    - Add field created_by to leaveallocationrequestcomment
    - Add field is_active to leaveallocationrequestcomment
    - Add field modified_by to leaveallocationrequestcomment
    - Add field is_active to leaverequest
    - Add field leave_clashes_count to leaverequest
    - Add field modified_by to leaverequest
    - Add field created_by to leaverequestcomment
    - Add field is_active to leaverequestcomment
    - Add field modified_by to leaverequestcomment
    - Add field created_at to leavetype
    - Add field created_by to leavetype
    - Add field is_active to leavetype
    - Add field is_compensatory_leave to leavetype
    - Add field is_encashable to leavetype
    - Add field modified_by to leavetype
    - Alter field created_at on historicalleaveallocationrequest
    - Alter field created_by on historicalleaveallocationrequest
    - Alter field created_at on historicalleaverequest
    - Alter field created_at on leaveallocationrequest
    - Alter field created_by on leaveallocationrequest
    - Alter field created_at on leaverequest
    - Create model RestrictLeave
    - Create model LeaveGeneralSetting
    - Create model HistoricalCompensatoryLeaveRequest
    - Create model EmployeePastLeaveRestrict
    - Create model CompensatoryLeaverequestComment
    - Add field leave_type_id to compensatoryleaverequest
    - Add field modified_by to compensatoryleaverequest
Migrations for 'payroll':
  payroll/migrations/0009_reimbursementfile_alter_reimbursement_options_and_more.py
    - Create model ReimbursementFile
    - Change Meta options on reimbursement
    - Remove field notice_period_in_month from contract
    - Remove field notice_period_in_month from historicalcontract
    - Add field created_at to allowance
    - Add field created_by to allowance
    - Add field end_range to allowance
    - Add field is_active to allowance
    - Add field modified_by to allowance
    - Add field per_children_fixed_amount to allowance
    - Add field start_range to allowance
    - Add field created_by to contract
    - Add field modified_by to contract
    - Add field notice_period_in_days to contract
    - Add field created_by to deduction
    - Add field end_range to deduction
    - Add field is_active to deduction
    - Add field modified_by to deduction
    - Add field start_range to deduction
    - Add field created_at to filingstatus
    - Add field created_by to filingstatus
    - Add field is_active to filingstatus
    - Add field modified_by to filingstatus
    - Add field python_code to filingstatus
    - Add field use_py to filingstatus
    - Add field created_by to historicalcontract
    - Add field modified_by to historicalcontract
    - Add field notice_period_in_days to historicalcontract
    - Add field created_by to historicalpayslip
    - Add field is_active to historicalpayslip
    - Add field modified_by to historicalpayslip
    - Add field created_at to loanaccount
    - Add field created_by to loanaccount
    - Add field installment_amount to loanaccount
    - Add field is_active to loanaccount
    - Add field modified_by to loanaccount
    - Add field settled_date to loanaccount
    - Add field created_at to payrollsettings
    - Add field created_by to payrollsettings
    - Add field is_active to payrollsettings
    - Add field modified_by to payrollsettings
    - Add field created_by to payslip
    - Add field is_active to payslip
    - Add field modified_by to payslip
    - Add field created_by to reimbursement
    - Add field modified_by to reimbursement
    - Add field created_by to reimbursementrequestcomment
    - Add field is_active to reimbursementrequestcomment
    - Add field modified_by to reimbursementrequestcomment
    - Add field created_at to taxbracket
    - Add field created_by to taxbracket
    - Add field is_active to taxbracket
    - Add field modified_by to taxbracket
    - Alter field based_on on allowance
    - Alter field if_condition on allowance
    - Alter field contract_end_date on contract
    - Alter field contract_start_date on contract
    - Alter field created_at on contract
    - Alter field is_active on contract
    - Alter field wage_type on contract
    - Alter field created_at on deduction
    - Alter field if_condition on deduction
    - Alter field contract_end_date on historicalcontract
    - Alter field contract_start_date on historicalcontract
    - Alter field created_at on historicalcontract
    - Alter field is_active on historicalcontract
    - Alter field wage_type on historicalcontract
    - Alter field created_at on historicalpayslip
    - Alter field reference on historicalpayslip
    - Alter field apply_on on loanaccount
    - Alter field asset_id on loanaccount
    - Alter field notice_period on payrollgeneralsetting
    - Alter field created_at on payslip
    - Alter field reference on payslip
    - Alter field created_at on reimbursement
    - Alter field is_active on reimbursement
    - Alter field leave_type_id on reimbursement
    - Alter field type on reimbursement
    - Alter field at_work on workrecord
    - Alter field min_hour on workrecord
    - Create model PayslipAutoGenerate
    - Add field files to reimbursementrequestcomment
Migrations for 'pms':
  pms/migrations/0008_keyresult_meetings_alter_feedback_options_and_more.py
    - Create model KeyResult
    - Create model Meetings
    - Change Meta options on feedback
    - Remove field employee_id from employeekeyresult
    - Remove field employee_id from historicalemployeekeyresult
    - Add field created_by to employeeobjective
    - Add field is_active to employeeobjective
    - Add field modified_by to employeeobjective
    - Add field progress_percentage to employeeobjective
    - Add field created_by to feedback
    - Add field cyclic_feedback to feedback
    - Add field cyclic_feedback_days_count to feedback
    - Add field cyclic_feedback_period to feedback
    - Add field cyclic_next_end_date to feedback
    - Add field cyclic_next_start_date to feedback
    - Add field is_active to feedback
    - Add field modified_by to feedback
    - Add field created_by to historicalemployeeobjective
    - Add field history_relation to historicalemployeeobjective
    - Add field is_active to historicalemployeeobjective
    - Add field modified_by to historicalemployeeobjective
    - Add field progress_percentage to historicalemployeeobjective
    - Add field created_at to period
    - Add field created_by to period
    - Add field is_active to period
    - Add field modified_by to period
    - Add field created_at to question
    - Add field created_by to question
    - Add field is_active to question
    - Add field modified_by to question
    - Add field created_at to questionoptions
    - Add field created_by to questionoptions
    - Add field is_active to questionoptions
    - Add field modified_by to questionoptions
    - Add field created_at to questiontemplate
    - Add field created_by to questiontemplate
    - Add field is_active to questiontemplate
    - Add field modified_by to questiontemplate
    - Alter field employee_objective_id on employeekeyresult
    - Alter field key_result on employeekeyresult
    - Alter field key_result_description on employeekeyresult
    - Alter field progress_percentage on employeekeyresult
    - Alter field archive on employeeobjective
    - Alter field employee_id on employeeobjective
    - Alter field objective on employeeobjective
    - Alter field objective_description on employeeobjective
    - Alter field created_at on feedback
    - Alter field key_result on historicalemployeekeyresult
    - Alter field key_result_description on historicalemployeekeyresult
    - Alter field progress_percentage on historicalemployeekeyresult
    - Alter field archive on historicalemployeeobjective
    - Alter field employee_id on historicalemployeeobjective
    - Alter field objective on historicalemployeeobjective
    - Alter field objective_description on historicalemployeeobjective
    - Alter field question_template on questiontemplate
    - Create model Objective
    - Create model MeetingsAnswer
    - Add field question_template to meetings
    - Create model HistoricalObjective
    - Create model HistoricalKeyResult
    - Add field key_result_id to employeekeyresult
    - Add field key_result_id to employeeobjective
    - Add field objective_id to employeeobjective
    - Add field key_result_id to historicalemployeekeyresult
    - Add field objective_id to historicalemployeeobjective
    - Alter unique_together for employeeobjective (1 constraint(s))
Migrations for 'recruitment':
  recruitment/migrations/0012_remove_skillzone_created_on_and_more.py
    - Remove field created_on from skillzone
    - Add field converted_employee_id to candidate
    - Add field created_at to candidate
    - Add field created_by to candidate
    - Add field modified_by to candidate
    - Add field created_at to candidaterating
    - Add field created_by to candidaterating
    - Add field is_active to candidaterating
    - Add field modified_by to candidaterating
    - Add field converted_employee_id to historicalcandidate
    - Add field created_at to historicalcandidate
    - Add field created_by to historicalcandidate
    - Add field modified_by to historicalcandidate
    - Add field created_at to historicalrejectedcandidate
    - Add field created_by to historicalrejectedcandidate
    - Add field is_active to historicalrejectedcandidate
    - Add field modified_by to historicalrejectedcandidate
    - Add field created_at to questionordering
    - Add field created_by to questionordering
    - Add field is_active to questionordering
    - Add field modified_by to questionordering
    - Add field created_at to recruitment
    - Add field created_by to recruitment
    - Add field modified_by to recruitment
    - Add field survey_templates to recruitment
    - Add field created_at to recruitmentgeneralsetting
    - Add field created_by to recruitmentgeneralsetting
    - Add field is_active to recruitmentgeneralsetting
    - Add field modified_by to recruitmentgeneralsetting
    - Add field created_at to recruitmentmailtemplate
    - Add field created_by to recruitmentmailtemplate
    - Add field is_active to recruitmentmailtemplate
    - Add field modified_by to recruitmentmailtemplate
    - Add field created_at to recruitmentsurvey
    - Add field created_by to recruitmentsurvey
    - Add field is_active to recruitmentsurvey
    - Add field modified_by to recruitmentsurvey
    - Add field created_at to recruitmentsurveyanswer
    - Add field created_by to recruitmentsurveyanswer
    - Add field is_active to recruitmentsurveyanswer
    - Add field modified_by to recruitmentsurveyanswer
    - Add field created_at to rejectedcandidate
    - Add field created_by to rejectedcandidate
    - Add field is_active to rejectedcandidate
    - Add field modified_by to rejectedcandidate
    - Add field created_at to rejectreason
    - Add field created_by to rejectreason
    - Add field is_active to rejectreason
    - Add field modified_by to rejectreason
    - Add field company_id to skillzone
    - Add field created_at to skillzone
    - Add field created_by to skillzone
    - Add field modified_by to skillzone
    - Add field created_at to skillzonecandidate
    - Add field created_by to skillzonecandidate
    - Add field modified_by to skillzonecandidate
    - Add field created_at to stage
    - Add field created_by to stage
    - Add field modified_by to stage
    - Add field created_at to stagefiles
    - Add field created_by to stagefiles
    - Add field is_active to stagefiles
    - Add field modified_by to stagefiles
    - Add field created_by to stagenote
    - Add field is_active to stagenote
    - Add field modified_by to stagenote
    - Add field created_at to surveytemplate
    - Add field created_by to surveytemplate
    - Add field is_active to surveytemplate
    - Add field modified_by to surveytemplate
    - Alter field profile on candidate
    - Alter field company_id on rejectreason
    - Alter field is_active on stage
    - Alter field created_at on stagenote
    - Create model Skill
    - Create model Resume
    - Create model InterviewSchedule
    - Add field skills to recruitment

  1. run migrations
$ python manage.py migrate
Operations to perform:
  Apply all migrations: admin, asset, attendance, auditlog, auth, base, biometric, contenttypes, django_apscheduler, employee, helpdesk, horilla_audit, horilla_automations, horilla_documents, horilla_views, leave, notifications, offboarding, onboarding, payroll, pms, recruitment, sessions
Running migrations:
  Applying employee.0010_alter_disciplinaryaction_options_and_more...Job 
[TRUNCATED]
 OK
  Applying asset.0009_alter_assetassignment_options_and_more... OK
  Applying attendance.0015_overrideattendances_attendance_created_by_and_more... OK
  Applying auditlog.0001_initial... OK
  Applying auditlog.0002_auto_support_long_primary_keys... OK
  Applying auditlog.0003_logentry_remote_addr... OK
  Applying auditlog.0004_logentry_detailed_object_repr... OK
  Applying auditlog.0005_logentry_additional_data_verbose_name... OK
  Applying auditlog.0006_object_pk_index... OK
  Applying auditlog.0007_object_pk_type... OK
  Applying auditlog.0008_action_index... OK
  Applying auditlog.0009_alter_logentry_additional_data... OK
  Applying auditlog.0010_alter_logentry_timestamp... OK
  Applying auditlog.0011_logentry_serialized_data... OK
  Applying auditlog.0012_add_logentry_action_access... OK
  Applying auditlog.0013_alter_logentry_timestamp... OK
  Applying auditlog.0014_logentry_cid... OK
  Applying auditlog.0015_alter_logentry_changes... OK
  Applying base.0014_attendanceallowedip_and_more... OK
  Applying biometric.0001_initial... OK
  Applying helpdesk.0004_attachment_created_at_attachment_created_by_and_more... OK
  Applying horilla_audit.0004_accountblockunblock_created_at_and_more... OK
  Applying horilla_automations.0001_initial... OK
  Applying horilla_documents.0004_document_created_at_document_created_by_and_more... OK
  Applying horilla_views.0001_initial... OK
  Applying leave.0010_compensatoryleaverequest_overrideleaverequests_and_more... OK
  Applying offboarding.0004_rename_attacments_exitreason_attachments_and_more... OK
  Applying onboarding.0007_candidatestage_created_at_candidatestage_created_by_and_more... OK
  Applying payroll.0009_reimbursementfile_alter_reimbursement_options_and_more... OK
  Applying pms.0008_keyresult_meetings_alter_feedback_options_and_more...Traceback (most recent call last):
  File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute
    return super().execute(query, params)
sqlite3.IntegrityError: NOT NULL constraint failed: new__pms_historicalemployeeobjective.history_relation_id

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/horilla/horilla/manage.py", line 22, in <module>
    main()
  File "/opt/horilla/horilla/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/base.py", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/base.py", line 458, in execute
    output = self.handle(*args, **options)
  File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/base.py", line 106, in wrapper
    res = handle_func(*args, **kwargs)
  File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/commands/migrate.py", line 356, in handle
    post_migrate_state = executor.migrate(
  File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/migrations/executor.py", line 135, in migrate
    state = self._migrate_all_forwards(
  File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/migrations/executor.py", line 167, in _migrate_all_forwards
    state = self.apply_migration(
  File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/migrations/executor.py", line 252, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/migrations/migration.py", line 132, in apply
    operation.database_forwards(
  File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/migrations/operations/fields.py", line 108, in database_forwards
    schema_editor.add_field(
  File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/sqlite3/schema.py", line 400, in add_field
    self._remake_table(model, create_field=field)
  File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/sqlite3/schema.py", line 336, in _remake_table
    self.execute(
  File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/base/schema.py", line 201, in execute
    cursor.execute(sql, params)
  File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/utils.py", line 102, in execute
    return super().execute(sql, params)
  File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(
  File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/utils.py", line 84, in _execute
    with self.db.wrap_database_errors:
  File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute
    return super().execute(query, params)
django.db.utils.IntegrityError: NOT NULL constraint failed: new__pms_historicalemployeeobjective.history_relation_id

Expected Behavior

Migrations are applied.

Actual Behavior

Applying database migrations fails.

Environment

Additional Information

[Any other relevant information, logs, error messages, or context that might help in understanding and fixing the issue.]

Possible Solution

The makemigration command asks for a value without specifying which format is expected. The commands "datatime.datetime", "timezone.now", "datetime.datetime.now()" and "print(datetime.datetime.now())". It was possible to set a valid value once but we cannot remember which one.

Priority

medium

horilla-opensource commented 2 months ago

Hi @sergej-wv , Which database are you using?

With Regards, Team Horilla

sergej-wv commented 2 months ago

Hello, the database is a sqlite one.

horilla-opensource commented 2 months ago

Hi @sergej-wv , Can you please share the contents of the last migrations file from the pms app?

sergej-wv commented 2 months ago

Hello, how do I find and identify this file ?

horilla-opensource commented 2 months ago

Hi @sergej-wv , You'll can find it inside pms/migrations/. The file name will be something similar to - _0008_keyresult_meetings_alter_feedback_options_andmore .

sergej-wv commented 2 months ago

Hello, this are the files inside the stated folder of the installation after pulling from git:

ls pms/migrations/

0001_initial.py
0002_alter_answer_feedback_id_and_more.py
0003_historicalcomment_history_description_and_more.py
0004_employeekeyresult_progress_percentage_and_more.py
0005_remove_period_company_id_and_more.py
0006_anonymousfeedback.py
0007_alter_anonymousfeedback_feedback_description_and_more.py
0008_keyresult_meetings_alter_feedback_options_and_more.py
horilla-opensource commented 2 months ago

Please share the contents of the last file (0008_keyresult_meetings_alter_feedback_options_and_more.py)

sergej-wv commented 2 months ago

The file was attached to this comment. 0008_keyresult_meetings_alter_feedback_options_and_more.py.txt

sergej-wv commented 2 months ago

Hello @horilla-opensource, I would like to ask for a hint which time format has to be used for the row.

horilla-opensource commented 1 month ago

Hi @sergej-wv ,

Apologize for the late reply.

Please use the Day, Month, Year format and try.

sergej-wv commented 1 month ago

Hello,

thank you for the answer but it seems to not work as expected. The current application was upgraded to the latest git state like described in my initial post. When the command "makemigrations" prompted for a value, the value "01,01,2000" was provided. I am not a python developer therefor I had to guess based on you answer. Could you please provide an example ? The python function "datetime.now" (typed in from my memory therefor highly likely incorrect) returns the value using this format: 2000-01-01. But the input was accepted. When running the command "migrate" this error is returned:

``` Applying pms.0008_bonuspointsetting_keyresult_meetings_and_more...Traceback (most recent call last): File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/models/fields/__init__.py", line 2053, in get_prep_value return int(value) ValueError: invalid literal for int() with base 10: '01,01,2000' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/opt/horilla/horilla/manage.py", line 22, in main() File "/opt/horilla/horilla/manage.py", line 18, in main execute_from_command_line(sys.argv) File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line utility.execute() File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/__init__.py", line 436, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/base.py", line 412, in run_from_argv self.execute(*args, **cmd_options) File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/base.py", line 458, in execute output = self.handle(*args, **options) File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/base.py", line 106, in wrapper res = handle_func(*args, **kwargs) File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/commands/migrate.py", line 356, in handle post_migrate_state = executor.migrate( File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/migrations/executor.py", line 135, in migrate state = self._migrate_all_forwards( File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/migrations/executor.py", line 167, in _migrate_all_forwards state = self.apply_migration( File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/migrations/executor.py", line 252, in apply_migration state = migration.apply(state, schema_editor) File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/migrations/migration.py", line 132, in apply operation.database_forwards( File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/migrations/operations/fields.py", line 108, in database_forwards schema_editor.add_field( File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/sqlite3/schema.py", line 400, in add_field self._remake_table(model, create_field=field) File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/sqlite3/schema.py", line 240, in _remake_table self.effective_default(create_field), File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/base/schema.py", line 429, in effective_default return field.get_db_prep_save(self._effective_default(field), self.connection) File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/models/fields/related.py", line 1129, in get_db_prep_save return self.target_field.get_db_prep_save(value, connection=connection) File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/models/fields/__init__.py", line 954, in get_db_prep_save return self.get_db_prep_value(value, connection=connection, prepared=False) File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/models/fields/__init__.py", line 2742, in get_db_prep_value value = self.get_prep_value(value) File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/models/fields/__init__.py", line 2055, in get_prep_value raise e.__class__( ValueError: Field 'id' expected a number but got '01,01,2000'. ```

I would also expect that the value of an id field is an integer, not a date time.

Best regards.

horilla-opensource commented 1 month ago

Hi @sergej-wv ,

Can we have a meeting to discuss this further? Since it'll be difficult to communicate from here, as it requires some live testing to pinpoint the solution.

If possible, please contact us at support@horilla.com (through mail or in skype).

With Regards, Team Horilla

sergej-wv commented 1 month ago

0008_bonuspointsetting_keyresult_meetings_and_more.py.txt

sergej-wv commented 1 month ago
``` Applying pms.0008_bonuspointsetting_keyresult_meetings_and_more...Traceback (most recent call last): File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/models/fields/__init__.py", line 2053, in get_prep_value return int(value) TypeError: int() argument must be a string, a bytes-like object or a real number, not 'datetime.datetime' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/opt/horilla/horilla/manage.py", line 22, in main() File "/opt/horilla/horilla/manage.py", line 18, in main execute_from_command_line(sys.argv) File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line utility.execute() File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/__init__.py", line 436, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/base.py", line 412, in run_from_argv self.execute(*args, **cmd_options) File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/base.py", line 458, in execute output = self.handle(*args, **options) File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/base.py", line 106, in wrapper res = handle_func(*args, **kwargs) File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/commands/migrate.py", line 356, in handle post_migrate_state = executor.migrate( File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/migrations/executor.py", line 135, in migrate ('archive', models.BooleanField(default=False)), ('company_id', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='base.company', verbose_name='Company')), ('created_by', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='Created By')), ('modified_by', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_modified_by', to=settings.AUTH_USER_MODEL, verbose_name='Modified By')), ], options={ 'ordering': ['-id'], }, ), migrations.CreateModel( name='Meetings', fields=[ ('id', models.BigAutoField(default="1", auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('created_at', models.DateTimeField(auto_now_add=True, null=True, verbose_name='Created At')), ('is_active', models.BooleanField(default=True, verbose_name='Is Active')), ('title', models.CharField(max_length=100)), ('date', models.DateTimeField(blank=True, null=True)), ('response', models.TextField(blank=True, null=True)), ('show_response', models.BooleanField(default=False, editable=False)), ('answer_employees', models.ManyToManyField(blank=True, help_text="Select the employees who can respond to question template in this meeting's, if any are added.", related_name='meeting_answer_employees', to='employee.employee', verbose_name='Answerable Employees')), ('created_by', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='Created By')), ('employee_id', models.ManyToManyField(related_name='meeting_employee', to='employee.employee', verbose_name='Employee')), ('manager', models.ManyToManyField(related_name='meeting_manager', to='employee.employee')),
sinancybrosys commented 1 month ago

0008_bonuspointsetting_keyresult_meetings_and_more.py.txt

sergej-wv commented 1 month ago

This fixes the error. Thank you for the support.