migrate to gtea from bistbucket
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('departments', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
// Multi-restaurant support
|
||||
$table->unsignedBigInteger('restaurant_id')->nullable()->index();
|
||||
|
||||
// Optional hierarchical structure (parent department)
|
||||
$table->unsignedBigInteger('parent_id')->nullable()->index()->comment('For department hierarchy');
|
||||
|
||||
// Department info
|
||||
$table->string('name', 100);
|
||||
$table->text('description')->nullable();
|
||||
|
||||
// Status: active/inactive
|
||||
$table->smallInteger('status')->default(1)->comment('1=Active, 2=Inactive');
|
||||
|
||||
// Optional metadata for future
|
||||
$table->json('meta')->nullable()->comment('Optional JSON for additional info');
|
||||
|
||||
// Timestamps & soft deletes
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
// Indexes for faster search
|
||||
$table->unique(['restaurant_id', 'name']); // prevent duplicate names within the same restaurant
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('departments');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('designations', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
// Multi-restaurant support
|
||||
$table->unsignedBigInteger('restaurant_id')->nullable()->index();
|
||||
|
||||
// Department reference (nullable for flexibility)
|
||||
$table->foreignId('department_id')->nullable()->constrained('departments')->onDelete('set null');
|
||||
|
||||
// Designation info
|
||||
$table->string('title', 100);
|
||||
$table->text('description')->nullable();
|
||||
|
||||
// Status: active/inactive
|
||||
$table->smallInteger('status')->default(1)->comment('1=Active, 2=Inactive');
|
||||
|
||||
// Optional metadata for future features
|
||||
$table->json('meta')->nullable()->comment('Optional JSON for additional info like level, grade, or code');
|
||||
|
||||
// Timestamps & soft deletes
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
// Unique constraint to prevent duplicate designations within same department & restaurant
|
||||
$table->unique(['restaurant_id', 'department_id', 'title']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('designations');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('salary_types', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
// Multi-restaurant support
|
||||
$table->unsignedBigInteger('restaurant_id')->nullable()->index();
|
||||
|
||||
// Salary type details
|
||||
$table->string('name', 100)->comment('Name of the salary component, e.g., Basic, Bonus, Tax');
|
||||
$table->enum('type', ['earning', 'deduction'])->default('earning');
|
||||
$table->decimal('default_amount', 15, 2)->default(0)->comment('Default amount for this salary type');
|
||||
|
||||
// Optional: calculation rules
|
||||
$table->enum('calculation_method', ['fixed', 'percentage'])->default('fixed')
|
||||
->comment('Fixed amount or percentage of basic salary');
|
||||
|
||||
$table->boolean('is_taxable')->default(false)->comment('Whether this earning is taxable');
|
||||
$table->boolean('is_visible_in_payslip')->default(true)->comment('Show in employee payslip');
|
||||
|
||||
// Status
|
||||
$table->smallInteger('status')->default(1)->comment('1=Active, 2=Inactive');
|
||||
|
||||
// Timestamps & soft deletes
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
// Indexes
|
||||
$table->index(['restaurant_id', 'type', 'status']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('salary_types');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('employee_salaries', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
// Multi-restaurant support
|
||||
$table->unsignedBigInteger('restaurant_id')->nullable()->index();
|
||||
|
||||
// Employee reference
|
||||
$table->foreignId('employee_id')->constrained('users')->onDelete('cascade');
|
||||
|
||||
// Salary period
|
||||
$table->string('salary_month', 7)->comment('Format: YYYY-MM')->index();
|
||||
|
||||
// Salary components
|
||||
$table->decimal('basic_salary', 12, 2)->default(0);
|
||||
$table->decimal('allowances', 12, 2)->default(0);
|
||||
$table->decimal('deductions', 12, 2)->default(0);
|
||||
$table->decimal('overtime_hours', 8, 2)->default(0);
|
||||
$table->decimal('overtime_rate', 12, 2)->default(0);
|
||||
$table->decimal('bonus', 12, 2)->default(0);
|
||||
$table->decimal('net_salary', 12, 2)->default(0);
|
||||
|
||||
// Payment tracking
|
||||
$table->date('payment_date')->nullable();
|
||||
$table->text('remarks')->nullable();
|
||||
|
||||
// Status and audit
|
||||
$table->enum('status', ['pending', 'approved', 'paid'])->default('pending');
|
||||
|
||||
// Optional: store JSON breakdown of salary components for flexibility
|
||||
$table->json('salary_breakdown')->nullable()->comment('Detailed breakdown of earnings/deductions');
|
||||
|
||||
// Timestamps & soft delete
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
// Indexes
|
||||
$table->index(['employee_id', 'salary_month', 'status']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('employee_salaries');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('salary_setups', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
// Multi-restaurant support
|
||||
$table->unsignedBigInteger('restaurant_id')->nullable()->index();
|
||||
|
||||
// Employee reference
|
||||
$table->foreignId('employee_id')->constrained('users')->onDelete('cascade');
|
||||
|
||||
// Salary component reference
|
||||
$table->foreignId('salary_type_id')->constrained('salary_types')->onDelete('cascade');
|
||||
|
||||
// Amount & calculation
|
||||
$table->decimal('amount', 15, 2)->default(0)->comment('Amount for this salary component');
|
||||
$table->enum('calculation_type', ['fixed', 'percentage'])->default('fixed')
|
||||
->comment('Fixed amount or percentage of basic salary');
|
||||
|
||||
// Optional: custom notes
|
||||
$table->string('notes')->nullable()->comment('Optional notes or description');
|
||||
|
||||
// Status & audit
|
||||
$table->smallInteger('status')->default(1)->comment('1=Active, 2=Inactive');
|
||||
|
||||
// Timestamps & soft delete
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
// Indexes for reporting
|
||||
$table->index(['employee_id', 'salary_type_id', 'status']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('salary_setups');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('salary_generates', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
// Multi-restaurant support
|
||||
$table->unsignedBigInteger('restaurant_id')->nullable()->index();
|
||||
|
||||
// Employee reference
|
||||
$table->foreignId('employee_id')->constrained('users')->onDelete('cascade');
|
||||
|
||||
// Salary month
|
||||
$table->string('month', 7)->comment('Format: YYYY-MM')->index();
|
||||
|
||||
// Salary components
|
||||
$table->decimal('basic_salary', 15, 2)->default(0);
|
||||
$table->decimal('total_earnings', 15, 2)->default(0);
|
||||
$table->decimal('total_deductions', 15, 2)->default(0);
|
||||
$table->decimal('overtime_hours', 8, 2)->default(0);
|
||||
$table->decimal('overtime_amount', 15, 2)->default(0);
|
||||
$table->decimal('net_salary', 15, 2)->default(0);
|
||||
|
||||
// Payroll metadata
|
||||
$table->date('generated_date')->nullable();
|
||||
$table->unsignedBigInteger('generated_by')->nullable()->index();
|
||||
|
||||
// Optional: store salary breakdown for auditing
|
||||
$table->json('salary_breakdown')->nullable()->comment('Detailed JSON of salary components');
|
||||
|
||||
// Status
|
||||
$table->enum('status', ['pending', 'approved', 'paid'])->default('pending');
|
||||
|
||||
// Timestamps & soft deletes
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
// Indexes for performance
|
||||
$table->index(['employee_id', 'month', 'status']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('salary_generates');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('attendances', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
// Multi-restaurant support
|
||||
$table->unsignedBigInteger('restaurant_id')->nullable()->index();
|
||||
|
||||
// Employee reference
|
||||
$table->foreignId('employee_id')->constrained('users')->onDelete('cascade');
|
||||
|
||||
// Attendance date
|
||||
$table->date('date')->index();
|
||||
|
||||
// Attendance times
|
||||
$table->time('first_clock_in')->nullable();
|
||||
$table->time('last_clock_out')->nullable();
|
||||
$table->decimal('hours_worked', 5, 2)->nullable()->comment('Total hours worked');
|
||||
|
||||
// Status & type
|
||||
$table->enum('status', ['present', 'absent', 'leave', 'holiday'])->default('present');
|
||||
|
||||
// Optional metadata
|
||||
$table->json('breaks')->nullable()->comment('Optional JSON array to store break periods');
|
||||
$table->json('notes')->nullable()->comment('Any admin notes or special remarks');
|
||||
|
||||
// Timestamps & soft deletes
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
// Ensure only one record per employee per day
|
||||
$table->unique(['employee_id', 'date']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('attendances');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('attendance_logs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
// Multi-restaurant support
|
||||
$table->unsignedBigInteger('restaurant_id')->nullable()->index();
|
||||
|
||||
// Employee reference
|
||||
$table->foreignId('employee_id')->constrained('users')->onDelete('cascade');
|
||||
|
||||
// Link to daily attendance
|
||||
$table->foreignId('attendance_id')->constrained('attendances')->onDelete('cascade');
|
||||
|
||||
// Clock-in / Clock-out
|
||||
$table->enum('type', ['in', 'out']);
|
||||
$table->timestamp('punch_time')->index();
|
||||
$table->string('device_id')->nullable()->comment('Optional device ID');
|
||||
|
||||
// Optional: capture location
|
||||
$table->decimal('latitude', 10, 7)->nullable();
|
||||
$table->decimal('longitude', 10, 7)->nullable();
|
||||
$table->string('ip_address', 45)->nullable()->comment('IP from which punch was made');
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('attendance_logs');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('leave_types', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
// 🔗 Multi-restaurant support
|
||||
$table->unsignedBigInteger('restaurant_id')->nullable()->index();
|
||||
|
||||
// 🏷️ Leave Type Information
|
||||
$table->string('name', 100);
|
||||
$table->integer('max_days')->default(0)->comment('Maximum days allowed per year');
|
||||
$table->boolean('carry_forward')->default(false)->comment('Whether unused days can carry over to next year');
|
||||
$table->boolean('is_paid')->default(true)->comment('Determines if the leave is paid');
|
||||
|
||||
// ⚙️ Control & Status
|
||||
$table->smallInteger('status')->default(1)->comment('1=Active, 2=Inactive');
|
||||
$table->text('description')->nullable()->comment('Optional leave policy or notes');
|
||||
|
||||
// 🕓 Standard timestamps
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('leave_types');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('leave_applications', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
// 🔗 Multi-restaurant support
|
||||
$table->unsignedBigInteger('restaurant_id')->nullable()->index();
|
||||
|
||||
// 🔗 Foreign keys
|
||||
$table->foreignId('employee_id')->constrained('users')->onDelete('cascade');
|
||||
$table->foreignId('leave_type_id')->constrained('leave_types')->onDelete('cascade');
|
||||
|
||||
// 🗓️ Leave duration
|
||||
$table->date('start_date');
|
||||
$table->date('end_date');
|
||||
|
||||
// 📝 Reason and notes
|
||||
$table->text('reason')->nullable();
|
||||
$table->text('admin_note')->nullable()->comment('Optional note by admin/manager');
|
||||
|
||||
// ⚙️ Status and approval tracking
|
||||
$table->enum('status', ['pending', 'approved', 'rejected'])->default('pending');
|
||||
$table->foreignId('approved_by')->nullable()->constrained('users')->onDelete('set null');
|
||||
|
||||
// Optional: flag for half-day, full-day, or custom leave
|
||||
$table->enum('leave_duration_type', ['full_day', 'half_day', 'custom'])->default('full_day');
|
||||
|
||||
// ⚙️ Metadata
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
// Indexes for faster filtering
|
||||
$table->index(['employee_id', 'leave_type_id', 'status']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('leave_applications');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('weekly_holidays', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('restaurant_id')->nullable()->index();
|
||||
$table->string('day', 20);
|
||||
$table->string('description', 255)->nullable();
|
||||
$table->smallInteger('status')->default(1)->comment('1=Active, 2=Inactive');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
// Unique per restaurant
|
||||
$table->unique(['restaurant_id', 'day']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('weekly_holidays');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('loans', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
// 🔗 Multi-restaurant / branch support
|
||||
$table->unsignedBigInteger('restaurant_id')->nullable()->index();
|
||||
|
||||
// 🔗 Employee
|
||||
$table->foreignId('employee_id')->constrained('users')->onDelete('cascade');
|
||||
|
||||
// 💰 Loan details
|
||||
$table->decimal('amount', 15, 2)->comment('Total loan amount');
|
||||
$table->decimal('paid_amount', 15, 2)->default(0);
|
||||
$table->decimal('remaining_amount', 15, 2)->default(0)->comment('Remaining amount');
|
||||
$table->enum('schedule_type', ['daily', 'weekly', 'monthly', 'yearly'])->default('monthly');
|
||||
$table->integer('installments')->default(1)->comment('Total number of installments');
|
||||
$table->decimal('fine_rate', 8, 4)->default(0)->comment('per day percentage e.g. 0.01 = 1%');
|
||||
|
||||
// ⚙️ Status and type
|
||||
$table->enum('status', ['active', 'closed'])->default('active')->comment('Loan status');
|
||||
$table->enum('loan_type', ['personal', 'business', 'emergency', 'other'])->default('personal')
|
||||
->comment('Type of loan');
|
||||
|
||||
// 📝 Optional metadata
|
||||
$table->text('remarks')->nullable()->comment('Notes about the loan');
|
||||
$table->date('start_date')->nullable();
|
||||
$table->date('end_date')->nullable(); // calculated from installments
|
||||
|
||||
// ⏱ Timestamps & soft delete
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
// Indexes for reports
|
||||
$table->index(['employee_id', 'status', 'loan_type']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('loans');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('loan_installments', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
// 🔗 Multi-restaurant support
|
||||
$table->unsignedBigInteger('restaurant_id')->nullable()->index();
|
||||
|
||||
// 🔗 Link to parent loan
|
||||
$table->foreignId('loan_id')->constrained('loans')->onDelete('cascade');
|
||||
|
||||
// Installment details
|
||||
$table->decimal('amount', 15, 2)->comment('Installment amount');
|
||||
$table->date('due_date')->comment('Scheduled due date');
|
||||
$table->date('paid_date')->nullable()->comment('Actual paid date');
|
||||
$table->boolean('is_paid')->default(false)->comment('Payment status');
|
||||
|
||||
// Overdue handling
|
||||
$table->boolean('is_overdue')->default(false)->comment('Marks overdue installment');
|
||||
$table->decimal('fine_amount', 15, 2)->default(0)->comment('Fine for overdue payment');
|
||||
$table->decimal('total_due', 15, 2)->virtualAs('amount + fine_amount')->nullable()
|
||||
->comment('Total due including fine');
|
||||
|
||||
// Status and remarks
|
||||
$table->enum('status', ['active', 'inactive'])->default('active');
|
||||
$table->text('remarks')->nullable()->comment('Optional notes');
|
||||
|
||||
// Timestamps & soft delete
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
// Indexes for fast reporting and filtering
|
||||
$table->index(['loan_id', 'is_paid', 'due_date', 'is_overdue']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('loan_installments');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('awards', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
// Multi-restaurant support
|
||||
$table->unsignedBigInteger('restaurant_id')->nullable()->index();
|
||||
|
||||
// Employee reference
|
||||
$table->foreignId('employee_id')->constrained('users')->onDelete('cascade');
|
||||
|
||||
// Award details
|
||||
$table->string('title', 100);
|
||||
$table->text('description')->nullable();
|
||||
$table->date('date_awarded');
|
||||
$table->decimal('amount', 15, 2)->default(0)->comment('Cash award amount');
|
||||
|
||||
// Optional: type of award (cash, recognition, certificate)
|
||||
$table->enum('award_type', ['cash', 'recognition', 'certificate', 'other'])->default('cash');
|
||||
|
||||
// Status
|
||||
$table->smallInteger('status')->default(1)->comment('1=Active, 2=Inactive');
|
||||
|
||||
// Metadata
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
// Indexes
|
||||
$table->index(['employee_id', 'date_awarded']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('awards');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('recruitments', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
// Multi-restaurant support
|
||||
$table->unsignedBigInteger('restaurant_id')->nullable()->index();
|
||||
|
||||
// Job details
|
||||
$table->string('title', 150);
|
||||
$table->text('description')->nullable();
|
||||
$table->text('requirements')->nullable();
|
||||
$table->integer('vacancy_count')->default(1);
|
||||
|
||||
// Department & Designation (optional)
|
||||
$table->foreignId('department_id')->nullable()->constrained('departments')->onDelete('set null');
|
||||
$table->foreignId('designation_id')->nullable()->constrained('designations')->onDelete('set null');
|
||||
|
||||
// Dates
|
||||
$table->date('start_date');
|
||||
$table->date('end_date')->nullable();
|
||||
|
||||
// Job type & recruiter tracking
|
||||
$table->enum('job_type', ['full_time', 'part_time', 'internship', 'contract'])->default('full_time');
|
||||
$table->foreignId('recruiter_id')->nullable()->constrained('users')->onDelete('set null');
|
||||
|
||||
// Status
|
||||
$table->enum('status', ['open', 'closed'])->default('open');
|
||||
|
||||
// Timestamps & soft delete
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
// Indexes for faster queries
|
||||
$table->index(['restaurant_id', 'status', 'start_date']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('recruitments');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('candidates', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
// Multi-restaurant support
|
||||
$table->unsignedBigInteger('restaurant_id')->nullable()->index();
|
||||
|
||||
// Link to recruitment/job post
|
||||
$table->foreignId('recruitment_id')->constrained('recruitments')->onDelete('cascade');
|
||||
|
||||
// Candidate details
|
||||
$table->string('first_name', 50);
|
||||
$table->string('last_name', 50)->nullable();
|
||||
$table->string('email', 100)->nullable()->index();
|
||||
$table->string('phone', 20)->nullable()->index();
|
||||
$table->string('resume')->nullable()->comment('File path for uploaded resume');
|
||||
$table->string('cover_letter')->nullable()->comment('Optional cover letter file path');
|
||||
|
||||
// Candidate status
|
||||
$table->enum('status', ['applied', 'shortlisted', 'interviewed', 'selected', 'rejected'])->default('applied');
|
||||
|
||||
// Optional notes from recruiter or admin
|
||||
$table->text('notes')->nullable();
|
||||
|
||||
// Timestamps & soft delete
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
// Indexes for queries and reporting
|
||||
$table->index(['recruitment_id', 'status']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('candidates');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('interviews', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
// Multi-restaurant support
|
||||
$table->unsignedBigInteger('restaurant_id')->nullable()->index();
|
||||
|
||||
// Candidate reference
|
||||
$table->foreignId('candidate_id')->constrained('candidates')->onDelete('cascade');
|
||||
|
||||
// Optional department reference
|
||||
$table->foreignId('department_id')->nullable()->constrained('departments')->onDelete('set null');
|
||||
|
||||
// Interview details
|
||||
$table->dateTime('interview_date')->nullable();
|
||||
$table->string('interviewer_name', 100)->nullable();
|
||||
$table->text('feedback')->nullable();
|
||||
|
||||
// Status tracking
|
||||
$table->enum('status', ['pending', 'shortlisted', 'rejected', 'hired'])->default('pending');
|
||||
|
||||
// Optional notes or rating
|
||||
$table->tinyInteger('rating')->nullable()->comment('Rating out of 5');
|
||||
|
||||
// Timestamps & soft delete
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
// Indexes for performance
|
||||
$table->index(['candidate_id', 'status', 'interview_date']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('interviews');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('shifts', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('restaurant_id')->nullable();
|
||||
$table->string('name'); // e.g., Morning, Evening, Night
|
||||
$table->time('start_time');
|
||||
$table->time('end_time');
|
||||
$table->string('description')->nullable();
|
||||
$table->smallInteger('status')->default(1)->comment('1=Active, 2=InActive');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('shifts');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('employee_shift_assignments', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('restaurant_id')->nullable();
|
||||
$table->unsignedBigInteger('employee_id');
|
||||
$table->unsignedBigInteger('shift_id');
|
||||
$table->smallInteger('status')->default(1)->comment('1=Active, 2=InActive');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->foreign('employee_id')->references('id')->on('users')->onDelete('cascade');
|
||||
$table->foreign('shift_id')->references('id')->on('shifts')->onDelete('cascade');
|
||||
$table->unique(['employee_id']); // One shift per employee
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('employee_shift_assignments');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user