update migration
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m27s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 17s
Build, Push and Deploy / deploy-staging (push) Successful in 23s
Build, Push and Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-05-05 17:18:42 +07:00
parent 30de18d283
commit 3b3a1da5c3
7 changed files with 92 additions and 78 deletions

View File

@@ -11,24 +11,26 @@
*/
public function up(): void
{
Schema::create('employees', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
$table->foreignId('designation_id')->nullable()->constrained()->nullOnDelete();
$table->foreignId('department_id')->nullable()->constrained()->nullOnDelete();
$table->foreignId('shift_id')->nullable()->constrained()->nullOnDelete();
$table->double('amount', 10, 2)->default(0);
$table->string('image')->nullable();
$table->string('phone');
$table->string('email')->nullable();
$table->string('gender');
$table->string('country')->nullable();
$table->date('birth_date')->nullable();
$table->date('join_date')->nullable();
$table->string('status')->default('active'); // active || terminated || suspended
$table->timestamps();
});
if (!Schema::hasTable('employees')) {
Schema::create('employees', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
$table->foreignId('designation_id')->nullable()->constrained()->nullOnDelete();
$table->foreignId('department_id')->nullable()->constrained()->nullOnDelete();
$table->foreignId('shift_id')->nullable()->constrained()->nullOnDelete();
$table->double('amount', 10, 2)->default(0);
$table->string('image')->nullable();
$table->string('phone');
$table->string('email')->nullable();
$table->string('gender');
$table->string('country')->nullable();
$table->date('birth_date')->nullable();
$table->date('join_date')->nullable();
$table->string('status')->default('active'); // active || terminated || suspended
$table->timestamps();
});
}
}
/**

View File

@@ -11,14 +11,16 @@
*/
public function up(): void
{
Schema::create('leave_types', function (Blueprint $table) {
$table->id();
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
$table->string('name');
$table->text('description')->nullable();
$table->boolean('status')->default(1);
$table->timestamps();
});
if (!Schema::hasTable('leave_types')) {
Schema::create('leave_types', function (Blueprint $table) {
$table->id();
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
$table->string('name');
$table->text('description')->nullable();
$table->boolean('status')->default(1);
$table->timestamps();
});
}
}
/**

View File

@@ -11,20 +11,22 @@
*/
public function up(): void
{
Schema::create('leaves', function (Blueprint $table) {
$table->id();
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
$table->foreignId('employee_id')->constrained()->cascadeOnDelete();
$table->foreignId('leave_type_id')->nullable()->constrained()->nullOnDelete();
$table->foreignId('department_id')->nullable()->constrained()->nullOnDelete();
$table->date('start_date');
$table->date('end_date');
$table->double('leave_duration');
$table->string('month');
$table->string('status')->default('pending'); // rejected, pending, approved
$table->text('description')->nullable();
$table->timestamps();
});
if (!Schema::hasTable('leaves')) {
Schema::create('leaves', function (Blueprint $table) {
$table->id();
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
$table->foreignId('employee_id')->constrained()->cascadeOnDelete();
$table->foreignId('leave_type_id')->nullable()->constrained()->nullOnDelete();
$table->foreignId('department_id')->nullable()->constrained()->nullOnDelete();
$table->date('start_date');
$table->date('end_date');
$table->double('leave_duration');
$table->string('month');
$table->string('status')->default('pending'); // rejected, pending, approved
$table->text('description')->nullable();
$table->timestamps();
});
}
}
/**

View File

@@ -11,15 +11,17 @@
*/
public function up(): void
{
Schema::create('holidays', function (Blueprint $table) {
$table->id();
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
$table->string('name');
$table->date('start_date');
$table->date('end_date');
$table->text('description')->nullable();
$table->timestamps();
});
if (!Schema::hasTable('holidays')) {
Schema::create('holidays', function (Blueprint $table) {
$table->id();
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
$table->string('name');
$table->date('start_date');
$table->date('end_date');
$table->text('description')->nullable();
$table->timestamps();
});
}
}
/**

View File

@@ -11,19 +11,21 @@
*/
public function up(): void
{
Schema::create('attendances', function (Blueprint $table) {
$table->id();
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
$table->foreignId('employee_id')->constrained()->cascadeOnDelete();
$table->foreignId('shift_id')->nullable()->constrained()->nullOnDelete();
$table->time('time_in');
$table->time('time_out');
$table->date('date');
$table->time('duration');
$table->string('month');
$table->longText('note')->nullable();
$table->timestamps();
});
if (!Schema::hasTable('attendances')) {
Schema::create('attendances', function (Blueprint $table) {
$table->id();
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
$table->foreignId('employee_id')->constrained()->cascadeOnDelete();
$table->foreignId('shift_id')->nullable()->constrained()->nullOnDelete();
$table->time('time_in');
$table->time('time_out');
$table->date('date');
$table->time('duration');
$table->string('month');
$table->longText('note')->nullable();
$table->timestamps();
});
}
}
/**

View File

@@ -11,19 +11,21 @@
*/
public function up(): void
{
Schema::create('payrolls', function (Blueprint $table) {
$table->id();
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
$table->foreignId('employee_id')->constrained()->cascadeOnDelete();
$table->foreignId('payment_type_id')->nullable()->constrained()->nullOnDelete();
$table->string('month');
$table->string('puid');
$table->date('date')->nullable();
$table->double('amount', 10, 2);
$table->string('payemnt_year');
$table->longText('note')->nullable();
$table->timestamps();
});
if (!Schema::hasTable('payrolls')) {
Schema::create('payrolls', function (Blueprint $table) {
$table->id();
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
$table->foreignId('employee_id')->constrained()->cascadeOnDelete();
$table->foreignId('payment_type_id')->nullable()->constrained()->nullOnDelete();
$table->string('month');
$table->string('puid');
$table->date('date')->nullable();
$table->double('amount', 10, 2);
$table->string('payemnt_year');
$table->longText('note')->nullable();
$table->timestamps();
});
}
}
/**

View File

@@ -12,9 +12,11 @@ public function up(): void
{
// HOLIDAYS, ATTENDANCES, LEAVES, PAYROLLS, employees
foreach (['holidays', 'attendances', 'leaves', 'payrolls', 'employees'] as $tableName) {
Schema::table($tableName, function (Blueprint $table) {
$table->foreignId('branch_id')->nullable()->after('business_id')->constrained('branches')->nullOnDelete();
});
if (!Schema::hasColumn($tableName, 'branch_id')) {
Schema::table($tableName, function (Blueprint $table) {
$table->foreignId('branch_id')->nullable()->after('business_id')->constrained('branches')->nullOnDelete();
});
}
}
}