39 lines
1.0 KiB
PHP
39 lines
1.0 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*/
|
|
public function up(): void
|
|
{
|
|
Schema::create('shifts', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->string('day_of_week')->nullable();
|
|
$table->date('date')->nullable();
|
|
$table->time('start_time');
|
|
$table->time('end_time');
|
|
$table->boolean('is_active')->default(true);
|
|
$table->timestamps();
|
|
|
|
$table->foreignId('user_id')->nullable()->constrained('users')->nullOnDelete();
|
|
$table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
|
|
|
|
$table->index(['day_of_week', 'is_active']);
|
|
$table->index(['date', 'is_active']);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('shifts');
|
|
}
|
|
};
|