Coverage for modules\hr\migrations\0001_initial.py: 100%

9 statements  

« prev     ^ index     » next       coverage.py v7.16.0, created at 2026-09-05 09:24 +0800

1# Generated by Django 5.1.15 on 2026-09-02 13:09 

2 

3import django.core.validators 

4import django.db.models.deletion 

5import uuid 

6from django.conf import settings 

7from django.db import migrations, models 

8 

9 

10class Migration(migrations.Migration): 

11 

12 initial = True 

13 

14 dependencies = [ 

15 migrations.swappable_dependency(settings.AUTH_USER_MODEL), 

16 ] 

17 

18 operations = [ 

19 migrations.CreateModel( 

20 name='PayrollRun', 

21 fields=[ 

22 ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), 

23 ('created_at', models.DateTimeField(auto_now_add=True, db_index=True)), 

24 ('updated_at', models.DateTimeField(auto_now=True)), 

25 ('tenant_id', models.UUIDField(db_index=True, help_text='Organization / Tenant ID')), 

26 ('period_start', models.DateField()), 

27 ('period_end', models.DateField()), 

28 ('status', models.CharField(default='DRAFT', max_length=16)), 

29 ('total_gross', models.DecimalField(decimal_places=2, default=0, max_digits=16)), 

30 ('total_tax', models.DecimalField(decimal_places=2, default=0, max_digits=16)), 

31 ('total_net', models.DecimalField(decimal_places=2, default=0, max_digits=16)), 

32 ], 

33 options={ 

34 'abstract': False, 

35 }, 

36 ), 

37 migrations.CreateModel( 

38 name='EmployeeProfile', 

39 fields=[ 

40 ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), 

41 ('created_at', models.DateTimeField(auto_now_add=True, db_index=True)), 

42 ('updated_at', models.DateTimeField(auto_now=True)), 

43 ('tenant_id', models.UUIDField(db_index=True, help_text='Organization / Tenant ID')), 

44 ('employee_number', models.CharField(max_length=32)), 

45 ('hire_date', models.DateField(blank=True, null=True)), 

46 ('birth_date', models.DateField(blank=True, null=True)), 

47 ('employment_status', models.CharField(default='ACTIVE', max_length=32)), 

48 ('job_title', models.CharField(blank=True, max_length=128)), 

49 ('salary_monthly', models.DecimalField(decimal_places=2, default=0, max_digits=14, validators=[django.core.validators.MinValueValidator(0)])), 

50 ('government_ids', models.JSONField(blank=True, default=dict)), 

51 ('emergency_contact', models.JSONField(blank=True, default=dict)), 

52 ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='hr_profiles', to=settings.AUTH_USER_MODEL)), 

53 ], 

54 options={ 

55 'ordering': ['employee_number'], 

56 }, 

57 ), 

58 migrations.CreateModel( 

59 name='Claim', 

60 fields=[ 

61 ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), 

62 ('created_at', models.DateTimeField(auto_now_add=True, db_index=True)), 

63 ('updated_at', models.DateTimeField(auto_now=True)), 

64 ('tenant_id', models.UUIDField(db_index=True, help_text='Organization / Tenant ID')), 

65 ('category', models.CharField(max_length=64)), 

66 ('amount', models.DecimalField(decimal_places=2, max_digits=14, validators=[django.core.validators.MinValueValidator(0)])), 

67 ('claim_date', models.DateField()), 

68 ('description', models.TextField(blank=True)), 

69 ('status', models.CharField(default='PENDING', max_length=16)), 

70 ('reviewed_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='reviewed_claims', to=settings.AUTH_USER_MODEL)), 

71 ('profile', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='claims', to='hr.employeeprofile')), 

72 ], 

73 options={ 

74 'abstract': False, 

75 }, 

76 ), 

77 migrations.CreateModel( 

78 name='EmployeeRecord', 

79 fields=[ 

80 ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), 

81 ('created_at', models.DateTimeField(auto_now_add=True, db_index=True)), 

82 ('updated_at', models.DateTimeField(auto_now=True)), 

83 ('tenant_id', models.UUIDField(db_index=True, help_text='Organization / Tenant ID')), 

84 ('record_type', models.CharField(max_length=64)), 

85 ('title', models.CharField(max_length=160)), 

86 ('file_url', models.URLField(blank=True, max_length=500)), 

87 ('issued_on', models.DateField(blank=True, null=True)), 

88 ('notes', models.TextField(blank=True)), 

89 ('profile', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='records', to='hr.employeeprofile')), 

90 ], 

91 options={ 

92 'abstract': False, 

93 }, 

94 ), 

95 migrations.CreateModel( 

96 name='LeaveRequest', 

97 fields=[ 

98 ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), 

99 ('created_at', models.DateTimeField(auto_now_add=True, db_index=True)), 

100 ('updated_at', models.DateTimeField(auto_now=True)), 

101 ('tenant_id', models.UUIDField(db_index=True, help_text='Organization / Tenant ID')), 

102 ('leave_type', models.CharField(max_length=64)), 

103 ('start_date', models.DateField()), 

104 ('end_date', models.DateField()), 

105 ('reason', models.TextField(blank=True)), 

106 ('status', models.CharField(default='PENDING', max_length=16)), 

107 ('profile', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='leave_requests', to='hr.employeeprofile')), 

108 ('reviewed_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='reviewed_leave_requests', to=settings.AUTH_USER_MODEL)), 

109 ], 

110 options={ 

111 'abstract': False, 

112 }, 

113 ), 

114 migrations.CreateModel( 

115 name='PayrollItem', 

116 fields=[ 

117 ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), 

118 ('created_at', models.DateTimeField(auto_now_add=True, db_index=True)), 

119 ('updated_at', models.DateTimeField(auto_now=True)), 

120 ('tenant_id', models.UUIDField(db_index=True, help_text='Organization / Tenant ID')), 

121 ('pay_rates', models.JSONField(default=list)), 

122 ('gross_pay', models.DecimalField(decimal_places=2, default=0, max_digits=16)), 

123 ('taxable_income', models.DecimalField(decimal_places=2, default=0, max_digits=16)), 

124 ('withholding_tax', models.DecimalField(decimal_places=2, default=0, max_digits=16)), 

125 ('net_pay', models.DecimalField(decimal_places=2, default=0, max_digits=16)), 

126 ('profile', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='payroll_items', to='hr.employeeprofile')), 

127 ('run', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='hr.payrollrun')), 

128 ], 

129 options={ 

130 'abstract': False, 

131 }, 

132 ), 

133 migrations.CreateModel( 

134 name='PerformanceReview', 

135 fields=[ 

136 ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), 

137 ('created_at', models.DateTimeField(auto_now_add=True, db_index=True)), 

138 ('updated_at', models.DateTimeField(auto_now=True)), 

139 ('tenant_id', models.UUIDField(db_index=True, help_text='Organization / Tenant ID')), 

140 ('review_period', models.CharField(max_length=64)), 

141 ('rating', models.DecimalField(blank=True, decimal_places=2, max_digits=4, null=True)), 

142 ('goals', models.JSONField(blank=True, default=list)), 

143 ('feedback', models.TextField(blank=True)), 

144 ('status', models.CharField(default='DRAFT', max_length=32)), 

145 ('profile', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='performance_reviews', to='hr.employeeprofile')), 

146 ('reviewer', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='performance_reviews_given', to=settings.AUTH_USER_MODEL)), 

147 ], 

148 options={ 

149 'abstract': False, 

150 }, 

151 ), 

152 migrations.CreateModel( 

153 name='TaxDocument', 

154 fields=[ 

155 ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), 

156 ('created_at', models.DateTimeField(auto_now_add=True, db_index=True)), 

157 ('updated_at', models.DateTimeField(auto_now=True)), 

158 ('tenant_id', models.UUIDField(db_index=True, help_text='Organization / Tenant ID')), 

159 ('tax_year', models.PositiveIntegerField()), 

160 ('document_type', models.CharField(default='BIR_2316', max_length=32)), 

161 ('status', models.CharField(default='DRAFT', max_length=32)), 

162 ('annual_gross', models.DecimalField(decimal_places=2, default=0, max_digits=16)), 

163 ('annual_tax', models.DecimalField(decimal_places=2, default=0, max_digits=16)), 

164 ('file_url', models.URLField(blank=True, max_length=500)), 

165 ('profile', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tax_documents', to='hr.employeeprofile')), 

166 ], 

167 options={ 

168 'abstract': False, 

169 }, 

170 ), 

171 migrations.AddConstraint( 

172 model_name='employeeprofile', 

173 constraint=models.UniqueConstraint(fields=('tenant_id', 'employee_number'), name='hr_employee_number_tenant_unique'), 

174 ), 

175 ]